diff --git a/api/@ohos.screen.d.ts b/api/@ohos.screen.d.ts index 606ab803d..cb4b19251 100644 --- a/api/@ohos.screen.d.ts +++ b/api/@ohos.screen.d.ts @@ -83,6 +83,21 @@ declare namespace screen { function setVirtualScreenSurface(screenId:number, surfaceId: string, callback: AsyncCallback): void; function setVirtualScreenSurface(screenId:number, surfaceId: string): Promise; + /** + * Get screen rotation lock status. + * @since 9 + */ + function isScreenRotationLocked(callback: AsyncCallback): void; + function isScreenRotationLocked(): Promise; + + /** + * Set screen rotation lock status. + * @param isLocked Indicates whether the screen rotation switch is locked. + * @since 9 + */ + function setScreenRotationLocked(isLocked:boolean, callback: AsyncCallback): void; + function setScreenRotationLocked(isLocked:boolean): Promise; + /** * the parameter of making expand screen * @syscap SystemCapability.WindowManager.WindowManager.Core diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 659499edb..da97685ea 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -567,6 +567,26 @@ declare namespace window { */ function off(type: 'systemBarTintChange', callback?: Callback): void; + /** + * display orientation + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + enum Orientation { + UNSPECIFIED = 0, + PORTRAIT = 1, + LANDSCAPE = 2, + PORTRAIT_INVERTED = 3, + LANDSCAPE_INVERTED = 4, + AUTO_ROTATION = 5, + AUTO_ROTATION_PORTRAIT = 6, + AUTO_ROTATION_LANDSCAPE = 7, + AUTO_ROTATION_RESTRICTED = 8, + AUTO_ROTATION_PORTRAIT_RESTRICTED = 9, + AUTO_ROTATION_LANDSCAPE_RESTRICTED = 10, + LOCKED = 11, + } + interface Window { /** * hide window. @@ -752,6 +772,22 @@ declare namespace window { */ setSystemBarProperties(systemBarProperties: SystemBarProperties): Promise; + /** + * Set the requested orientation config of the window + * @param orientation the orientation config of the window + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + setRequestedOrientation(orientation: Orientation): Promise; + + /** + * Set the requested orientation config of the window + * @param orientation the orientation config of the window + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + setRequestedOrientation(orientation: Orientation, callback: AsyncCallback): void; + /** * Loads content * @param path path Path of the page to which the content will be loaded