Class ShadowPowerManager


  • @Implements(value=android.os.PowerManager.class,
                looseSignatures=true)
    public class ShadowPowerManager
    extends java.lang.Object
    Shadow of PowerManager
    • Constructor Detail

      • ShadowPowerManager

        public ShadowPowerManager()
    • Method Detail

      • newWakeLock

        @Implementation
        protected android.os.PowerManager.WakeLock newWakeLock​(int flags,
                                                               java.lang.String tag)
      • isScreenOn

        @Implementation
        protected boolean isScreenOn()
      • setIsScreenOn

        public void setIsScreenOn​(boolean screenOn)
      • isInteractive

        @Implementation(minSdk=21)
        protected boolean isInteractive()
      • setIsInteractive

        public void setIsInteractive​(boolean interactive)
      • isPowerSaveMode

        @Implementation(minSdk=21)
        protected boolean isPowerSaveMode()
      • setIsPowerSaveMode

        public void setIsPowerSaveMode​(boolean powerSaveMode)
      • isWakeLockLevelSupported

        @Implementation(minSdk=21)
        protected boolean isWakeLockLevelSupported​(int level)
      • setIsWakeLockLevelSupported

        public void setIsWakeLockLevelSupported​(int level,
                                                boolean supported)
      • isDeviceIdleMode

        @Implementation(minSdk=23)
        protected boolean isDeviceIdleMode()
        Returns:
        false by default, or the value specified via setIsDeviceIdleMode(boolean)
      • setIsDeviceIdleMode

        public void setIsDeviceIdleMode​(boolean isDeviceIdleMode)
        Sets the value returned by isDeviceIdleMode().
      • isLightDeviceIdleMode

        @Implementation(minSdk=24)
        protected boolean isLightDeviceIdleMode()
        Returns:
        false by default, or the value specified via setIsLightDeviceIdleMode(boolean)
      • setIsLightDeviceIdleMode

        public void setIsLightDeviceIdleMode​(boolean lightDeviceIdleMode)
        Sets the value returned by isLightDeviceIdleMode().
      • getLocationPowerSaveMode

        @Implementation(minSdk=28)
        protected 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.
      • setLocationPowerSaveMode

        public void setLocationPowerSaveMode​(int locationMode)
        Sets the value returned by getLocationPowerSaveMode() when battery saver is on.
      • getCurrentThermalStatus

        @Implementation(minSdk=29)
        protected int getCurrentThermalStatus()
        This function returns the current thermal status of the device.
      • addThermalStatusListener

        @Implementation(minSdk=29)
        protected void addThermalStatusListener​(java.lang.Object listener)
        This function adds a listener for thermal status change.
      • removeThermalStatusListener

        @Implementation(minSdk=29)
        protected void removeThermalStatusListener​(java.lang.Object listener)
        This function removes a listener for thermal status change.
      • setCurrentThermalStatus

        public void setCurrentThermalStatus​(int thermalStatus)
        Sets the value returned by getCurrentThermalStatus().
      • reset

        @Resetter
        public static void reset()
        Discards the most recent PowerManager.WakeLocks
      • getLatestWakeLock

        public static android.os.PowerManager.WakeLock getLatestWakeLock()
        Retrieves the most recent wakelock registered by the application
        Returns:
        Most recent wake lock.
      • isIgnoringBatteryOptimizations

        @Implementation(minSdk=23)
        protected boolean isIgnoringBatteryOptimizations​(java.lang.String packageName)
      • setIgnoringBatteryOptimizations

        public void setIgnoringBatteryOptimizations​(java.lang.String packageName,
                                                    boolean value)
      • reboot

        @Implementation
        protected void reboot​(java.lang.String reason)
      • getTimesRebooted

        public int getTimesRebooted()
        Returns the number of times reboot(String) was called.
      • getRebootReasons

        public com.google.common.collect.ImmutableList<java.lang.String> getRebootReasons()
        Returns the list of reasons for each reboot, in chronological order.