openharmony 鸿蒙 changelogs-device_manager

2023-06-24 浏览 (583)

设备管理ChangeLog

cl.device_manager.1 接口权限变更

从Openharmony 4.0.8.2版本开始,部分接口新增权限校验。

变更影响

从Openharmony 4.0.8.2之后版本开发的应用,需要持有相应权限,否则无法正常调用接口。

关键的接口/组件变更

模块名类名方法/属性/枚举/常量新增权限
@ohos.distributedHardware.deviceManagerdeviceManagerfunction release(): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction getTrustedDeviceListSync(): Array<DeviceInfo>ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction getTrustedDeviceListSync(isRefresh: boolean): Array<DeviceInfo>;ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction getTrustedDeviceList(callback:AsyncCallback<Array<DeviceInfo>>): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction getTrustedDeviceList(): Promise<Array<DeviceInfo>>ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction getLocalDeviceInfoSync(): DeviceInfoohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction getLocalDeviceInfo(callback:AsyncCallback<DeviceInfo>): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction getLocalDeviceInfo(): Promise<DeviceInfo>ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction getDeviceInfo(networkId: string, callback:AsyncCallback<DeviceInfo>): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction getDeviceInfo(networkId: string): Promise<DeviceInfo>ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction startDeviceDiscovery(subscribeInfo: SubscribeInfo): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction stopDeviceDiscovery(subscribeId: number): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction publishDeviceDiscovery(publishInfo: PublishInfo): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction unPublishDeviceDiscovery(publishId: number): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback<{deviceId: string, pinToken ?: number}>): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction unAuthenticateDevice(deviceInfo: DeviceInfo): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string, level: number}>): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction setUserOperation(operateAction: number, params: string): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback<{registerInfo: string}>): void;ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction importCredential(credentialInfo: string, callback: AsyncCallback<{resultInfo: string}>): void;ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction deleteCredential(queryInfo: string, callback: AsyncCallback<{resultInfo: string}>): void;ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction on(type: 'uiStateChange', callback: Callback<{ param: string}>): void;ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction off(type: 'uiStateChange', callback?: Callback<{ param: string}>): void;ohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction on(type: 'deviceFound', callback: Callback<{ subscribeId: number, device: DeviceInfo }>): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction off(type: 'deviceFound', callback?: Callback<{ subscribeId: number, device: DeviceInfo }>): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction on(type: 'discoverFail', callback: Callback<{ subscribeId: number, reason: number }>): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction off(type: 'discoverFail', callback?: Callback<{ subscribeId: number, reason: number }>): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction on(type: 'publishSuccess', callback: Callback<{ publishId: number }>): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction off(type: 'publishSuccess', callback?: Callback<{ publishId: number }>): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction on(type: 'publishFail', callback: Callback<{ publishId: number, reason: number }>): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction off(type: 'publishFail', callback?: Callback<{ publishId: number, reason: number }>): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction on(type: 'serviceDie', callback: () => void): voidohos.permission.ACCESS_SERVICE_DM
@ohos.distributedHardware.deviceManagerdeviceManagerfunction off(type: 'serviceDie', callback?: () => void): voidohos.permission.ACCESS_SERVICE_DM

适配指导

调用以上接口,需要申请相应的权限才能正常调用。

cl.device_manager.2 所有接口进行系统接口权限校验

从Openharmony 4.0.8.2版本开始,所有接口进行系统接口权限校验。

变更影响

非系统应用无法调用系统接口,如调用方为非系统应用或未申请SystemApi相关权限,将无法调用接口。

关键的接口/组件变更

所有接口均进行系统接口权限校验,接口明细如下:

接口、枚举或变量名类型是否为SystemApi
createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager>): void;interface
release(): voidinterface
getTrustedDeviceListSync(): Array<DeviceInfo>interface
getTrustedDeviceListSync(isRefresh: boolean): Array<DeviceInfo>;interface
getTrustedDeviceList(callback:AsyncCallback<Array<DeviceInfo>>): voidinterface
getTrustedDeviceList(): Promise<Array<DeviceInfo>>interface
getLocalDeviceInfoSync(): DeviceInfointerface
getLocalDeviceInfo(callback:AsyncCallback<DeviceInfo>): voidinterface
getLocalDeviceInfo(): Promise<DeviceInfo>interface
getDeviceInfo(networkId: string, callback:AsyncCallback<DeviceInfo>): voidinterface
getDeviceInfo(networkId: string): Promise<DeviceInfo>interface
startDeviceDiscovery(subscribeInfo: SubscribeInfo): voidinterface
startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): voidinterface
stopDeviceDiscovery(subscribeId: number): voidinterface
publishDeviceDiscovery(publishInfo: PublishInfo): voidinterface
unPublishDeviceDiscovery(publishId: number): voidinterface
authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback<{deviceId: string, pinToken ?: number}>): voidinterface
unAuthenticateDevice(deviceInfo: DeviceInfo): voidinterface
verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string, level: number}>): voidinterface
setUserOperation(operateAction: number, params: string): voidinterface
requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback<{registerInfo: string}>): void;interface
importCredential(credentialInfo: string, callback: AsyncCallback<{resultInfo: string}>): void;interface
deleteCredential(queryInfo: string, callback: AsyncCallback<{resultInfo: string}>): void;interface
on(type: 'uiStateChange', callback: Callback<{ param: string}>): void;interface
off(type: 'uiStateChange', callback?: Callback<{ param: string}>): void;interface
on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): voidinterface
off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): voidinterface
on(type: 'deviceFound', callback: Callback<{ subscribeId: number, device: DeviceInfo }>): voidinterface
off(type: 'deviceFound', callback?: Callback<{ subscribeId: number, device: DeviceInfo }>): voidinterface
on(type: 'discoverFail', callback: Callback<{ subscribeId: number, reason: number }>): voidinterface
off(type: 'discoverFail', callback?: Callback<{ subscribeId: number, reason: number }>): voidinterface
on(type: 'publishSuccess', callback: Callback<{ publishId: number }>): voidinterface
off(type: 'publishSuccess', callback?: Callback<{ publishId: number }>): voidinterface
on(type: 'publishFail', callback: Callback<{ publishId: number, reason: number }>): voidinterface
off(type: 'publishFail', callback?: Callback<{ publishId: number, reason: number }>): voidinterface
on(type: 'serviceDie', callback: () => void): voidinterface
off(type: 'serviceDie', callback?: () => void): voidinterface

适配指导

调用以上接口,调用方需要为系统应用或申请SystemApi相关权限。

你可能感兴趣的鸿蒙文章

harmony 鸿蒙arkui子系统ChangeLog

harmony 鸿蒙分布式数据管理子系统ChangeLog

harmony 鸿蒙分布式数据管理子系统ChangeLog

harmony 鸿蒙文件子系统ChangeLog

harmony 鸿蒙泛Sensor子系统Changelog

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