SettingsUtil

public class SettingsUtil
extends Object

java.lang.Object
com.google.android.tradefed.device.SettingsUtil


一个实用程序类,可更改设备的设置。

此类暂时位于 vendor/google 中,因为它依赖于尚未准备好开源的 机制来更改安全设置。一旦有用于更改安全设置的开源安全方法 ,此类将迁移到核心 Tradefed 项目

摘要

公共构造函数

SettingsUtil(ITestDevice device)

SettingsUtil 的默认构造函数 - 提供配置设备端设置的功能。

SettingsUtil(ITestDevice device, File settingApk)

此构造函数允许替换用于配置设备设置的默认 apk。

公共方法

void changeGlobalSetting(String name, String value)

更改设备上的全局设置

void changeGooglePartnerSetting(String name, String value)

更改设备上的 Google 合作伙伴设置

void changeSecureSetting(String name, String value)

更改设备上的安全设置

void changeSetting(String name, String value)

更改设备上的设置

void installSettingCmdApk()

在设备上安装设置命令 apk。

void overrideGServices(String name, String value)

替换设备上的 gservices 值。

void uninstallSettingCmd()

从设备中卸载设置命令 apk。

公共构造函数

SettingsUtil

public SettingsUtil (ITestDevice device)

SettingsUtil 的默认构造函数 - 提供配置设备端设置的功能。默认 apk 用于配置设备设置,并将根据设备的 build 签名进行选择。

参数
device ITestDevice:被测设备

抛出
com.android.tradefed.device.DeviceNotAvailableException
com.android.tradefed.targetprep.TargetSetupError
DeviceNotAvailableException
TargetSetupError

SettingsUtil

public SettingsUtil (ITestDevice device, 
                File settingApk)

此构造函数允许替换用于配置设备设置的默认 apk。

参数
device ITestDevice:被测设备

settingApk File:引用存储 SettingCmd.apk 的路径的文件对象。如果为 null, 则使用默认 apk,该 apk 根据设备的 build 签名进行选择。

抛出
com.android.tradefed.device.DeviceNotAvailableException
com.android.tradefed.targetprep.TargetSetupError
DeviceNotAvailableException
TargetSetupError

公共方法

changeGlobalSetting

public void changeGlobalSetting (String name, 
                String value)

更改设备上的全局设置

抛出
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

changeGooglePartnerSetting

public void changeGooglePartnerSetting (String name, 
                String value)

更改设备上的 Google 合作伙伴设置

抛出
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

changeSecureSetting

public void changeSecureSetting (String name, 
                String value)

更改设备上的安全设置

抛出
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

changeSetting

public void changeSetting (String name, 
                String value)

更改设备上的设置

抛出
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

installSettingCmdApk

public void installSettingCmdApk ()

在设备上安装设置命令 apk。必须在进行任何更改设置调用之前 执行。

抛出
DeviceNotAvailableException
TargetSetupError

overrideGServices

public void overrideGServices (String name, 
                String value)

替换设备上的 gservices 值。

请注意,此操作是异步的:无法保证此方法返回时 gservices 值已设置 。

抛出
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

uninstallSettingCmd

public void uninstallSettingCmd ()

从设备中卸载设置命令 apk。

抛出
DeviceNotAvailableException