# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Nested Classes | Constants | Methods | Inherited Methods

# PowerManager

`public final class PowerManager`
`extends Object` ``

java.lang.Object
↳ | android.os.PowerManager

This class gives you control of the power state of the device.

Device battery life will be significantly affected by the use of this API. Do not acquire `WakeLock`s unless you really need them, use the minimum levels possible, and be sure to release them as soon as possible. In most cases, you'll want to use `WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON` instead.

Any application using a WakeLock must request the `android.permission.WAKE_LOCK` permission in an `<uses-permission>` element of the application's manifest.

## Summary

### Nested classes
`interface` | `PowerManager.OnThermalStatusChangedListener` Listener passed to `PowerManager#addThermalStatusListener` and `PowerManager#removeThermalStatusListener` to notify caller of thermal status has changed.
`class` | `PowerManager.WakeLock` A wake lock is a mechanism to indicate that your application needs to have the device stay on.

### Constants
`int` | `ACQUIRE_CAUSES_WAKEUP` Wake lock flag: Turn the screen on when the wake lock is acquired.
`String` | `ACTION_DEVICE_IDLE_MODE_CHANGED` Intent that is broadcast when the state of `isDeviceIdleMode()` changes.
`String` | `ACTION_POWER_SAVE_MODE_CHANGED` Intent that is broadcast when the state of `isPowerSaveMode()` changes.
`int` | `FULL_WAKE_LOCK` This constant is deprecated. Most applications should use `WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON` instead of this type of wake lock, as it will be correctly managed by the platform as the user moves between applications and doesn't require a special permission.
`int` | `LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF` All location providers should be disabled when battery saver is on and the device is non-interactive.
`int` | `LOCATION_MODE_FOREGROUND_ONLY` In this mode, all the location providers will be kept available, but location fixes should only be provided to foreground apps.
`int` | `LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF` In this mode, the GPS based location provider should be disabled when battery saver is on and the device is non-interactive.
`int` | `LOCATION_MODE_NO_CHANGE` Either the location providers shouldn't be affected by battery saver, or battery saver is off.
`int` | `LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF` In this mode, location will not be turned off, but LocationManager will throttle all requests to providers when the device is non-interactive.
`int` | `ON_AFTER_RELEASE` Wake lock flag: When this wake lock is released, poke the user activity timer so the screen stays on for a little longer.
`int` | `PARTIAL_WAKE_LOCK` Wake lock level: Ensures that the CPU is running; the screen and keyboard backlight will be allowed to go off.
`int` | `PROXIMITY_SCREEN_OFF_WAKE_LOCK` Wake lock level: Turns the screen off when the proximity sensor activates.
`int` | `RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY` Flag for `WakeLock#release`: Defer releasing a `PROXIMITY_SCREEN_OFF_WAKE_LOCK` wake lock until the proximity sensor indicates that an object is not in close proximity.
`int` | `SCREEN_BRIGHT_WAKE_LOCK` This constant is deprecated. Most applications should use `WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON` instead of this type of wake lock, as it will be correctly managed by the platform as the user moves between applications and doesn't require a special permission.
`int` | `SCREEN_DIM_WAKE_LOCK` This constant is deprecated. Most applications should use `WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON` instead of this type of wake lock, as it will be correctly managed by the platform as the user moves between applications and doesn't require a special permission.
`int` | `THERMAL_STATUS_CRITICAL` Thermal status code: Platform has done everything to reduce power.
`int` | `THERMAL_STATUS_EMERGENCY` Thermal status code: Key components in platform are shutting down due to thermal condition.
`int` | `THERMAL_STATUS_LIGHT` Thermal status code: Light throttling where UX is not impacted.
`int` | `THERMAL_STATUS_MODERATE` Thermal status code: Moderate throttling where UX is not largely impacted.
`int` | `THERMAL_STATUS_NONE` Thermal status code: Not under throttling.
`int` | `THERMAL_STATUS_SEVERE` Thermal status code: Severe throttling where UX is largely impacted.
`int` | `THERMAL_STATUS_SHUTDOWN` Thermal status code: Need shutdown immediately.

### Public methods
`void` | `addThermalStatusListener(Executor executor, PowerManager.OnThermalStatusChangedListener listener)` This function adds a listener for thermal status change.
`void` | `addThermalStatusListener(PowerManager.OnThermalStatusChangedListener listener)` This function adds a listener for thermal status change, listen call back will be enqueued tasks on the main thread
`int` | `getCurrentThermalStatus()` This function returns the current thermal status of the device.
`int` | `getLocationPowerSaveMode()` Returns how location features should behave when battery saver is on.
`float` | `getThermalHeadroom(int forecastSeconds)` Provides an estimate of how much thermal headroom the device currently has before hitting severe throttling.
`boolean` | `isDeviceIdleMode()` Returns true if the device is currently in idle mode.
`boolean` | `isIgnoringBatteryOptimizations(String packageName)` Return whether the given application package name is on the device's power whitelist.
`boolean` | `isInteractive()` Returns true if the device is in an interactive state.
`boolean` | `isPowerSaveMode()` Returns true if the device is currently in power save mode.
`boolean` | `isRebootingUserspaceSupported()` Returns `true` if this device supports rebooting userspace.
`boolean` | `isScreenOn()` This method is deprecated. Use `isInteractive()` instead.
`boolean` | `isSustainedPerformanceModeSupported()` This function checks if the device has implemented Sustained Performance Mode.
`boolean` | `isWakeLockLevelSupported(int level)` Returns true if the specified wake lock level is supported.
`PowerManager.WakeLock` | `newWakeLock(int levelAndFlags, String tag)` Creates a new wake lock with the specified level and flags.
`void` | `reboot(String reason)` Reboot the device.
`void` | `removeThermalStatusListener(PowerManager.OnThermalStatusChangedListener listener)` This function removes a listener for thermal status change

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Constants

### ACQUIRE_CAUSES_WAKEUP

    public static final int ACQUIRE_CAUSES_WAKEUP

Wake lock flag: Turn the screen on when the wake lock is acquired.

Normally wake locks don't actually wake the device, they just cause the screen to remain on once it's already on. Think of the video player application as the normal behavior. Notifications that pop up and want the device to be on are the exception; use this flag to be like them.

Cannot be used with `PARTIAL_WAKE_LOCK`.

Constant Value: 268435456 (0x10000000)

### ACTION_DEVICE_IDLE_MODE_CHANGED

    public static final String ACTION_DEVICE_IDLE_MODE_CHANGED

Intent that is broadcast when the state of `isDeviceIdleMode()` changes. This broadcast is only sent to registered receivers.

Constant Value: "android.os.action.DEVICE_IDLE_MODE_CHANGED"

### ACTION_POWER_SAVE_MODE_CHANGED

    public static final String ACTION_POWER_SAVE_MODE_CHANGED

Intent that is broadcast when the state of `isPowerSaveMode()` changes. This broadcast is only sent to registered receivers.

Constant Value: "android.os.action.POWER_SAVE_MODE_CHANGED"

### FULL_WAKE_LOCK

    public static final int FULL_WAKE_LOCK

This constant is deprecated.
Most applications should use `WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON` instead of this type of wake lock, as it will be correctly managed by the platform as the user moves between applications and doesn't require a special permission.

Wake lock level: Ensures that the screen and keyboard backlight are on at full brightness.

If the user presses the power button, then the `FULL_WAKE_LOCK` will be implicitly released by the system, causing both the screen and the CPU to be turned off. Contrast with `PARTIAL_WAKE_LOCK`.

Constant Value: 26 (0x0000001a)

### LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF

    public static final int LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF

All location providers should be disabled when battery saver is on and the device is non-interactive.

Constant Value: 2 (0x00000002)

### LOCATION_MODE_FOREGROUND_ONLY

    public static final int LOCATION_MODE_FOREGROUND_ONLY

In this mode, all the location providers will be kept available, but location fixes should only be provided to foreground apps.

Constant Value: 3 (0x00000003)

### LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF

    public static final int LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF

In this mode, the GPS based location provider should be disabled when battery saver is on and the device is non-interactive.

Constant Value: 1 (0x00000001)

### LOCATION_MODE_NO_CHANGE

    public static final int LOCATION_MODE_NO_CHANGE

Either the location providers shouldn't be affected by battery saver, or battery saver is off.

Constant Value: 0 (0x00000000)

### LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF

    public static final int LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF

In this mode, location will not be turned off, but LocationManager will throttle all requests to providers when the device is non-interactive.

Constant Value: 4 (0x00000004)

### ON_AFTER_RELEASE

    public static final int ON_AFTER_RELEASE

Wake lock flag: When this wake lock is released, poke the user activity timer so the screen stays on for a little longer.

Will not turn the screen on if it is not already on. See `ACQUIRE_CAUSES_WAKEUP` if you want that.

Cannot be used with `PARTIAL_WAKE_LOCK`.

Constant Value: 536870912 (0x20000000)

### PARTIAL_WAKE_LOCK

    public static final int PARTIAL_WAKE_LOCK

Wake lock level: Ensures that the CPU is running; the screen and keyboard backlight will be allowed to go off.

If the user presses the power button, then the screen will be turned off but the CPU will be kept on until all partial wake locks have been released.

Constant Value: 1 (0x00000001)

### PROXIMITY_SCREEN_OFF_WAKE_LOCK

    public static final int PROXIMITY_SCREEN_OFF_WAKE_LOCK

Wake lock level: Turns the screen off when the proximity sensor activates.

If the proximity sensor detects that an object is nearby, the screen turns off immediately. Shortly after the object moves away, the screen turns on again.

A proximity wake lock does not prevent the device from falling asleep unlike `FULL_WAKE_LOCK`, `SCREEN_BRIGHT_WAKE_LOCK` and `SCREEN_DIM_WAKE_LOCK`. If there is no user activity and no other wake locks are held, then the device will fall asleep (and lock) as usual. However, the device will not fall asleep while the screen has been turned off by the proximity sensor because it effectively counts as ongoing user activity.

Since not all devices have proximity sensors, use `isWakeLockLevelSupported(int)` to determine whether this wake lock level is supported.

Cannot be used with `ACQUIRE_CAUSES_WAKEUP`.

Constant Value: 32 (0x00000020)

### RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY

    public static final int RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY

Flag for `WakeLock#release`: Defer releasing a `PROXIMITY_SCREEN_OFF_WAKE_LOCK` wake lock until the proximity sensor indicates that an object is not in close proximity.

Constant Value: 1 (0x00000001)

### SCREEN_BRIGHT_WAKE_LOCK

    public static final int SCREEN_BRIGHT_WAKE_LOCK

This constant is deprecated.
Most applications should use `WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON` instead of this type of wake lock, as it will be correctly managed by the platform as the user moves between applications and doesn't require a special permission.

Wake lock level: Ensures that the screen is on at full brightness; the keyboard backlight will be allowed to go off.

If the user presses the power button, then the `SCREEN_BRIGHT_WAKE_LOCK` will be implicitly released by the system, causing both the screen and the CPU to be turned off. Contrast with `PARTIAL_WAKE_LOCK`.

Constant Value: 10 (0x0000000a)

### SCREEN_DIM_WAKE_LOCK

    public static final int SCREEN_DIM_WAKE_LOCK

This constant is deprecated.
Most applications should use `WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON` instead of this type of wake lock, as it will be correctly managed by the platform as the user moves between applications and doesn't require a special permission.

Wake lock level: Ensures that the screen is on (but may be dimmed); the keyboard backlight will be allowed to go off.

If the user presses the power button, then the `SCREEN_DIM_WAKE_LOCK` will be implicitly released by the system, causing both the screen and the CPU to be turned off. Contrast with `PARTIAL_WAKE_LOCK`.

Constant Value: 6 (0x00000006)

### THERMAL_STATUS_CRITICAL

    public static final int THERMAL_STATUS_CRITICAL

Thermal status code: Platform has done everything to reduce power.

Constant Value: 4 (0x00000004)

### THERMAL_STATUS_EMERGENCY

    public static final int THERMAL_STATUS_EMERGENCY

Thermal status code: Key components in platform are shutting down due to thermal condition. Device functionalities will be limited.

Constant Value: 5 (0x00000005)

### THERMAL_STATUS_LIGHT

    public static final int THERMAL_STATUS_LIGHT

Thermal status code: Light throttling where UX is not impacted.

Constant Value: 1 (0x00000001)

### THERMAL_STATUS_MODERATE

    public static final int THERMAL_STATUS_MODERATE

Thermal status code: Moderate throttling where UX is not largely impacted.

Constant Value: 2 (0x00000002)

### THERMAL_STATUS_NONE

    public static final int THERMAL_STATUS_NONE

Thermal status code: Not under throttling.

Constant Value: 0 (0x00000000)

### THERMAL_STATUS_SEVERE

    public static final int THERMAL_STATUS_SEVERE

Thermal status code: Severe throttling where UX is largely impacted.

Constant Value: 3 (0x00000003)

### THERMAL_STATUS_SHUTDOWN

    public static final int THERMAL_STATUS_SHUTDOWN

Thermal status code: Need shutdown immediately.

Constant Value: 6 (0x00000006)

## Public methods

### addThermalStatusListener

    public void addThermalStatusListener (Executor executor,
                    PowerManager.OnThermalStatusChangedListener listener)

This function adds a listener for thermal status change.

Parameters
`executor` | `Executor`: `Executor` to handle listener callback. This value cannot be `null`. Callback and listener events are dispatched through this `Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `Context.getMainExecutor()`. To dispatch events through a shared thread pool, you can use `AsyncTask#THREAD_POOL_EXECUTOR`.
`listener` | `PowerManager.OnThermalStatusChangedListener`: listener to be added. This value cannot be `null`.

### addThermalStatusListener

    public void addThermalStatusListener (PowerManager.OnThermalStatusChangedListener listener)

This function adds a listener for thermal status change, listen call back will be enqueued tasks on the main thread

Parameters
`listener` | `PowerManager.OnThermalStatusChangedListener`: listener to be added, This value cannot be `null`.

### getCurrentThermalStatus

    public int getCurrentThermalStatus ()

This function returns the current thermal status of the device.

Returns
`int` | thermal status as int, `THERMAL_STATUS_NONE` if device in not under thermal throttling. Value is `THERMAL_STATUS_NONE`, `THERMAL_STATUS_LIGHT`, `THERMAL_STATUS_MODERATE`, `THERMAL_STATUS_SEVERE`, `THERMAL_STATUS_CRITICAL`, `THERMAL_STATUS_EMERGENCY`, or `THERMAL_STATUS_SHUTDOWN`

### getLocationPowerSaveMode

    public int getLocationPowerSaveMode ()

Returns how location features should behave when battery saver is on. When battery saver is off, this will always return `LOCATION_MODE_NO_CHANGE`.

This API is normally only useful for components that provide location features.

Returns
`int` | Value is `LOCATION_MODE_NO_CHANGE`, `LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF`, `LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF`, `LOCATION_MODE_FOREGROUND_ONLY`, or `LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF`

See also:

- `isPowerSaveMode()`
- `ACTION_POWER_SAVE_MODE_CHANGED`

### getThermalHeadroom

    public float getThermalHeadroom (int forecastSeconds)

Provides an estimate of how much thermal headroom the device currently has before hitting severe throttling. Note that this only attempts to track the headroom of slow-moving sensors, such as the skin temperature sensor. This means that there is no benefit to calling this function more frequently than about once per second, and attempts to call significantly more frequently may result in the function returning `NaN`.

In addition, in order to be able to provide an accurate forecast, the system does not attempt to forecast until it has multiple temperature samples from which to extrapolate. This should only take a few seconds from the time of the first call, but during this time, no forecasting will occur, and the current headroom will be returned regardless of the value of `forecastSeconds`.

The value returned is a non-negative float that represents how much of the thermal envelope is in use (or is forecasted to be in use). A value of 1.0 indicates that the device is (or will be) throttled at `THERMAL_STATUS_SEVERE`. Such throttling can affect the CPU, GPU, and other subsystems. Values may exceed 1.0, but there is no implied mapping to specific thermal status levels beyond that point. This means that values greater than 1.0 may correspond to `THERMAL_STATUS_SEVERE`, but may also represent heavier throttling.

A value of 0.0 corresponds to a fixed distance from 1.0, but does not correspond to any particular thermal status or temperature. Values on (0.0, 1.0] may be expected to scale linearly with temperature, though temperature changes over time are typically not linear. Negative values will be clamped to 0.0 before returning.

Parameters
`forecastSeconds` | `int`: how many seconds in the future to forecast. Given that device conditions may change at any time, forecasts from further in the future will likely be less accurate than forecasts in the near future. Value is between 0 and 60 inclusive

Returns
`float` | a value greater than or equal to 0.0 where 1.0 indicates the SEVERE throttling threshold, as described above. Returns NaN if the device does not support this functionality or if this function is called significantly faster than once per second.

### isDeviceIdleMode

    public boolean isDeviceIdleMode ()

Returns true if the device is currently in idle mode. This happens when a device has been sitting unused and unmoving for a sufficiently long period of time, so that it decides to go into a lower power-use state. This may involve things like turning off network access to apps. You can monitor for changes to this state with `ACTION_DEVICE_IDLE_MODE_CHANGED`.

Returns
`boolean` | Returns true if currently in active device idle mode, else false. This is when idle mode restrictions are being actively applied; it will return false if the device is in a long-term idle mode but currently running a maintenance window where restrictions have been lifted.

### isIgnoringBatteryOptimizations

    public boolean isIgnoringBatteryOptimizations (String packageName)

Return whether the given application package name is on the device's power whitelist. Apps can be placed on the whitelist through the settings UI invoked by `Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS`.

Parameters
`packageName` | `String`

Returns
`boolean` |

### isInteractive

    public boolean isInteractive ()

Returns true if the device is in an interactive state.

When this method returns true, the device is awake and ready to interact with the user (although this is not a guarantee that the user is actively interacting with the device just this moment). The main screen is usually turned on while in this state. Certain features, such as the proximity sensor, may temporarily turn off the screen while still leaving the device in an interactive state. Note in particular that the device is still considered to be interactive while dreaming (since dreams can be interactive) but not when it is dozing or asleep.

When this method returns false, the device is dozing or asleep and must be awoken before it will become ready to interact with the user again. The main screen is usually turned off while in this state. Certain features, such as "ambient mode" may cause the main screen to remain on (albeit in a low power state) to display system-provided content while the device dozes.

The system will send a `screen on` or `screen off` broadcast whenever the interactive state of the device changes. For historical reasons, the names of these broadcasts refer to the power state of the screen but they are actually sent in response to changes in the overall interactive state of the device, as described by this method.

Services may use the non-interactive state as a hint to conserve power since the user is not present.

Returns
`boolean` | True if the device is in an interactive state.

See also:

- `Intent.ACTION_SCREEN_ON`
- `Intent.ACTION_SCREEN_OFF`

### isPowerSaveMode

    public boolean isPowerSaveMode ()

Returns true if the device is currently in power save mode. When in this mode, applications should reduce their functionality in order to conserve battery as much as possible. You can monitor for changes to this state with `ACTION_POWER_SAVE_MODE_CHANGED`.

Returns
`boolean` | Returns true if currently in low power mode, else false.

### isRebootingUserspaceSupported

    public boolean isRebootingUserspaceSupported ()

Returns `true` if this device supports rebooting userspace.

Returns
`boolean` |

### isScreenOn

    public boolean isScreenOn ()

This method is deprecated.
Use `isInteractive()` instead.

Returns true if the device is in an interactive state.

For historical reasons, the name of this method refers to the power state of the screen but it actually describes the overall interactive state of the device. This method has been replaced by `isInteractive()`.

The value returned by this method only indicates whether the device is in an interactive state which may have nothing to do with the screen being on or off. To determine the actual state of the screen, use `Display.getState()`.

Returns
`boolean` | True if the device is in an interactive state.

### isSustainedPerformanceModeSupported

    public boolean isSustainedPerformanceModeSupported ()

This function checks if the device has implemented Sustained Performance Mode. This needs to be checked only once and is constant for a particular device/release. Sustained Performance Mode is intended to provide a consistent level of performance for prolonged amount of time. Applications should check if the device supports this mode, before using `Window.setSustainedPerformanceMode(boolean)`.

Returns
`boolean` | Returns True if the device supports it, false otherwise.

See also:

- `Window.setSustainedPerformanceMode(boolean)`

### isWakeLockLevelSupported

    public boolean isWakeLockLevelSupported (int level)

Returns true if the specified wake lock level is supported.

Parameters
`level` | `int`: The wake lock level to check.

Returns
`boolean` | True if the specified wake lock level is supported.

### newWakeLock

    public PowerManager.WakeLock newWakeLock (int levelAndFlags,
                    String tag)

Creates a new wake lock with the specified level and flags.

The `levelAndFlags` parameter specifies a wake lock level and optional flags combined using the logical OR operator.

The wake lock levels are: `PARTIAL_WAKE_LOCK`, `FULL_WAKE_LOCK`, `SCREEN_DIM_WAKE_LOCK` and `SCREEN_BRIGHT_WAKE_LOCK`. Exactly one wake lock level must be specified as part of the `levelAndFlags` parameter.

The wake lock flags are: `ACQUIRE_CAUSES_WAKEUP` and `ON_AFTER_RELEASE`. Multiple flags can be combined as part of the `levelAndFlags` parameters.

Call `WakeLock#acquire()` on the object to acquire the wake lock, and `WakeLock#release` when you are done.

    PowerManager pm = (PowerManager)mContext.getSystemService(
                                              Context.POWER_SERVICE);
     PowerManager.WakeLock wl = pm.newWakeLock(
                                          PowerManager.SCREEN_DIM_WAKE_LOCK
                                          | PowerManager.ON_AFTER_RELEASE,
                                          TAG);
     wl.acquire();
     // ... do work...
     wl.release();

Although a wake lock can be created without special permissions, the `Manifest.permission.WAKE_LOCK` permission is required to actually acquire or release the wake lock that is returned.

If using this to keep the screen on, you should strongly consider using `WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON` instead. This window flag will be correctly managed by the platform as the user moves between applications and doesn't require a special permission.

Recommended naming conventions for tags to make debugging easier:

- use a unique prefix delimited by a colon for your app/library (e.g. gmail:mytag) to make it easier to understand where the wake locks comes from. This namespace will also avoid collision for tags inside your app coming from different libraries which will make debugging easier.
- use constants (e.g. do not include timestamps in the tag) to make it easier for tools to aggregate similar wake locks. When collecting debugging data, the platform only monitors a finite number of tags, using constants will help tools to provide better debugging data.
- avoid using Class#getName() or similar method since this class name can be transformed by java optimizer and obfuscator tools.
- avoid wrapping the tag or a prefix to avoid collision with wake lock tags from the platform (e.g. *alarm*).
- never include personnally identifiable information for privacy reasons.

Parameters
`levelAndFlags` | `int`: Combination of wake lock level and flag values defining the requested behavior of the WakeLock.
`tag` | `String`: Your class name (or other tag) for debugging purposes.

Returns
`PowerManager.WakeLock` |

See also:

- `PowerManager.WakeLock.acquire()`
- `PowerManager.WakeLock.release()`
- `PARTIAL_WAKE_LOCK`
- `FULL_WAKE_LOCK`
- `SCREEN_DIM_WAKE_LOCK`
- `SCREEN_BRIGHT_WAKE_LOCK`
- `PROXIMITY_SCREEN_OFF_WAKE_LOCK`
- `ACQUIRE_CAUSES_WAKEUP`
- `ON_AFTER_RELEASE`

### reboot

    public void reboot (String reason)

Reboot the device. Will not return if the reboot is successful.

Requires the `Manifest.permission.REBOOT` permission.

Requires `Manifest.permission.REBOOT`

Parameters
`reason` | `String`: code to pass to the kernel (e.g., "recovery") to request special boot modes, or null. This value may be `null`.

Throws
`UnsupportedOperationException` | if userspace reboot was requested on a device that doesn't support it.

### removeThermalStatusListener

    public void removeThermalStatusListener (PowerManager.OnThermalStatusChangedListener listener)

This function removes a listener for thermal status change

Parameters
`listener` | `PowerManager.OnThermalStatusChangedListener`: listener to be removed This value cannot be `null`.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*