DeviceManager
public
class
DeviceManager
extends Object
java.lang.Object | |
↳ | com.google.android.things.device.DeviceManager |
This class provides access to the device management service. Use this class to perform low-level device functions such as reboot and factory reset. Factory reset performs a wipe of all primary application internal storage and restores the device to its initial state following the most recent software update. Apps have the option of additionally erasing shared external storage.
DeviceManager deviceManager = DeviceManager.getInstance();
// Also erase shared external storage
boolean wipeExternal = true;
deviceManager.factoryReset(wipeExternal);
Setting Device Locale
Use theDeviceManager
to control the default set of preferred
locales available on the device.
DeviceManager deviceManager = DeviceManager.getInstance();
LocaleList newlist = new LocaleList();
// ...add to the list...
deviceManager.setSystemLocales(newlist);
Summary
Public methods | |
---|---|
void
|
factoryReset(boolean wipeExternalStorage)
Perform device factory reset. |
static
DeviceManager
|
getInstance()
Returns the |
void
|
reboot()
Perform device reboot with default parameters. |
void
|
setSystemLocales(LocaleList localeList)
Set the list of preferred system locales. |
Inherited methods | |
---|---|
From
class
java.lang.Object
|
Public methods
factoryReset
void factoryReset (boolean wipeExternalStorage)
Perform device factory reset.
Parameters | |
---|---|
wipeExternalStorage |
boolean : Indicates whether external storage should be cleared. |
Throws | |
---|---|
IllegalStateException |
if the underlying system service is not ready. |
RuntimeException |
if the underlying system service encountered an error. |
SecurityException |
if the calling context does not have com.google.android.things.permission.FACTORY_RESET permission |
getInstance
DeviceManager getInstance ()
Returns the DeviceManager
instance for this application.
Returns | |
---|---|
DeviceManager |
The DeviceManager instance. |
reboot
void reboot ()
Perform device reboot with default parameters.
Throws | |
---|---|
IllegalStateException |
if the underlying system service is not ready. |
RuntimeException |
if the underlying system service encountered an error. |
SecurityException |
if the calling context does not have com.google.android.things.permission.REBOOT permission |
setSystemLocales
void setSystemLocales (LocaleList localeList)
Set the list of preferred system locales.
Parameters | |
---|---|
localeList |
LocaleList : the list of preferred system locales. The order the locale appears in this
list determines its priority for being used. |
Throws | |
---|---|
IllegalArgumentException |
if locale list is empty. |
IllegalStateException |
if the underlying system service is not ready. |
RuntimeException |
if the underlying system service encountered an error. |
SecurityException |
if the calling context does not have com.google.android.things.permission.MODIFY_LOCALE permission |
Classes