openharmony 鸿蒙 changelogs-device_manager

2023-10-30 浏览 (442)

Device Management Changelog

cl.device_manager.1 API Permission Change

Added permission verification for some APIs.

Change Impact

The apps developed using OpenHarmony 4.0.8.2 or later must have the corresponding permissions. Otherwise, the related APIs cannot be called.

Key API/Component Changes

ModuleClassMethod/Attribute/Enum/ConstantAdded Permission
@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

Adaptation Guide

Apply for the corresponding permissions for your application before these APIs are called.

cl.device_manager.2 Permission Verification for All System APIs

Added permission verification for all system APIs.

Change Impact

Non-system applications and applications without system API permission cannot call system APIs.

Key API/Component Changes

System API permission verification is performed on all APIs. The table below describes the APIs.

API/Enum/VariableTypeSystem API
createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager>): void;interfaceYes
release(): voidinterfaceYes
getTrustedDeviceListSync(): Array<DeviceInfo>interfaceYes
getTrustedDeviceListSync(isRefresh: boolean): Array<DeviceInfo>;interfaceYes
getTrustedDeviceList(callback:AsyncCallback<Array<DeviceInfo>>): voidinterfaceYes
getTrustedDeviceList(): Promise<Array<DeviceInfo>>interfaceYes
getLocalDeviceInfoSync(): DeviceInfointerfaceYes
getLocalDeviceInfo(callback:AsyncCallback<DeviceInfo>): voidinterfaceYes
getLocalDeviceInfo(): Promise<DeviceInfo>interfaceYes
getDeviceInfo(networkId: string, callback:AsyncCallback<DeviceInfo>): voidinterfaceYes
getDeviceInfo(networkId: string): Promise<DeviceInfo>interfaceYes
startDeviceDiscovery(subscribeInfo: SubscribeInfo): voidinterfaceYes
startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): voidinterfaceYes
stopDeviceDiscovery(subscribeId: number): voidinterfaceYes
publishDeviceDiscovery(publishInfo: PublishInfo): voidinterfaceYes
unPublishDeviceDiscovery(publishId: number): voidinterfaceYes
authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback<{deviceId: string, pinToken ?: number}>): voidinterfaceYes
unAuthenticateDevice(deviceInfo: DeviceInfo): voidinterfaceYes
verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string, level: number}>): voidinterfaceYes
setUserOperation(operateAction: number, params: string): voidinterfaceYes
requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback<{registerInfo: string}>): void;interfaceYes
importCredential(credentialInfo: string, callback: AsyncCallback<{resultInfo: string}>): void;interfaceYes
deleteCredential(queryInfo: string, callback: AsyncCallback<{resultInfo: string}>): void;interfaceYes
on(type: 'uiStateChange', callback: Callback<{ param: string}>): void;interfaceYes
off(type: 'uiStateChange', callback?: Callback<{ param: string}>): void;interfaceYes
on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): voidinterfaceYes
off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): voidinterfaceYes
on(type: 'deviceFound', callback: Callback<{ subscribeId: number, device: DeviceInfo }>): voidinterfaceYes
off(type: 'deviceFound', callback?: Callback<{ subscribeId: number, device: DeviceInfo }>): voidinterfaceYes
on(type: 'discoverFail', callback: Callback<{ subscribeId: number, reason: number }>): voidinterfaceYes
off(type: 'discoverFail', callback?: Callback<{ subscribeId: number, reason: number }>): voidinterfaceYes
on(type: 'publishSuccess', callback: Callback<{ publishId: number }>): voidinterfaceYes
off(type: 'publishSuccess', callback?: Callback<{ publishId: number }>): voidinterfaceYes
on(type: 'publishFail', callback: Callback<{ publishId: number, reason: number }>): voidinterfaceYes
off(type: 'publishFail', callback?: Callback<{ publishId: number, reason: number }>): voidinterfaceYes
on(type: 'serviceDie', callback: () => void): voidinterfaceYes
off(type: 'serviceDie', callback?: () => void): voidinterfaceYes

Adaptation Guide

The caller must be a system application or an application with the system API permission.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkUI Subsystem Changelog

harmony 鸿蒙Distributed Data Management Subsystem Changelog

harmony 鸿蒙Distributed Data Management Subsystem Changelog

harmony 鸿蒙File Subsystem Changelog

harmony 鸿蒙Pan-sensor Subsystem Changelog

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