diff options
| author | Jeff Brown <jeffbrown@google.com> | 2012-05-11 19:32:56 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-05-11 19:32:56 -0700 |
| commit | 58770232216cd735afdfd3dd53151070e06de5ce (patch) | |
| tree | 502d189420768053f373e17e3bb634d0dfd33c8b /core/java/android | |
| parent | dca5fb9e7e193d6aed233e0650691675a56022a3 (diff) | |
| parent | 7304c343821309dd15f769b18f1de2fa43751573 (diff) | |
Merge "Move power HAL interactions to PowerManagerService." into jb-dev
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/os/Power.java | 109 | ||||
| -rw-r--r-- | core/java/android/os/PowerManager.java | 26 | ||||
| -rw-r--r-- | core/java/android/view/WindowManagerPolicy.java | 3 |
3 files changed, 28 insertions, 110 deletions
diff --git a/core/java/android/os/Power.java b/core/java/android/os/Power.java deleted file mode 100644 index 58df940ca6b6..000000000000 --- a/core/java/android/os/Power.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.os; - -import java.io.IOException; -import android.os.ServiceManager; - -/** - * Class that provides access to some of the power management functions. - * - * {@hide} - */ -public class Power -{ - // can't instantiate this class - private Power() - { - } - - /** - * Wake lock that ensures that the CPU is running. The screen might - * not be on. - */ - public static final int PARTIAL_WAKE_LOCK = 1; - - /** - * Wake lock that ensures that the screen is on. - */ - public static final int FULL_WAKE_LOCK = 2; - - public static native void acquireWakeLock(int lock, String id); - public static native void releaseWakeLock(String id); - - /** - * Brightness value for fully off - */ - public static final int BRIGHTNESS_OFF = 0; - - /** - * Brightness value for dim backlight - */ - public static final int BRIGHTNESS_DIM = 20; - - /** - * Brightness value for fully on - */ - public static final int BRIGHTNESS_ON = 255; - - /** - * Brightness value to use when battery is low - */ - public static final int BRIGHTNESS_LOW_BATTERY = 10; - - /** - * Threshold for BRIGHTNESS_LOW_BATTERY (percentage) - * Screen will stay dim if battery level is <= LOW_BATTERY_THRESHOLD - */ - public static final int LOW_BATTERY_THRESHOLD = 10; - - /** - * Turn the screen on or off - * - * @param on Whether you want the screen on or off - */ - public static native int setScreenState(boolean on); - - public static native int setLastUserActivityTimeout(long ms); - - /** - * Low-level function turn the device off immediately, without trying - * to be clean. Most people should use - * {@link android.internal.app.ShutdownThread} for a clean shutdown. - * - * @deprecated - * @hide - */ - @Deprecated - public static native void shutdown(); - - /** - * Reboot the device. - * @param reason code to pass to the kernel (e.g. "recovery"), or null. - * - * @throws IOException if reboot fails for some reason (eg, lack of - * permission) - */ - public static void reboot(String reason) throws IOException - { - rebootNative(reason); - } - - private static native void rebootNative(String reason) throws IOException ; - - public static native int powerInitNative(); -} diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java index 21373ec89715..903c8b3cde12 100644 --- a/core/java/android/os/PowerManager.java +++ b/core/java/android/os/PowerManager.java @@ -197,7 +197,31 @@ public class PowerManager * Does not work with PARTIAL_WAKE_LOCKs. */ public static final int ON_AFTER_RELEASE = 0x20000000; - + + /** + * Brightness value to use when battery is low. + * @hide + */ + public static final int BRIGHTNESS_LOW_BATTERY = 10; + + /** + * Brightness value for fully on. + * @hide + */ + public static final int BRIGHTNESS_ON = 255; + + /** + * Brightness value for dim backlight. + * @hide + */ + public static final int BRIGHTNESS_DIM = 20; + + /** + * Brightness value for fully off. + * @hide + */ + public static final int BRIGHTNESS_OFF = 0; + /** * Class lets you say that you need to have the device on. * <p> diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index 388cfb3f5e87..bc383687125e 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -397,6 +397,9 @@ public interface WindowManagerPolicy { * Creates an input channel that will receive all input from the input dispatcher. */ public InputChannel monitorInput(String name); + + public void shutdown(); + public void rebootSafeMode(); } /** |
