2
* Copyright (C) 2007 The Android Open Source Project
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
19
import java.io.IOException;
22
* Class that provides access to some of the power management functions.
28
// can't instantiate this class
34
* Wake lock that ensures that the CPU is running. The screen might
37
public static final int PARTIAL_WAKE_LOCK = 1;
40
* Wake lock that ensures that the screen is on.
42
public static final int FULL_WAKE_LOCK = 2;
44
public static native void acquireWakeLock(int lock, String id);
45
public static native void releaseWakeLock(String id);
48
* Brightness value for fully off
50
public static final int BRIGHTNESS_OFF = 0;
53
* Brightness value for dim backlight
55
public static final int BRIGHTNESS_DIM = 20;
58
* Brightness value for fully on
60
public static final int BRIGHTNESS_ON = 255;
63
* Brightness value to use when battery is low
65
public static final int BRIGHTNESS_LOW_BATTERY = 10;
68
* Threshold for BRIGHTNESS_LOW_BATTERY (percentage)
69
* Screen will stay dim if battery level is <= LOW_BATTERY_THRESHOLD
71
public static final int LOW_BATTERY_THRESHOLD = 10;
74
* Turn the screen on or off
76
* @param on Whether you want the screen on or off
78
public static native int setScreenState(boolean on);
80
public static native int setLastUserActivityTimeout(long ms);
83
* Turn the device off.
85
* This method is considered deprecated in favor of
86
* {@link android.policy.ShutdownThread.shutdownAfterDisablingRadio()}.
92
public static native void shutdown();
96
* @param reason code to pass to the kernel (e.g. "recovery"), or null.
98
* @throws IOException if reboot fails for some reason (eg, lack of
101
public static native void reboot(String reason) throws IOException;