~extension-hackers/globalmenu-extension/3.5

« back to all changes in this revision

Viewing changes to build/mobile/sutagent/android/Power.java

  • Committer: Chris Coulson
  • Date: 2011-08-05 17:37:02 UTC
  • Revision ID: chrisccoulson@ubuntu.com-20110805173702-n11ykbt0tdp5u07q
Refresh build system from FIREFOX_6_0b5_BUILD1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2007 The Android Open Source Project
3
 
 *
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
7
 
 *
8
 
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 
 *
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.
15
 
 */
16
 
 
17
 
package android.os;
18
 
 
19
 
import java.io.IOException;
20
 
 
21
 
/**
22
 
 * Class that provides access to some of the power management functions.
23
 
 *
24
 
 * {@hide}
25
 
 */
26
 
public class Power
27
 
{
28
 
    // can't instantiate this class
29
 
    private Power()
30
 
    {
31
 
    }
32
 
 
33
 
    /**
34
 
     * Wake lock that ensures that the CPU is running.  The screen might
35
 
     * not be on.
36
 
     */
37
 
    public static final int PARTIAL_WAKE_LOCK = 1;
38
 
 
39
 
    /**
40
 
     * Wake lock that ensures that the screen is on.
41
 
     */
42
 
    public static final int FULL_WAKE_LOCK = 2;
43
 
 
44
 
    public static native void acquireWakeLock(int lock, String id);
45
 
    public static native void releaseWakeLock(String id);
46
 
 
47
 
    /**
48
 
     * Brightness value for fully off
49
 
     */
50
 
    public static final int BRIGHTNESS_OFF = 0;
51
 
 
52
 
    /**
53
 
     * Brightness value for dim backlight
54
 
     */
55
 
    public static final int BRIGHTNESS_DIM = 20;
56
 
 
57
 
    /**
58
 
     * Brightness value for fully on
59
 
     */
60
 
    public static final int BRIGHTNESS_ON = 255;
61
 
 
62
 
    /**
63
 
     * Brightness value to use when battery is low
64
 
     */
65
 
    public static final int BRIGHTNESS_LOW_BATTERY = 10;
66
 
 
67
 
    /**
68
 
     * Threshold for BRIGHTNESS_LOW_BATTERY (percentage)
69
 
     * Screen will stay dim if battery level is <= LOW_BATTERY_THRESHOLD
70
 
     */
71
 
    public static final int LOW_BATTERY_THRESHOLD = 10;
72
 
 
73
 
    /**
74
 
     * Turn the screen on or off
75
 
     *
76
 
     * @param on Whether you want the screen on or off
77
 
     */
78
 
    public static native int setScreenState(boolean on);
79
 
 
80
 
    public static native int setLastUserActivityTimeout(long ms);
81
 
 
82
 
    /**
83
 
     * Turn the device off.
84
 
     *
85
 
     * This method is considered deprecated in favor of
86
 
     * {@link android.policy.ShutdownThread.shutdownAfterDisablingRadio()}.
87
 
     *
88
 
     * @deprecated
89
 
     * @hide
90
 
     */
91
 
    @Deprecated
92
 
    public static native void shutdown();
93
 
 
94
 
    /**
95
 
     * Reboot the device.
96
 
     * @param reason code to pass to the kernel (e.g. "recovery"), or null.
97
 
     *
98
 
     * @throws IOException if reboot fails for some reason (eg, lack of
99
 
     *         permission)
100
 
     */
101
 
    public static native void reboot(String reason) throws IOException;
102
 
}