diff --git a/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets b/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets index 2b198a334f664f1988e142d2eaa7a58e026e58b8..3f02184e0daa8de2ae7c011ffa132a6acbb2c4d6 100644 --- a/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets +++ b/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets @@ -1994,12 +1994,12 @@ export class WindowInternal implements Window { private native setWindowDecorHeight(nativeObj: long, height: int): int; private native getWindowProperties(nativeObj: long): WindowProperties; private native getProperties(nativeObj: long): WindowProperties; - private native isWindowSupportWideGamut(nativeObj: long): boolean; + private native isWindowSupportWideGamutNative(nativeObj: long): boolean; private native setWindowLayoutFullScreen(nativeObj: long, isLayoutFullScreen: boolean): int; private native setWindowSystemBarProperties(nativeObj: long, systemBarProperties: SystemBarProperties): int; private native setSpecificSystemBarEnabled(nativeObj: long, name: String, enable: boolean, enableAnimation: boolean): int; - private native snapshot(nativeObj: long): image.PixelMap; - private native hideNonSystemFloatingWindows(nativeObj: long, shouldHide: boolean): void; + private native snapshotNative(nativeObj: long): image.PixelMap; + private native hideNonSystemFloatingWindowsNative(nativeObj: long, shouldHide: boolean): void; private native opacity(nativeObj: long, opacity: double): void; private native scale(nativeObj: long, scaleOptions: ScaleOptions): void; private native translate(nativeObj: long, translateOptions: TranslateOptions): void; @@ -2372,10 +2372,10 @@ export class WindowInternal implements Window { }); } - public isWindowSupportWideGamut(): Promise { + public isWindowSupportWideGamutReturnPromise(): Promise { return new Promise((resolve: (value: boolean) => void, reject: (error: BusinessError) => void) => { taskpool.execute((): boolean => { - let res = this.isWindowSupportWideGamut(this.nativeObj); + let res = this.isWindowSupportWideGamutNative(this.nativeObj); return res; }).then((ret: NullishType) => { resolve(ret as boolean); @@ -2385,9 +2385,9 @@ export class WindowInternal implements Window { }); } - public isWindowSupportWideGamut(callback: AsyncCallback): void { + public isWindowSupportWideGamutWithCallback(callback: AsyncCallback): void { taskpool.execute((): boolean => { - let res = this.isWindowSupportWideGamut(this.nativeObj); + let res = this.isWindowSupportWideGamutNative(this.nativeObj); return res; }).then((ret: NullishType) => { callback(new BusinessError(), ret as boolean); @@ -2396,6 +2396,8 @@ export class WindowInternal implements Window { }); } + overload isWindowSupportWideGamut { isWindowSupportWideGamutReturnPromise, isWindowSupportWideGamutWithCallback }; + public setWindowLayoutFullScreen(isLayoutFullScreen: boolean): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void) :void => { taskpool.execute((): void => { @@ -2456,10 +2458,10 @@ export class WindowInternal implements Window { }); } - public snapshot(): Promise { + public snapshotReturnPromise(): Promise { return new Promise((resolve: (value: image.PixelMap) => void, reject: (error: BusinessError) => void) => { taskpool.execute(() => { - return this.snapshot(this.nativeObj); + return this.snapshotNative(this.nativeObj); }).then((ret: NullishType) => { resolve(ret as image.PixelMap); }).catch((err: NullishType) => { @@ -2468,9 +2470,9 @@ export class WindowInternal implements Window { }); } - public snapshot(callback: AsyncCallback): void { + public snapshotWithCallback(callback: AsyncCallback): void { taskpool.execute(() => { - return this.snapshot(this.nativeObj); + return this.snapshotNative(this.nativeObj); }).then((ret: NullishType) => { callback(new BusinessError(), ret as image.PixelMap); }).catch((err: NullishType) => { @@ -2478,10 +2480,12 @@ export class WindowInternal implements Window { }); } - public hideNonSystemFloatingWindows(shouldHide: boolean): Promise { + overload snapshot { snapshotWithCallback, snapshotReturnPromise }; + + public hideNonSystemFloatingWindowsReturnPromise(shouldHide: boolean): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute(() => { - this.hideNonSystemFloatingWindows(this.nativeObj, shouldHide); + this.hideNonSystemFloatingWindowsNative(this.nativeObj, shouldHide); }).then(() => { resolve(undefined); }).catch((err: NullishType) => { @@ -2490,9 +2494,9 @@ export class WindowInternal implements Window { }); } - public hideNonSystemFloatingWindows(shouldHide: boolean, callback: AsyncCallback): void { + public hideNonSystemFloatingWindowsWithCallback(shouldHide: boolean, callback: AsyncCallback): void { taskpool.execute((): void => { - this.hideNonSystemFloatingWindows(this.nativeObj, shouldHide); + this.hideNonSystemFloatingWindowsNative(this.nativeObj, shouldHide); }).then(() => { callback(new BusinessError(), undefined); }).catch((err: NullishType) => { @@ -2500,7 +2504,12 @@ export class WindowInternal implements Window { }); } - public setWindowColorSpace(colorSpace: ColorSpace): Promise { + overload hideNonSystemFloatingWindows { + hideNonSystemFloatingWindowsWithCallback, + hideNonSystemFloatingWindowsReturnPromise + }; + + public setWindowColorSpaceReturnPromise(colorSpace: ColorSpace): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.setWindowColorSpaceSync(this.nativeObj, colorSpace as int); @@ -2512,7 +2521,7 @@ export class WindowInternal implements Window { }); } - public setWindowColorSpace(colorSpace: ColorSpace, callback: AsyncCallback): void { + public setWindowColorSpaceWithCallback (colorSpace: ColorSpace, callback: AsyncCallback): void { taskpool.execute((): void => { this.setWindowColorSpaceSync(this.nativeObj, colorSpace as int); }).then((ret: NullishType) => { @@ -2522,6 +2531,8 @@ export class WindowInternal implements Window { }); } + overload setWindowColorSpace { setWindowColorSpaceReturnPromise, setWindowColorSpaceWithCallback }; + public setPreferredOrientation(orientation: Orientation): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { @@ -2544,7 +2555,7 @@ export class WindowInternal implements Window { }); } - public setWindowPrivacyMode(isPrivacyMode: boolean): Promise { + public setWindowPrivacyModeReturnPromise(isPrivacyMode: boolean): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.setWindowPrivacyModeSync(this.nativeObj, isPrivacyMode); @@ -2556,7 +2567,7 @@ export class WindowInternal implements Window { }); } - public setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback): void { + public setWindowPrivacyModeWithCallback(isPrivacyMode: boolean, callback: AsyncCallback): void { taskpool.execute((): void => { this.setWindowPrivacyModeSync(this.nativeObj, isPrivacyMode); }).then((ret: NullishType) => { @@ -2566,6 +2577,8 @@ export class WindowInternal implements Window { }); } + overload setWindowPrivacyMode { setWindowPrivacyModeReturnPromise, setWindowPrivacyModeWithCallback }; + public recover(): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { @@ -2638,7 +2651,7 @@ export class WindowInternal implements Window { } } - public setWindowKeepScreenOn(isKeepScreenOn: boolean): Promise { + public setWindowKeepScreenOnReturnPromise (isKeepScreenOn: boolean): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void) :void => { taskpool.execute((): void => { this.setWindowKeepScreenOnSync(this.nativeObj, isKeepScreenOn); @@ -2650,7 +2663,7 @@ export class WindowInternal implements Window { }); } - public setWindowKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback): void { + public setWindowKeepScreenOnWithCallback(isKeepScreenOn: boolean, callback: AsyncCallback): void { taskpool.execute((): void => { this.setWindowKeepScreenOnSync(this.nativeObj, isKeepScreenOn); }).then((ret: NullishType) => { @@ -2660,6 +2673,8 @@ export class WindowInternal implements Window { }); } + overload setWindowKeepScreenOn { setWindowKeepScreenOnWithCallback, setWindowKeepScreenOnReturnPromise }; + public setWindowSystemBarEnable(names: Array<'status' | 'navigation'>): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void) :void => { taskpool.execute((): void => { @@ -2690,7 +2705,7 @@ export class WindowInternal implements Window { return this.getWindowAvoidAreaSync(this.nativeObj, type as AvoidAreaType); } - public setWaterMarkFlag(enable: boolean): Promise { + public setWaterMarkFlagReturnPromise(enable: boolean): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.setWaterMarkFlagSync(this.nativeObj, enable); @@ -2702,7 +2717,7 @@ export class WindowInternal implements Window { }); } - public setWaterMarkFlag(enable: boolean, callback: AsyncCallback): void { + public setWaterMarkFlagWithCallback(enable: boolean, callback: AsyncCallback): void { taskpool.execute((): void => { this.setWaterMarkFlagSync(this.nativeObj, enable); }).then((ret: NullishType) => { @@ -2712,6 +2727,8 @@ export class WindowInternal implements Window { }); } + overload setWaterMarkFlag { setWaterMarkFlagWithCallback, setWaterMarkFlagReturnPromise }; + public setWindowFocusable(isFocusable: boolean): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { @@ -2925,23 +2942,28 @@ export interface Window { getWindowProperties(): WindowProperties; getProperties(): Promise; getProperties(callback: AsyncCallback): void; - isWindowSupportWideGamut(): Promise; - isWindowSupportWideGamut(callback: AsyncCallback): void; + isWindowSupportWideGamutReturnPromise(): Promise; + isWindowSupportWideGamutWithCallback(callback: AsyncCallback): void; + overload isWindowSupportWideGamut { isWindowSupportWideGamutReturnPromise, isWindowSupportWideGamutWithCallback }; setWindowLayoutFullScreen(isLayoutFullScreen: boolean): Promise; setWindowLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback): void; setWindowSystemBarProperties(systemBarProperties: SystemBarProperties): Promise; setWindowSystemBarProperties(systemBarProperties: SystemBarProperties, callback: AsyncCallback): void; setSpecificSystemBarEnabled(name: String, enable: boolean, enableAnimation?: boolean): Promise; - snapshot(): Promise; - snapshot(callback: AsyncCallback): void; - hideNonSystemFloatingWindows(shouldHide: boolean): Promise; - hideNonSystemFloatingWindows(shouldHide: boolean, callback: AsyncCallback): void; - setWindowColorSpace(colorSpace: ColorSpace): Promise; - setWindowColorSpace(colorSpace: ColorSpace, callback: AsyncCallback): void; + snapshotReturnPromise(): Promise; + snapshotWithCallback(callback: AsyncCallback): void; + overload snapshot { snapshotReturnPromise, snapshotWithCallback }; + hideNonSystemFloatingWindowsReturnPromise(shouldHide: boolean): Promise; + hideNonSystemFloatingWindowsWithCallback(shouldHide: boolean, callback: AsyncCallback): void; + overload hideNonSystemFloatingWindows { hideNonSystemFloatingWindowsReturnPromise, hideNonSystemFloatingWindowsWithCallback }; + setWindowColorSpaceReturnPromise(colorSpace: ColorSpace): Promise; + setWindowColorSpaceWithCallback(colorSpace: ColorSpace, callback: AsyncCallback): void; + overload setWindowColorSpace { setWindowColorSpaceReturnPromise, setWindowColorSpaceWithCallback }; setPreferredOrientation(orientation: Orientation): Promise; setPreferredOrientation(orientation: Orientation, callback: AsyncCallback): void; - setWindowPrivacyMode(isPrivacyMode: boolean): Promise; - setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback): void; + setWindowPrivacyModeReturnPromise(isPrivacyMode: boolean): Promise; + setWindowPrivacyModeWithCallback(isPrivacyMode: boolean, callback: AsyncCallback): void; + overload setWindowPrivacyMode { setWindowPrivacyModeReturnPromise, setWindowPrivacyModeWithCallback }; recover(): Promise; setUIContent(path: string): Promise; setUIContent(path: string, callback: AsyncCallback): void; @@ -2949,14 +2971,16 @@ export interface Window { loadContent(path: string, storage: LocalStorage, callback: AsyncCallback): void; loadContent(path: string): Promise; loadContent(path: string, callback: AsyncCallback): void; - setWindowKeepScreenOn(isKeepScreenOn: boolean): Promise; - setWindowKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback): void; + setWindowKeepScreenOnReturnPromise(isKeepScreenOn: boolean): Promise; + setWindowKeepScreenOnWithCallback(isKeepScreenOn: boolean, callback: AsyncCallback): void; + overload setWindowKeepScreenOn { setWindowKeepScreenOnReturnPromise, setWindowKeepScreenOnWithCallback }; setWindowSystemBarEnable(names: Array<'status' | 'navigation'>): Promise; setWindowSystemBarEnable(names: Array<'status' | 'navigation'>, callback: AsyncCallback): void; getUIContext(): UIContext; getWindowAvoidArea(type: AvoidAreaType): AvoidArea; - setWaterMarkFlag(enable: boolean): Promise; - setWaterMarkFlag(enable: boolean, callback: AsyncCallback): void; + setWaterMarkFlagReturnPromise(enable: boolean): Promise; + setWaterMarkFlagWithCallback(enable: boolean, callback: AsyncCallback): void; + overload setWaterMarkFlag { setWaterMarkFlagReturnPromise, setWaterMarkFlagWithCallback }; showWindow(callback: AsyncCallback): void; showWindow(): Promise; destroyWindow(callback: AsyncCallback): void; diff --git a/interfaces/kits/ani/window_runtime/window_stage_ani/src/ani_window.cpp b/interfaces/kits/ani/window_runtime/window_stage_ani/src/ani_window.cpp index f25c9bad0d22a7552577c3dccfa7a13d8387037f..41092ca52b92c7f6b160dd7488d63e087c9f3326 100644 --- a/interfaces/kits/ani/window_runtime/window_stage_ani/src/ani_window.cpp +++ b/interfaces/kits/ani/window_runtime/window_stage_ani/src/ani_window.cpp @@ -2687,7 +2687,7 @@ ani_status OHOS::Rosen::ANI_Window_Constructor(ani_vm *vm, uint32_t *result) reinterpret_cast(WindowGetWindowProperties)}, ani_native_function {"getProperties", "J:L@ohos/window/window/WindowProperties;", reinterpret_cast(WindowGetWindowProperties)}, - ani_native_function {"isWindowSupportWideGamut", "J:Z", + ani_native_function {"isWindowSupportWideGamutNative", "J:Z", reinterpret_cast(WindowIsWindowSupportWideGamut)}, ani_native_function {"setWindowLayoutFullScreen", "JZ:I", reinterpret_cast(WindowSetWindowLayoutFullScreen)}, @@ -2695,9 +2695,9 @@ ani_status OHOS::Rosen::ANI_Window_Constructor(ani_vm *vm, uint32_t *result) reinterpret_cast(WindowSetSystemBarProperties)}, ani_native_function {"setSpecificSystemBarEnabled", "JLstd/core/String;ZZ:I", reinterpret_cast(WindowSetSpecificSystemBarEnabled)}, - ani_native_function {"snapshot", "J:L@ohos/multimedia/image/image/PixelMap;", + ani_native_function {"snapshotNative", "J:L@ohos/multimedia/image/image/PixelMap;", reinterpret_cast(Snapshot)}, - ani_native_function {"hideNonSystemFloatingWindows", "JZ:V", + ani_native_function {"hideNonSystemFloatingWindowsNative", "JZ:V", reinterpret_cast(HideNonSystemFloatingWindows)}, ani_native_function {"setWindowColorSpaceSync", "JI:V", reinterpret_cast(AniWindow::SetWindowColorSpace)},