@Implements(value=android.os.PowerManager.class) public class ShadowPowerManager extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ShadowPowerManager.ShadowWakeLock |
Constructor and Description |
---|
ShadowPowerManager() |
Modifier and Type | Method and Description |
---|---|
static android.os.PowerManager.WakeLock |
getLatestWakeLock()
Retrieves the most recent wakelock registered by the application
|
com.google.common.collect.ImmutableList<java.lang.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(java.lang.String packageName) |
protected boolean |
isInteractive() |
protected boolean |
isPowerSaveMode() |
protected boolean |
isScreenOn() |
protected boolean |
isWakeLockLevelSupported(int level) |
protected android.os.PowerManager.WakeLock |
newWakeLock(int flags,
java.lang.String tag) |
protected void |
reboot(java.lang.String reason) |
static void |
reset()
Discards the most recent
PowerManager.WakeLock s |
void |
setIgnoringBatteryOptimizations(java.lang.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 android.os.PowerManager.WakeLock newWakeLock(int flags, java.lang.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 android.os.PowerManager.WakeLock getLatestWakeLock()
Retrieves the most recent wakelock registered by the application
@Implementation(minSdk=23) protected boolean isIgnoringBatteryOptimizations(java.lang.String packageName)
public void setIgnoringBatteryOptimizations(java.lang.String packageName, boolean value)
@Implementation protected void reboot(java.lang.String reason)
public int getTimesRebooted()
Returns the number of times reboot(String)
was called.
public com.google.common.collect.ImmutableList<java.lang.String> getRebootReasons()
Returns the list of reasons for each reboot, in chronological order.