@Implements(value=android.os.PowerManager.class) public class ShadowPowerManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ShadowPowerManager.ShadowWakeLock |
Constructor and Description |
---|
ShadowPowerManager() |
Modifier and Type | Method and Description |
---|---|
static PowerManager.WakeLock |
getLatestWakeLock()
Retrieves the most recent wakelock registered by the application
|
com.google.common.collect.ImmutableList<String> |
getRebootReasons()
Returns the list of reasons for each reboot, in chronological order.
|
int |
getTimesRebooted()
Returns the number of times
reboot(String) was called. |
protected boolean |
isDeviceIdleMode() |
protected boolean |
isIgnoringBatteryOptimizations(String packageName) |
protected boolean |
isInteractive() |
protected boolean |
isPowerSaveMode() |
protected boolean |
isScreenOn() |
protected boolean |
isWakeLockLevelSupported(int level) |
protected PowerManager.WakeLock |
newWakeLock(int flags,
String tag) |
protected void |
reboot(String reason) |
static void |
reset()
Discards the most recent
PowerManager.WakeLock s |
void |
setIgnoringBatteryOptimizations(String packageName,
boolean value) |
void |
setIsDeviceIdleMode(boolean isDeviceIdleMode)
Sets the value returned by
isDeviceIdleMode() . |
void |
setIsInteractive(boolean interactive) |
void |
setIsPowerSaveMode(boolean powerSaveMode) |
void |
setIsScreenOn(boolean screenOn) |
void |
setIsWakeLockLevelSupported(int level,
boolean supported) |
@Implementation protected PowerManager.WakeLock newWakeLock(int flags, String tag)
@Implementation protected boolean isScreenOn()
public void setIsScreenOn(boolean screenOn)
@Implementation(minSdk=21) protected boolean isInteractive()
public void setIsInteractive(boolean interactive)
@Implementation(minSdk=21) protected boolean isPowerSaveMode()
public void setIsPowerSaveMode(boolean powerSaveMode)
@Implementation(minSdk=21) protected boolean isWakeLockLevelSupported(int level)
public void setIsWakeLockLevelSupported(int level, boolean supported)
@Implementation(minSdk=23) protected boolean isDeviceIdleMode()
false
by default, or the value specified via setIsDeviceIdleMode(boolean)
public void setIsDeviceIdleMode(boolean isDeviceIdleMode)
Sets the value returned by isDeviceIdleMode()
.
@Resetter public static void reset()
Discards the most recent PowerManager.WakeLock
s
public static PowerManager.WakeLock getLatestWakeLock()
Retrieves the most recent wakelock registered by the application
@Implementation(minSdk=23) protected boolean isIgnoringBatteryOptimizations(String packageName)
public void setIgnoringBatteryOptimizations(String packageName, boolean value)
@Implementation protected void reboot(String reason)
public int getTimesRebooted()
Returns the number of times reboot(String)
was called.
public com.google.common.collect.ImmutableList<String> getRebootReasons()
Returns the list of reasons for each reboot, in chronological order.