From a6ecee904c91f35bbb550ab5f45b341b6a908ba1 Mon Sep 17 00:00:00 2001 From: SoftSquirrel Date: Mon, 20 Jun 2022 10:38:55 +0800 Subject: [PATCH 1/2] IssueNo: #I56PK3:default application: add default application interfaces Description: add default application interfaces Sig: SIG_ApplicaitonFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: SoftSquirrel --- api/@ohos.bundle.defaultAppManager.d.ts | 145 ++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 api/@ohos.bundle.defaultAppManager.d.ts diff --git a/api/@ohos.bundle.defaultAppManager.d.ts b/api/@ohos.bundle.defaultAppManager.d.ts new file mode 100644 index 0000000000..1f9f36389f --- /dev/null +++ b/api/@ohos.bundle.defaultAppManager.d.ts @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2022 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 { AsyncCallback } from './basic'; +import { BundleInfo } from './bundle/bundleInfo'; +import { ElementName } from './bundle/elementName'; + +/** + * default application manager. + * @name defaultAppManager + * @since 9 + * @syscap SystemCapability.BundleManager.BundleFramework + * @permission NA + */ +declare namespace defaultAppManager { + /** + * the constant for application type. + * @name ApplicationType + * @since 9 + * @syscap SystemCapability.BundleManager.BundleFramework + * @permission N/A + */ + export enum ApplicationType { + /** + * default browser identifier. + * + * @since 9 + */ + BROWSER = "BROWSER", + /** + * default image identifier. + * + * @since 9 + */ + IMAGE = "IMAGE", + /** + * default audio identifier. + * + * @since 9 + */ + AUDIO = "AUDIO", + /** + * default video identifier. + * + * @since 9 + */ + VIDEO = "VIDEO", + /** + * default pdf identifier. + * + * @since 9 + */ + PDF = "PDF", + /** + * default word identifier. + * + * @since 9 + */ + WORD = "WORD", + /** + * default excel identifier. + * + * @since 9 + */ + EXCEL = "EXCEL", + /** + * default ppt identifier. + * + * @since 9 + */ + PPT = "PPT", + } + + /** + * query whether the caller is default application based on type. + * + * @since 9 + * @syscap SystemCapability.BundleManager.BundleFramework + * @param type application type or file type. + * @return return true if caller is default application; return false otherwise. + * @permission N/A + */ + function isDefaultApplication(type: string) : Promise; + function isDefaultApplication(type: string, callback: AsyncCallback) : void; + + /** + * get default application based on type. + * + * @since 9 + * @syscap SystemCapability.BundleManager.BundleFramework + * @param type application type or file type. + * @param userId indicates the id for the user. + * @return return the BundleInfo object. + * @permission ohos.permission.GET_DEFAULT_APPLICATION + * @systemapi hide this for inner system use. + */ + function getDefaultApplication(type: string, userId?: number) : Promise; + function getDefaultApplication(type: string, userId: number, callback: AsyncCallback) : void; + function getDefaultApplication(type: string, callback: AsyncCallback) : void; + + /** + * set default application based on type. + * + * @since 9 + * @syscap SystemCapability.BundleManager.BundleFramework + * @param type application type or file type. + * @param elementName uniquely identifies an ability or extensionAbility. + * @param userId indicates the id for the user. + * @return return true if set default application success; return false otherwise. + * @permission ohos.permission.SET_DEFAULT_APPLICATION + * @systemapi hide this for inner system use. + */ + function setDefaultApplication(type: string, elementName: ElementName, userId?: number) : Promise; + function setDefaultApplication(type: string, elementName: ElementName, userId: number, callback: AsyncCallback) : void; + function setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCallback) : void; + + /** + * reset default application based on type. + * + * @since 9 + * @syscap SystemCapability.BundleManager.BundleFramework + * @param type application type or file type. + * @param userId indicates the id for the user. + * @return return true if reset default application success; return false otherwise. + * @permission ohos.permission.SET_DEFAULT_APPLICATION + * @systemapi hide this for inner system use. + */ + function resetDefaultApplication(type: string, userId?: number) : Promise; + function resetDefaultApplication(type: string, userId: number, callback: AsyncCallback) : void; + function resetDefaultApplication(type: string, callback: AsyncCallback) : void; +} + +export default defaultAppManager; -- Gitee From f86d5f5e384248eab2394283cac094b7effbfb31 Mon Sep 17 00:00:00 2001 From: SoftSquirrel Date: Mon, 20 Jun 2022 10:47:38 +0800 Subject: [PATCH 2/2] IssueNo: #I56PK3:default application: add default application interfaces Description: add default application interfaces Sig: SIG_ApplicaitonFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: SoftSquirrel --- api/@ohos.bundle.defaultAppManager.d.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/api/@ohos.bundle.defaultAppManager.d.ts b/api/@ohos.bundle.defaultAppManager.d.ts index 1f9f36389f..d467bb1b4a 100644 --- a/api/@ohos.bundle.defaultAppManager.d.ts +++ b/api/@ohos.bundle.defaultAppManager.d.ts @@ -92,8 +92,8 @@ declare namespace defaultAppManager { * @return return true if caller is default application; return false otherwise. * @permission N/A */ - function isDefaultApplication(type: string) : Promise; - function isDefaultApplication(type: string, callback: AsyncCallback) : void; + function isDefaultApplication(type: string) : Promise; + function isDefaultApplication(type: string, callback: AsyncCallback) : void; /** * get default application based on type. @@ -118,7 +118,6 @@ declare namespace defaultAppManager { * @param type application type or file type. * @param elementName uniquely identifies an ability or extensionAbility. * @param userId indicates the id for the user. - * @return return true if set default application success; return false otherwise. * @permission ohos.permission.SET_DEFAULT_APPLICATION * @systemapi hide this for inner system use. */ @@ -133,7 +132,6 @@ declare namespace defaultAppManager { * @syscap SystemCapability.BundleManager.BundleFramework * @param type application type or file type. * @param userId indicates the id for the user. - * @return return true if reset default application success; return false otherwise. * @permission ohos.permission.SET_DEFAULT_APPLICATION * @systemapi hide this for inner system use. */ -- Gitee