Build 1.0_r1(from source)

android.os
Class Power

java.lang.Object
  extended by android.os.Power

public class Power
extends Object

Class that provides access to some of the power management functions.


Field Summary
static int ALL_LIGHTS
          Flags to turn on and off all the backlights.
static int BRIGHTNESS_DIM
          Brightness value for dim backlight
static int BRIGHTNESS_LOW_BATTERY
          Brightness value to use when battery is low
static int BRIGHTNESS_OFF
          Brightness value for fully off
static int BRIGHTNESS_ON
          Brightness value for fully on
static int BUTTON_LIGHT
          Flag to turn on and off the button backlight.
static int FULL_WAKE_LOCK
          Wake lock that ensures that the screen is on.
static int KEYBOARD_LIGHT
          Flag to turn on and off the keyboard light.
static int LOW_BATTERY_THRESHOLD
          Threshold for BRIGHTNESS_LOW_BATTERY (percentage) Screen will stay dim if battery level is <=>
static int PARTIAL_WAKE_LOCK
          Wake lock that ensures that the CPU is running.
static int SCREEN_LIGHT
          Flag to turn on and off the screen backlight.
 
Method Summary
static void acquireWakeLock(int lock, String id)
           
static void reboot(String reason)
          Reboot the device.
static void releaseWakeLock(String id)
           
static int setLastUserActivityTimeout(long ms)
           
static int setLightBrightness(int mask, int brightness)
          Set the brightness for one or more lights
static int setScreenState(boolean on)
          Turn the screen on or off
static void shutdown()
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARTIAL_WAKE_LOCK

public static final int PARTIAL_WAKE_LOCK
Wake lock that ensures that the CPU is running. The screen might not be on.

See Also:
Constant Field Values

FULL_WAKE_LOCK

public static final int FULL_WAKE_LOCK
Wake lock that ensures that the screen is on.

See Also:
Constant Field Values

KEYBOARD_LIGHT

public static final int KEYBOARD_LIGHT
Flag to turn on and off the keyboard light.

See Also:
Constant Field Values

SCREEN_LIGHT

public static final int SCREEN_LIGHT
Flag to turn on and off the screen backlight.

See Also:
Constant Field Values

BUTTON_LIGHT

public static final int BUTTON_LIGHT
Flag to turn on and off the button backlight.

See Also:
Constant Field Values

ALL_LIGHTS

public static final int ALL_LIGHTS
Flags to turn on and off all the backlights.

See Also:
Constant Field Values

BRIGHTNESS_OFF

public static final int BRIGHTNESS_OFF
Brightness value for fully off

See Also:
Constant Field Values

BRIGHTNESS_DIM

public static final int BRIGHTNESS_DIM
Brightness value for dim backlight

See Also:
Constant Field Values

BRIGHTNESS_ON

public static final int BRIGHTNESS_ON
Brightness value for fully on

See Also:
Constant Field Values

BRIGHTNESS_LOW_BATTERY

public static final int BRIGHTNESS_LOW_BATTERY
Brightness value to use when battery is low

See Also:
Constant Field Values

LOW_BATTERY_THRESHOLD

public static final int LOW_BATTERY_THRESHOLD
Threshold for BRIGHTNESS_LOW_BATTERY (percentage) Screen will stay dim if battery level is <= low_battery_threshold="">

See Also:
Constant Field Values
Method Detail

acquireWakeLock

public static void acquireWakeLock(int lock,
                                   String id)

releaseWakeLock

public static void releaseWakeLock(String id)

setLightBrightness

public static int setLightBrightness(int mask,
                                     int brightness)
Set the brightness for one or more lights

Parameters:
mask - flags indicating which lights to change brightness
brightness - new brightness value (0 = off, 255 = fully bright)

setScreenState

public static int setScreenState(boolean on)
Turn the screen on or off

Parameters:
on - Whether you want the screen on or off

setLastUserActivityTimeout

public static int setLastUserActivityTimeout(long ms)

shutdown

@Deprecated
public static void shutdown()
Deprecated. 

Turn the device off. This method is considered deprecated in favor of android.policy.ShutdownThread.shutdownAfterDisablingRadio().


reboot

public static void reboot(String reason)
Reboot the device.

Parameters:
reason - code to pass to the kernel (e.g. "recovery"), or null.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature