SettingsUtil

public class SettingsUtil
extends Object

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


A utility class that can change the settings of a device.

This class is temporarily in vendor/google, because it relies on a not-ready-for open source mechanism to change secure settings. Once a open-source safe method for changing secure settings is available, this class will be migrated to the core tradefed project

Summary

Public constructors

SettingsUtil(ITestDevice device)

Default constructor for SettingsUtil - provides ability to configure device-side settings.

SettingsUtil(ITestDevice device, File settingApk)

Constructor that allows overriding the default apk that is used to configure device settings.

Public methods

void changeGlobalSetting(String name, String value)

Change a global setting on device

void changeGooglePartnerSetting(String name, String value)

Change a Google partner setting on device

void changeSecureSetting(String name, String value)

Change a secure setting on device

void changeSetting(String name, String value)

Change a setting on the device

void installSettingCmdApk()

Install the setting cmd apk on device.

void overrideGServices(String name, String value)

Override a gservices value on device.

void uninstallSettingCmd()

Uninstall the setting cmd apk from device.

Public constructors

SettingsUtil

public SettingsUtil (ITestDevice device)

Default constructor for SettingsUtil - provides ability to configure device-side settings. A default apk is used to configure device settings, and will be chosen based on the device's build signature.

Parameters
device ITestDevice: Device under test

Throws
com.android.tradefed.device.DeviceNotAvailableException
com.android.tradefed.targetprep.TargetSetupError
DeviceNotAvailableException
TargetSetupError

SettingsUtil

public SettingsUtil (ITestDevice device, 
                File settingApk)

Constructor that allows overriding the default apk that is used to configure device settings.

Parameters
device ITestDevice: Device under test

settingApk File: File object referring to the path where SettingCmd.apk is stored. If null, uses the default apk, chosen based on the device's build signature.

Throws
com.android.tradefed.device.DeviceNotAvailableException
com.android.tradefed.targetprep.TargetSetupError
DeviceNotAvailableException
TargetSetupError

Public methods

changeGlobalSetting

public void changeGlobalSetting (String name, 
                String value)

Change a global setting on device

Throws
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

changeGooglePartnerSetting

public void changeGooglePartnerSetting (String name, 
                String value)

Change a Google partner setting on device

Throws
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

changeSecureSetting

public void changeSecureSetting (String name, 
                String value)

Change a secure setting on device

Throws
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

changeSetting

public void changeSetting (String name, 
                String value)

Change a setting on the device

Throws
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

installSettingCmdApk

public void installSettingCmdApk ()

Install the setting cmd apk on device. Must be executed before any change setting calls are made.

Throws
DeviceNotAvailableException
TargetSetupError

overrideGServices

public void overrideGServices (String name, 
                String value)

Override a gservices value on device.

Note this operation is asynchronous: there is no guarantee that the gservices value is set when this method returns.

Throws
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

uninstallSettingCmd

public void uninstallSettingCmd ()

Uninstall the setting cmd apk from device.

Throws
DeviceNotAvailableException