- 重启图标:frameworks/base/core/res/res/drawable-hdpi/ic_lock_power_reboot_alpha.png
- frameworks/base/core/res/res/drawable/ic_lock_power_reboot.xml
+<?xml version="1.0" encoding="utf-8"?>
+
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/ic_lock_power_reboot_alpha"
+ android:tint="?attr/colorControlNormal" />
- frameworks/base/core/res/res/values/config.xml
<string-array translatable="false" name="config_globalActionsList">
<item>power</item>
+ <item>reboot</item>
<item>bugreport</item>
<item>users</item>
</string-array>
- frameworks/base/core/res/res/values/public.xml
<public type="string" name="fingerprint_icon_content_description" />
+
+ <public type="drawable" name="ic_lock_power_reboot" id="0x010800b4" />
...
- frameworks/base/services/core/java/com/android/server/policy/GlobalActions.java
import java.util.List;
+import android.os.IPowerManager;
private static final String GLOBAL_ACTION_KEY_POWER = "power";
+ private static final String GLOBAL_ACTION_KEY_REBOOT = "reboot";
private static final String GLOBAL_ACTION_KEY_AIRPLANE = "airplane";
private static final String GLOBAL_ACTION_KEY_BUGREPORT = "bugreport";
private static final String GLOBAL_ACTION_KEY_SILENT = "silent";
@@ -273,6 +276,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
}
if (GLOBAL_ACTION_KEY_POWER.equals(actionKey)) {
mItems.add(new PowerAction());
+ } else if (GLOBAL_ACTION_KEY_REBOOT.equals(actionKey)) {
+ mItems.add(new RebootAction());
} else if (GLOBAL_ACTION_KEY_AIRPLANE.equals(actionKey)) {
mItems.add(mAirplaneModeOn);
} else if (GLOBAL_ACTION_KEY_BUGREPORT.equals(actionKey)) {
@@ -366,6 +371,37 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
mWindowManagerFuncs.shutdown(false );
}
}
+
+
+ private final class RebootAction extends SinglePressAction {
+
+ private RebootAction() {
+ super(com.android.internal.R.drawable.ic_lock_power_reboot, R.string.factorytest_reboot);
+ }
+
+ @Override
+ public boolean showDuringKeyguard() {
+ return true;
+ }
+
+ @Override
+ public boolean showBeforeProvisioning() {
+ return true;
+ }
+
+ @Override
+ public void onPress() {
+ try {
+ IPowerManager pm = IPowerManager.Stub.asInterface(ServiceManager.getService(Context.POWER_SERVICE));
+ pm.reboot(true, null, false);
+ }
+ catch (RemoteException e) {
+ Log.e(TAG, "PowerManager service died!", e);
+ return;
+ }
+ }
+ }
+
private Action getBugReportAction() {
return new SinglePressAction(com.android.internal.R.drawable.ic_lock_bugreport,