目录

DeviceTelevisionManager

Class Info

public class DeviceTelevisionManager

智慧屏相关管理类。

Public Method Summary

Qualifier and Type

Method Name and Description

boolean

setScreenCastGrabDisabled(ComponentName admin, boolean isDisabled)

禁用/启用投屏抢占。

boolean

isScreenCastGrabDisabled(ComponentName admin)

查询投屏抢占是否被禁用。

boolean

setScreenSaverDisabled(ComponentName admin, boolean isDisabled)

禁用/启用智慧屏屏保。

boolean

isScreenSaverDisabled(ComponentName admin)

查询智慧屏屏保是否被禁用。

boolean

setAppCenterIconHidden(ComponentName admin, boolean isHidden)

隐藏/显示全部应用图标。

boolean

isAppCenterIconHidden(ComponentName admin)

查询全部应用图标是否被隐藏。

boolean

setShortcutMenuDisabled(ComponentName admin, boolean isDisabled)

禁用/启用快捷方式编辑。

boolean

isShortcutMenuDisabled(ComponentName admin)

查询快捷方式编辑是否被禁用。

Public Methods

[h2]setScreenCastGrabDisabled

Supported Devices

Device Type

OS Version

智慧屏

HarmonyOS 2.0及以上

Method

public boolean setScreenCastGrabDisabled(ComponentName admin, boolean isDisabled)

禁用/启用投屏抢占。

注意:需要申请com.huawei.permission.sec.MDM_DEVICE_MANAGER权限。

Parameters

Name

Description

admin

调用该接口的组件名称,不能为null。

isDisabled

  • true:禁用投屏抢占。
  • false:启用投屏抢占。

Return

Type

Description

boolean

  • true:配置成功。
  • false:配置失败。

Throws

Name

Description

SecurityException

  • 此APK未经设备管理激活。
  • 无com.huawei.permission.sec.MDM_DEVICE_MANAGER权限。

IllegalArgumentException

参数admin为null。

[h2]isScreenCastGrabDisabled

Supported Devices

Device Type

OS Version

智慧屏

HarmonyOS 2.0及以上

Method

public boolean isScreenCastGrabDisabled(ComponentName admin)

查询投屏抢占是否被禁用。

Parameters

Name

Description

admin

调用该接口的组件名称。为null时,获取的是全局综合策略结果。

Return

Type

Description

boolean

  • true:投屏抢占已经被禁用。
  • false:投屏抢占尚未被禁用。

[h2]setScreenSaverDisabled

Supported Devices

Device Type

OS Version

智慧屏

HarmonyOS 3.1及以上

Method

public boolean setScreenSaverDisabled(ComponentName admin, boolean isDisabled)

禁用/启用智慧屏屏保。

注意:需要申请com.huawei.permission.sec.MDM_DEVICE_MANAGER权限。

Parameters

Name

Description

admin

调用该接口的组件名称,不能为null。

isDisabled

  • true:禁用智慧屏屏保。
  • false:启用智慧屏屏保。

Return

Type

Description

boolean

  • true:配置成功。
  • false:配置失败。

Throws

Name

Description

SecurityException

  • 此APK未经设备管理激活。
  • 无com.huawei.permission.sec.MDM_DEVICE_MANAGER权限。

IllegalArgumentException

参数admin为null。

[h2]isScreenSaverDisabled

Supported Devices

Device Type

OS Version

智慧屏

HarmonyOS 3.1及以上

Method

public boolean isScreenSaverDisabled(ComponentName admin)

查询智慧屏屏保是否被禁用。

Parameters

Name

Description

admin

调用该接口的组件名称。为null时,获取的是全局综合策略结果。

Return

Type

Description

boolean

  • true:智慧屏屏保被禁用。
  • false:智慧屏屏保未被禁用。

Throws

Name

Description

SecurityException

  • 指定的admin未激活。
  • 参数admin非法。

[h2]setAppCenterIconHidden

Supported Devices

Device Type

OS Version

智慧屏

HarmonyOS 3.1及以上

Method

public boolean setAppCenterIconHidden(ComponentName admin, boolean isHidden)

隐藏/显示全部应用图标。

注意:需要申请com.huawei.permission.sec.MDM_APP_MANAGEMENT权限。

Parameters

Name

Description

admin

调用该接口的组件名称,不能为null。

isHidden

  • true:隐藏全部应用图标。
  • false:显示全部应用图标。

Return

Type

Description

boolean

  • true:配置成功。
  • false:配置失败。

Throws

Name

Description

SecurityException

  • 此APK未经设备管理激活。
  • 无com.huawei.permission.sec.MDM_APP_MANAGEMENT权限。

IllegalArgumentException

参数admin为null。

[h2]isAppCenterIconHidden

Supported Devices

Device Type

OS Version

智慧屏

HarmonyOS 3.1及以上

Method

public boolean isAppCenterIconHidden(ComponentName admin)

查询全部应用图标是否被隐藏。

Parameters

Name

Description

admin

调用该接口的组件名称。为null时,获取的是全局综合策略结果。

Return

Type

Description

boolean

  • true:全部应用图标被隐藏。
  • false:全部应用图标未被隐藏。

Throws

Name

Description

SecurityException

  • 指定的admin未激活。
  • 参数admin非法。

[h2]setShortcutMenuDisabled

Supported Devices

Device Type

OS Version

智慧屏

HarmonyOS 3.1及以上

Method

public boolean setShortcutMenuDisabled(ComponentName admin, boolean isDisabled)

禁用/启用快捷方式编辑。

注意:需要申请com.huawei.permission.sec.MDM_APP_MANAGEMENT权限。

Parameters

Name

Description

admin

调用该接口的组件名称,不能为null。

isDisabled

  • true:禁用快捷方式编辑。
  • false:启用快捷方式编辑。

Return

Type

Description

boolean

  • true:配置成功。
  • false:配置失败。

Throws

Name

Description

SecurityException

  • 此APK未经设备管理激活。
  • 无com.huawei.permission.sec.MDM_APP_MANAGEMENT权限。

IllegalArgumentException

参数admin为null。

[h2]isShortcutMenuDisabled

Supported Devices

Device Type

OS Version

智慧屏

HarmonyOS 3.1及以上

Method

public boolean isShortcutMenuDisabled(ComponentName admin)

查询快捷方式编辑是否被禁用。

Parameters

Name

Description

admin

调用该接口的组件名称。为null时,获取的是全局综合策略结果。

Return

Type

Description

boolean

  • true:快捷方式编辑被禁用。
  • false:快捷方式编辑未被禁用。

Throws

Name

Description

SecurityException

  • 指定的admin未激活。
  • 参数admin非法。