reboot mode

reboot mode

—-frameworks/base/core/java/android/view/WindowManagerPolicy.java
—-frameworks/base/core/res/res/drawable-hdpi/zzzzz_ic_lock_reboot.png
—-frameworks/base/core/res/res/drawable-mdpi/zzzzz_ic_lock_reboot.png
—-frameworks/base/core/res/res/drawable-xhdpi/zzzzz_ic_lock_reboot.png
—-frameworks/base/core/res/res/values-es-rUS/strings.xml
—-frameworks/base/core/res/res/values-zh-rCN/strings.xml
—-frameworks/base/core/res/res/values-zh-rHK/strings.xml
—-frameworks/base/core/res/res/values/config.xml
—-frameworks/base/core/res/res/values/strings.xml
—-frameworks/base/core/res/res/values/symbols.xml
—-frameworks/base/services/core/java/com/android/server/policy/GlobalActions.java
—-frameworks/base/services/core/java/com/android/server/power/ShutdownThread.java
—-frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java

------- frameworks/base/core/java/android/view/WindowManagerPolicy.java -------
    index 90b88bd..dce474a 100644
    @@ -447,6 +447,7 @@ public interface WindowManagerPolicy {
             public void switchKeyboardLayout(int deviceId, int direction);

             public void shutdown(boolean confirm);
    +        public void reboot(boolean confirm);
             public void rebootSafeMode(boolean confirm);

             /**

----- frameworks/base/core/res/res/drawable-hdpi/zzzzz_ic_lock_reboot.png -----
    new file mode 100644
    index 0000000..74565b5
    Binary files /dev/null and b/frameworks/base/core/res/res/drawable-hdpi/zzzzz_ic_lock_reboot.png differ


    ----- frameworks/base/core/res/res/drawable-mdpi/zzzzz_ic_lock_reboot.png -----
    new file mode 100644
    index 0000000..74565b5
    Binary files /dev/null and b/frameworks/base/core/res/res/drawable-mdpi/zzzzz_ic_lock_reboot.png differ

    ----- frameworks/base/core/res/res/drawable-xhdpi/zzzzz_ic_lock_reboot.png -----
    new file mode 100644
    index 0000000..d98e77b
    Binary files /dev/null and b/frameworks/base/core/res/res/drawable-xhdpi/zzzzz_ic_lock_reboot.png differ
------------ frameworks/base/core/res/res/values-es-rUS/strings.xml ------------
    index 647b301..5e734ca 100644
    @@ -1516,4 +1516,6 @@
           <item quantity="other"><xliff:g id="COUNT_1">%1$d</xliff:g> elementos seleccionados</item>
           <item quantity="one"><xliff:g id="COUNT_0">%1$d</xliff:g> elemento seleccionado</item>
          </plurals>
    +     <string name="reboot_confirm">Su telefono se va a reiniciar.</string>
    +     <string name="reboot_phone">Reboot</string>   
     </resources>
------------ frameworks/base/core/res/res/values-zh-rCN/strings.xml ------------
    index de51748..b3debe9 100644
    @@ -1516,4 +1516,6 @@
           <item quantity="other">已选择 <xliff:g id="COUNT_1">%1$d</xliff:g></item>
           <item quantity="one">已选择 <xliff:g id="COUNT_0">%1$d</xliff:g></item>
         </plurals>
    +    <string name="reboot_confirm">你的手机即将重新启动</string>
    +    <string name="reboot_phone">重新启动</string>  
     </resources>
------------ frameworks/base/core/res/res/values-zh-rHK/strings.xml ------------
    index ffa6fb1..fd92c0c 100644
    @@ -1516,4 +1516,6 @@
           <item quantity="other">已選取 <xliff:g id="COUNT_1">%1$d</xliff:g> 個項目</item>
           <item quantity="one">已選取 <xliff:g id="COUNT_0">%1$d</xliff:g> 個項目</item>
         </plurals>
    +    <string name="reboot_confirm">你的手机即将重新启动</string>
    +    <string name="reboot_phone">重新启动</string>  
     </resources>
---------------- frameworks/base/core/res/res/values/config.xml ----------------
    index fee16f0..8dc774b 100644
    @@ -2030,6 +2030,7 @@
              -->
         <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/strings.xml ---------------
    index 370db27..7338108 100644
    @@ -4187,4 +4187,6 @@
             <item quantity="one"><xliff:g id="count" example="1">%1$d</xliff:g> selected</item>
             <item quantity="other"><xliff:g id="count" example="3">%1$d</xliff:g> selected</item>
         </plurals>
    +    <string name="reboot_confirm">Your phone will reboot.</string>
    +    <string name="reboot_phone">Reboot</string>      
     </resources>
--------------- frameworks/base/core/res/res/values/symbols.xml ---------------
    index 262aa76..b2d6bd4 100644
    @@ -2319,5 +2319,8 @@
       <java-symbol type="drawable" name="ic_more_items" />

       <java-symbol type="drawable" name="platlogo_m" />
    -
    +  <!-- added by Lee for Global action reboot -->
    +  <java-symbol type="string" name="reboot_phone" />
    +  <java-symbol type="string" name="reboot_confirm" />
    +  <java-symbol type="drawable" name="zzzzz_ic_lock_reboot" />
     </resources>
frameworks/base/services/core/java/com/android/server/policy/GlobalActions.java 
    index 3cee927..7e87b9c 100644
    @@ -101,7 +101,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
         private static final String GLOBAL_ACTION_KEY_LOCKDOWN = "lockdown";
         private static final String GLOBAL_ACTION_KEY_VOICEASSIST = "voiceassist";
         private static final String GLOBAL_ACTION_KEY_ASSIST = "assist";
    -
    +    private static final String GLOBAL_ACTION_KEY_REBOOT = "reboot";
    +   
         private final Context mContext;
         private final WindowManagerFuncs mWindowManagerFuncs;
         private final AudioManager mAudioManager;
    @@ -296,6 +297,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
                     mItems.add(getVoiceAssistAction());
                 } else if (GLOBAL_ACTION_KEY_ASSIST.equals(actionKey)) {
                     mItems.add(getAssistAction());
    +           } else if (GLOBAL_ACTION_KEY_REBOOT.equals(actionKey)) {
    +               mItems.add(getRebootAction());              
                 } else {
                     Log.e(TAG, "Invalid global action key " + actionKey);
                 }
    @@ -445,6 +448,26 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
             };
         }

    +    private Action getRebootAction() {
    +        return new SinglePressAction(
    +                    com.android.internal.R.drawable.zzzzz_ic_lock_reboot,
    +                    R.string.factorytest_reboot) {
    +
    +                public void onPress() {
    +                    mWindowManagerFuncs.reboot(true);
    +                }
    +
    +                public boolean showDuringKeyguard() {
    +                    return true;
    +                }
    +
    +                public boolean showBeforeProvisioning() {
    +                    return true;
    +                }
    +            };
    +    }
    +
    +
         private Action getAssistAction() {
             return new SinglePressAction(com.android.internal.R.drawable.ic_action_assist_focused,
                     R.string.global_action_assist) {
    @@ -1098,7 +1121,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac

         private void onAirplaneModeChanged() {
             // Let the service state callbacks handle the state.
    -        if (mHasTelephony) return;
    +        if (!mHasTelephony) return;

             boolean airplaneModeOn = Settings.Global.getInt(
                     mContext.getContentResolver(),
 frameworks/base/services/core/java/com/android/server/power/ShutdownThread.java 
    index 176e00b..a259dfd 100644
    @@ -223,7 +223,8 @@ public final class ShutdownThread extends Thread {
                     ? com.android.internal.R.string.reboot_safemode_confirm
                     : (longPressBehavior == 2
                          ? com.android.internal.R.string.shutdown_confirm_question
    -                     : com.android.internal.R.string.shutdown_confirm);
    +                     : (mReboot == true ? com.android.internal.R.string.reboot_confirm
    +                     : com.android.internal.R.string.shutdown_confirm));

             Log.d(TAG, "Notifying thread to start shutdown longPressBehavior=" + longPressBehavior);

    @@ -237,7 +238,8 @@ public final class ShutdownThread extends Thread {
                 sConfirmDialog = new AlertDialog.Builder(context)
                     .setTitle(mRebootSafeMode
                             ? com.android.internal.R.string.reboot_safemode_title
    -                       : com.android.internal.R.string.power_off)
    +                       : (mReboot == true ? com.android.internal.R.string.factorytest_reboot
    +                       : com.android.internal.R.string.power_off))
                     .setMessage(resourceId)
                     .setPositiveButton(com.android.internal.R.string.yes,
                             new DialogInterface.OnClickListener() {
 frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java 
    index ecd0d6f..0c9b684 100644
    @@ -5886,6 +5886,12 @@ public class WindowManagerService extends IWindowManager.Stub

         // Called by window manager policy.  Not exposed externally.
         @Override
    +    public void reboot(boolean confirm) {
    +        ShutdownThread.reboot(mContext, null, confirm);
    +    }
    +   
    +    // Called by window manager policy.  Not exposed externally.
    +    @Override
         public void rebootSafeMode(boolean confirm) {
             ShutdownThread.rebootSafeMode(mContext, confirm);
         }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值