diff --git a/api/@ohos.account.osAccount.d.ts b/api/@ohos.account.osAccount.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ba076d5dd09d062d8cae1af06e7d6f4310d0e1d1 --- /dev/null +++ b/api/@ohos.account.osAccount.d.ts @@ -0,0 +1,549 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import distributedAccount from './@ohos.account.distributedAccount' +import {AsyncCallback} from "./basic"; + +declare namespace osAccount { + /** + * Obtains the AccountManager instance. + * @since 7 + * @sysCap SystemCapability.Account.OsAccount + * @devices phone, tablet, tv, wearable, car + * @return Returns the instance of the AccountManager. + */ + function getAccountManager(): AccountManager; + + /** + * Provides abilities for you to manage and perform operations on your OS accounts. + * @name AccountManager + * @since 7 + * @sysCap SystemCapability.Account.OsAccount + * @devices phone, tablet, tv, wearable, car + */ + interface AccountManager { + /** + * Activates a specified OS account. + *
+ * If multiple OS accounts are available, you can call this method to enable a specific OS account + * to run in the foreground. Then, the OS account originally running in the foreground will be + * switched to the background. + *
+ * @since 7 + * @devices phone, tablet, tv, wearable, car + * @param localId Indicates the local ID of the OS account. + * @return void. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION. + * @systemapi Hide this for inner system use. + */ + activateOsAccount(localId: number, callback: AsyncCallback+ * If the same OHOS account has logged in to multiple devices, these devices constitute a super device + * through the distributed networking. On the networked devices, you can call this method to obtain the DVIDs. + * The same application running on different devices obtains the same DVID, whereas different applications + * obtain different DVIDs. + *
+ *
+ * @since 7
+ * @devices phone, tablet, tv, wearable, car
+ * @return Returns the DVID if obtained; returns an empty string if no OHOS account has logged in.
+ * @permission ohos.permission.DISTRIBUTED_DATASYNC.
+ */
+ getDistributedVirtualDeviceId(callback: AsyncCallback
+ * When user change the account, the subscriber will receive a notification
+ * about the account change event.
+ *
+ * @since 7
+ * @devices phone, tablet, tv, wearable, car
+ * @param type Event type.
+ * @param name Indicates the name of subscriber.
+ * @return void.
+ * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
+ * @systemapi Hide this for inner system use.
+ */
+ on(type: 'activate' | 'activating', name: string, callback: Callback