Skip to content

Commit 5877023

Browse files
Jeff BrownAndroid (Google) Code Review
authored andcommitted
Merge "Move power HAL interactions to PowerManagerService." into jb-dev
2 parents dca5fb9 + 7304c34 commit 5877023

File tree

17 files changed

+221
-311
lines changed

17 files changed

+221
-311
lines changed

core/java/android/os/Power.java

Lines changed: 0 additions & 109 deletions
This file was deleted.

core/java/android/os/PowerManager.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,31 @@ public class PowerManager
197197
* Does not work with PARTIAL_WAKE_LOCKs.
198198
*/
199199
public static final int ON_AFTER_RELEASE = 0x20000000;
200-
200+
201+
/**
202+
* Brightness value to use when battery is low.
203+
* @hide
204+
*/
205+
public static final int BRIGHTNESS_LOW_BATTERY = 10;
206+
207+
/**
208+
* Brightness value for fully on.
209+
* @hide
210+
*/
211+
public static final int BRIGHTNESS_ON = 255;
212+
213+
/**
214+
* Brightness value for dim backlight.
215+
* @hide
216+
*/
217+
public static final int BRIGHTNESS_DIM = 20;
218+
219+
/**
220+
* Brightness value for fully off.
221+
* @hide
222+
*/
223+
public static final int BRIGHTNESS_OFF = 0;
224+
201225
/**
202226
* Class lets you say that you need to have the device on.
203227
* <p>

core/java/android/view/WindowManagerPolicy.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,9 @@ public FakeWindow addFakeWindow(Looper looper,
397397
* Creates an input channel that will receive all input from the input dispatcher.
398398
*/
399399
public InputChannel monitorInput(String name);
400+
401+
public void shutdown();
402+
public void rebootSafeMode();
400403
}
401404

402405
/**

core/jni/Android.mk

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ LOCAL_SRC_FILES:= \
6666
android_os_MessageQueue.cpp \
6767
android_os_ParcelFileDescriptor.cpp \
6868
android_os_Parcel.cpp \
69-
android_os_Power.cpp \
7069
android_os_StatFs.cpp \
7170
android_os_SystemClock.cpp \
7271
android_os_SystemProperties.cpp \
@@ -217,8 +216,7 @@ LOCAL_SHARED_LIBRARIES := \
217216
libjpeg \
218217
libusbhost \
219218
libharfbuzz \
220-
libz \
221-
libsuspend \
219+
libz
222220

223221
ifeq ($(USE_OPENGL_RENDERER),true)
224222
LOCAL_SHARED_LIBRARIES += libhwui

core/jni/AndroidRuntime.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ extern int register_android_os_Debug(JNIEnv* env);
133133
extern int register_android_os_MessageQueue(JNIEnv* env);
134134
extern int register_android_os_Parcel(JNIEnv* env);
135135
extern int register_android_os_ParcelFileDescriptor(JNIEnv *env);
136-
extern int register_android_os_Power(JNIEnv *env);
137136
extern int register_android_os_StatFs(JNIEnv *env);
138137
extern int register_android_os_SystemProperties(JNIEnv *env);
139138
extern int register_android_os_SystemClock(JNIEnv* env);
@@ -1147,7 +1146,6 @@ static const RegJNIRec gRegJNI[] = {
11471146
REG_JNI(register_android_os_FileUtils),
11481147
REG_JNI(register_android_os_MessageQueue),
11491148
REG_JNI(register_android_os_ParcelFileDescriptor),
1150-
REG_JNI(register_android_os_Power),
11511149
REG_JNI(register_android_os_StatFs),
11521150
REG_JNI(register_android_os_Trace),
11531151
REG_JNI(register_android_os_UEventObserver),

core/jni/android_os_Power.cpp

Lines changed: 0 additions & 136 deletions
This file was deleted.

packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
public class BrightnessController implements ToggleSlider.Listener {
3232
private static final String TAG = "StatusBar.BrightnessController";
3333

34-
private static final int MINIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_DIM;
35-
private static final int MAXIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_ON;
34+
private static final int MINIMUM_BACKLIGHT = android.os.PowerManager.BRIGHTNESS_DIM;
35+
private static final int MAXIMUM_BACKLIGHT = android.os.PowerManager.BRIGHTNESS_ON;
3636

3737
private Context mContext;
3838
private ToggleSlider mControl;

policy/src/com/android/internal/policy/impl/GlobalActions.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@
1616

1717
package com.android.internal.policy.impl;
1818

19-
import com.android.internal.app.ShutdownThread;
2019
import com.android.internal.telephony.TelephonyIntents;
2120
import com.android.internal.telephony.TelephonyProperties;
2221
import com.android.internal.R;
2322

2423
import android.app.ActivityManagerNative;
2524
import android.app.AlertDialog;
26-
import android.app.admin.DevicePolicyManager;
2725
import android.content.BroadcastReceiver;
2826
import android.content.Context;
2927
import android.content.DialogInterface;
@@ -48,6 +46,7 @@
4846
import android.view.View;
4947
import android.view.ViewGroup;
5048
import android.view.WindowManager;
49+
import android.view.WindowManagerPolicy.WindowManagerFuncs;
5150
import android.widget.AdapterView;
5251
import android.widget.BaseAdapter;
5352
import android.widget.ImageView;
@@ -68,6 +67,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
6867
private static final boolean SHOW_SILENT_TOGGLE = true;
6968

7069
private final Context mContext;
70+
private final WindowManagerFuncs mWindowManagerFuncs;
7171
private final AudioManager mAudioManager;
7272

7373
private ArrayList<Action> mItems;
@@ -88,8 +88,9 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
8888
/**
8989
* @param context everything needs a context :(
9090
*/
91-
public GlobalActions(Context context) {
91+
public GlobalActions(Context context, WindowManagerFuncs windowManagerFuncs) {
9292
mContext = context;
93+
mWindowManagerFuncs = windowManagerFuncs;
9394
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
9495

9596
// receive broadcasts
@@ -186,11 +187,11 @@ public boolean showBeforeProvisioning() {
186187

187188
public void onPress() {
188189
// shutdown by making sure radio and power are handled accordingly.
189-
ShutdownThread.shutdown(mContext, true);
190+
mWindowManagerFuncs.shutdown();
190191
}
191192

192193
public boolean onLongPress() {
193-
ShutdownThread.rebootSafeMode(mContext, true);
194+
mWindowManagerFuncs.rebootSafeMode();
194195
return true;
195196
}
196197

0 commit comments

Comments
 (0)