openharmony 鸿蒙 changelogs-device-status

2025-06-12 浏览 (1)

MSDP Subsystem Changelog

c1.device_status.1 Screen Hopping APIs Deprecated

Access Level

System APIs

Reason for Change

Permission control is added for screen hopping APIs. The new APIs incorporate complete functions of the old system APIs and are more standard and atomic with full compliance with community API specifications.

Change Impact

The change is not compatible with earlier versions. You are advised to use new APIs.

Valid Since

OpenHarmony SDK 4.1.5.1

Deprecated APIs

APIDescriptionSubstitute API
function prepare(callback: AsyncCallback<void>): void;cooperate.prepareCooperate is used to prepare for screen hopping.function prepareCooperate(callback: AsyncCallback<void>): void;
function prepare(): Promise<void>;cooperate.prepareCooperate is used to prepare for screen hopping.function prepareCooperate(): Promise<void>;
function unprepare(callback: AsyncCallback<void>): void;cooperate.unprepareCooperate is used to cancel the preparation for screen hopping.function unprepareCooperate(callback: AsyncCallback<void>): void;
function unprepare(): Promise<void>;cooperate.unprepareCooperate is used to cancel the preparation for screen hopping.function unprepareCooperate(): Promise<void>;
function activate(targetNetworkId: string, inputDeviceId: number, callback: AsyncCallback<void>): void;cooperate.activateCooperate is used to start screen hopping.function activateCooperate(targetNetworkId: string, inputDeviceId: number, callback: AsyncCallback<void>): void;
function activate(targetNetworkId: string, inputDeviceId: number): Promise<void>;cooperate.activateCooperate is used to start screen hopping.function activateCooperate(targetNetworkId: string, inputDeviceId: number): Promise<void>;
function deactivate(isUnchained: boolean, callback: AsyncCallback<void>): void;cooperate.deactivateCooperate is used to stop screen hopping.function deactivateCooperate(isUnchained: boolean, callback: AsyncCallback<void>): void;
function deactivate(isUnchained: boolean): Promise<void>;cooperate.deactivateCooperate is used to stop screen hopping.function deactivateCooperate(isUnchained: boolean): Promise<void>;
function getCrossingSwitchState(networkId: string, callback: AsyncCallback<boolean>): void;cooperate.getCooperateSwitchState is used to obtain the screen hopping status of the target device.function getCooperateSwitchState(networkId: string, callback: AsyncCallback<boolean>): void;
function getCrossingSwitchState(networkId: string): Promise<boolean>;cooperate.getCooperateSwitchState is used to obtain the screen hopping status of the target device.function getCooperateSwitchState(networkId: string): Promise<boolean>;
function on(type: 'cooperate', callback: Callback<{ networkId: string, msg: CooperateMsg }>): void;cooperate.on is used to subscribe to screen hopping status change events.function on(type: 'cooperateMessage', callback: Callback<CooperateMessage>): void;
function off(type: 'cooperate', callback?: Callback<void>): void;cooperate.off is used to unsubscribe from screen hopping status change events.function off(type: 'cooperateMessage', callback?: Callback<CooperateMessage>): void;
enum CooperateMsgCooperateMessage is used to define a screen hopping status change event.interface CooperateMessage
COOPERATE_PREPARECooperateState.COOPERATE_PREPARE is used to indicate that the preparation for screen hopping is finished.CooperateState.COOPERATE_PREPARE
COOPERATE_UNPREPARECooperateState.COOPERATE_UNPREPARE is used to indicate that the preparation for screen hopping is canceled.CooperateState.COOPERATE_UNPREPARE
COOPERATE_ACTIVATECooperateState.COOPERATE_ACTIVATE is used to indicate that screen hopping is started.CooperateState.COOPERATE_ACTIVATE
COOPERATE_ACTIVATE_SUCCESSCooperateState.COOPERATE_ACTIVATE_SUCCESS is used to indicate that starting screen hopping is successful.CooperateState.COOPERATE_ACTIVATE_SUCCESS
COOPERATE_ACTIVATE_FAILCooperateState.COOPERATE_ACTIVATE_FAILURE is used to indicate that starting screen hopping has failed.CooperateState.COOPERATE_ACTIVATE_FAILURE
COOPERATE_DEACTIVATE_SUCCESSCooperateState.COOPERATE_DEACTIVATE_SUCCESS is used to indicate that stopping screen hopping is successful.CooperateState.COOPERATE_DEACTIVATE_SUCCESS
COOPERATE_DEACTIVATE_FAILCooperateState.COOPERATE_DEACTIVATE_FAILURE is used to indicate that stopping screen hopping has failed.CooperateState.COOPERATE_DEACTIVATE_FAILURE
COOPERATE_SESSION_DISCONNECTEDCooperateState.COOPERATE_SESSION_DISCONNECTED is used to indicate that the screen hopping session is disconnected.CooperateState.COOPERATE_SESSION_DISCONNECTED

Adaptation Guide

You are advised to use @ohos.cooperate.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkUI Subsystem Changelog

harmony 鸿蒙Multimedia Subsystem Changelog

harmony 鸿蒙USB Subsystem Changelog

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/TjsHXx