Context接口切换

FA接口 Stage模型接口对应d.ts文件 Stage对应接口或字段
getOrCreateLocalDir(callback:AsyncCallback<string>):void;
getOrCreateLocalDir():Promise<string>;
Stage模型无对应接口 Stage模型应用在应用根目录下没有操作权限,不提供对应接口
verifyPermission(permission:string,options:PermissionOptions,callback:AsyncCallback<number>):void;
verifyPermission(permission:string,callback:AsyncCallback<number>):void;
verifyPermission(permission:string,options?:PermissionOptions):Promise<number>;
@ohos.abilityAccessCtrl.d.ts verifyAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus;
verifyAccessToken(tokenID: number, permissionName: Permissions): Promise<GrantStatus>;
requestPermissionsFromUser(permissions:Array<string>,requestCode:number,resultCallback:AsyncCallback<PermissionRequestResult>):void;
requestPermissionsFromUser(permissions:Array<string>,requestCode:number):Promise<PermissionRequestResult>;
@ohos.abilityAccessCtrl.d.ts requestPermissionsFromUser(context: Context, permissionList: Array<Permissions>, requestCallback: AsyncCallback<PermissionRequestResult>) : void;
requestPermissionsFromUser(context: Context, permissionList: Array<Permissions>) : Promise<PermissionRequestResult>;
getApplicationInfo(callback:AsyncCallback<ApplicationInfo>):void;
getApplicationInfo():Promise<ApplicationInfo>;
application\Context.d.ts applicationInfo: ApplicationInfo;
getBundleName(callback : AsyncCallback<string>): void;
getBundleName(): Promise<string>;
application\UIAbilityContext.d.ts abilityInfo.bundleName: string;
getDisplayOrientation(callback : AsyncCallback<bundle.DisplayOrientation>): void;
getDisplayOrientation(): Promise<bundle.DisplayOrientation>;
@ohos.screen.d.ts readonly orientation: Orientation;
setDisplayOrientation(orientation:bundle.DisplayOrientation, callback:AsyncCallback<void>):void;
setDisplayOrientation(orientation:bundle.DisplayOrientation):Promise<void>;
@ohos.screen.d.ts setOrientation(orientation: Orientation, callback: AsyncCallback<void>): void;
setOrientation(orientation: Orientation): Promise<void>;
setShowOnLockScreen(show:boolean, callback:AsyncCallback<void>):void;
setShowOnLockScreen(show:boolean):Promise<void>;
@ohos.window.d.ts setShowOnLockScreen(showOnLockScreen: boolean): void;
setWakeUpScreen(wakeUp:boolean, callback:AsyncCallback<void>):void;
setWakeUpScreen(wakeUp:boolean):Promise<void>;
@ohos.window.d.ts setWakeUpScreen(wakeUp: boolean): void;
getProcessInfo(callback:AsyncCallback<ProcessInfo>):void;
getProcessInfo():Promise<ProcessInfo>;
@ohos.app.ability.abilityManager.d.ts getAbilityRunningInfos(callback: AsyncCallback<Array<AbilityRunningInfo>>): void;
getAbilityRunningInfos(): Promise<Array<AbilityRunningInfo>>;
getElementName(callback:AsyncCallback<ElementName>):void;
getElementName():Promise<ElementName>;
application\UIAbilityContext.d.ts abilityInfo.name: string;
abilityInfo.bundleName: string;
getProcessName(callback:AsyncCallback<string>):void;
getProcessName():Promise<string>;
@ohos.app.ability.abilityManager.d.ts getAbilityRunningInfos(callback: AsyncCallback<Array<AbilityRunningInfo>>): void;
getAbilityRunningInfos(): Promise<Array<AbilityRunningInfo>>;
getCallingBundle(callback:AsyncCallback<string>):void;
getCallingBundle():Promise<string>;
Stage模型无对应接口 Stage模型应用可以使用Want.parameters的ohos.aafwk.param.callerUid参数,获取调用方的应用信息
getFilesDir(callback:AsyncCallback<string>):void;
getFilesDir():Promise<string>;
application\Context.d.ts filesDir: string;
getCacheDir(callback:AsyncCallback<string>):void;
getCacheDir():Promise<string>;
application\Context.d.ts cacheDir: string;
getOrCreateDistributedDir(callback:AsyncCallback<string>):void;
getOrCreateDistributedDir():Promise<string>;
application\Context.d.ts distributedFilesDir: string;
getAppType(callback:AsyncCallback<string>):void;
getAppType():Promise<string>;
application\UIAbilityContext.d.ts 通过abilityInfo字段的type属性获取
abilityInfo.type: bundleManager.AbilityType;
getHapModuleInfo(callback:AsyncCallback<HapModuleInfo>):void;
getHapModuleInfo():Promise<HapModuleInfo>;
application\UIAbilityContext.d.ts currentHapModuleInfo: HapModuleInfo;
getAppVersionInfo(callback:AsyncCallback<AppVersionInfo>):void;
getAppVersionInfo():Promise<AppVersionInfo>;
bundle\bundleInfo.d.ts readonly name: string;
readonly versionCode: number;
readonly versionName: string;
getApplicationContext():Context; application\Context.d.ts getApplicationContext(): ApplicationContext;
getAbilityInfo(callback:AsyncCallback<AbilityInfo>):void;
getAbilityInfo():Promise<AbilityInfo>;
application\UIAbilityContext.d.ts abilityInfo: AbilityInfo;
isUpdatingConfigurations(callback:AsyncCallback<boolean>):void;
isUpdatingConfigurations():Promise<boolean>;
Stage模型无对应接口 在系统环境变化时,应用不会重启,调用onConfigurationUpdated接口通知应用,该接口在FA模型是空实现接口,Stage模型不提供对应接口
printDrawnCompleted(callback:AsyncCallback<void>):void;
printDrawnCompleted():Promise<void>;
Stage模型无对应接口 该接口在FA模型是空实现接口,不影响应用功能,Stage模型不提供对应接口