长按power键弹出关机菜单,点击关机会弹出提示框,点击重启没有提示框确认直接进入重启状态,添加确认提示框

--- a/idh.code/frameworks/base/core/res/res/values-es/strings.xml
+++ b/idh.code/frameworks/base/core/res/res/values-es/strings.xml
@@ -1710,5 +1710,5 @@
     <string name="station_state_connected">"Stación %1$s esta conectada"</string>
     <string name="station_state_disconnected">"Stación %1$s esta desconectada"</string>
     <string name="station_state_msg">"%1$s conectada, %2$s bloquada"</string>
-
+    <string name="reboot_confirm" product="default">Usted teléfono voluntad de reiniciar</string>
 </resources>
\ No newline at end of file
diff --git a/idh.code/frameworks/base/core/res/res/values-pt/strings.xml b/idh.code/frameworks/base/core/res/res/values-pt/strings.xml
old mode 100644
new mode 100755
index aab0837..43234b7
--- a/idh.code/frameworks/base/core/res/res/values-pt/strings.xml
+++ b/idh.code/frameworks/base/core/res/res/values-pt/strings.xml
@@ -1736,5 +1736,5 @@
     <string name="station_state_connected">"Estação %1$s é ligada"</string>
     <string name="station_state_disconnected">"Estação %1$s é desligada"</string>
     <string name="station_state_msg">"%1$s ligada, %2$s bloqueada"</string>
-
+               <string name="reboot_confirm" product="default">Você telefone irá reiniciar</string>
 </resources>
\ No newline at end of file
diff --git a/idh.code/frameworks/base/core/res/res/values-zh-rCN/strings.xml b/idh.code/frameworks/base/core/res/res/values-zh-rCN/stri
index 24d8bf9..2f37d7b 100755
--- a/idh.code/frameworks/base/core/res/res/values-zh-rCN/strings.xml
+++ b/idh.code/frameworks/base/core/res/res/values-zh-rCN/strings.xml
@@ -1782,5 +1782,5 @@
     <string name="media_shared_">"目前计算机正在使用 存储设备。"</string>
     <string name="media_unknown_state_">"存储处于未知状态。"</string>
     <!-- @} -->
-
+               <string name="reboot_confirm" product="default">您的手机将会重新启动。</string>
 </resources>
diff --git a/idh.code/frameworks/base/core/res/res/values-zh-rHK/strings.xml b/idh.code/frameworks/base/core/res/res/values-zh-rHK/stri
old mode 100644
new mode 100755
index 268b391..514b21c
--- a/idh.code/frameworks/base/core/res/res/values-zh-rHK/strings.xml
+++ b/idh.code/frameworks/base/core/res/res/values-zh-rHK/strings.xml
@@ -1662,4 +1662,5 @@
   </plurals>
     <string name="restr_pin_try_later" msgid="973144472490532377">"稍後再試"</string>
     <string name="immersive_mode_confirmation" msgid="7227416894979047467">"由頂端往下快速滑動即可離開全螢幕。"</string>
+    <string name="reboot_confirm" product="default">您的手機將會重新啟動。</string>
 </resources>
diff --git a/idh.code/frameworks/base/core/res/res/values-zh-rTW/strings.xml b/idh.code/frameworks/base/core/res/res/values-zh-rTW/stri
old mode 100644
new mode 100755
index 799de85..6d94e52
--- a/idh.code/frameworks/base/core/res/res/values-zh-rTW/strings.xml
+++ b/idh.code/frameworks/base/core/res/res/values-zh-rTW/strings.xml
@@ -1776,5 +1776,5 @@
     <string name="media_shared_">"電腦目前正在使用 儲存裝置。"</string>
     <string name="media_unknown_state_">"儲存裝置狀態不明。"</string>
     <!-- @} -->
-
+               <string name="reboot_confirm" product="default">您的手機將會重新啟動。</string>
 </resources>
diff --git a/idh.code/frameworks/base/core/res/res/values/strings.xml b/idh.code/frameworks/base/core/res/res/values/strings.xml
index 1310e9b..fcb23e1 100755
--- a/idh.code/frameworks/base/core/res/res/values/strings.xml
+++ b/idh.code/frameworks/base/core/res/res/values/strings.xml
@@ -4674,5 +4674,5 @@ ot running any application, the service will also collect such data</string>
     <string name="station_state_disconnected">Station %1$s is disconnected</string>
     <string name="station_state_msg">%1$s connected, %2$s blocked</string>
     <!-- @} -->
-
+               <string name="reboot_confirm" product="default">Your phone will reboot.</string>
 </resources>
diff --git a/idh.code/frameworks/base/core/res/res/values/symbols.xml b/idh.code/frameworks/base/core/res/res/values/symbols.xml
old mode 100644
new mode 100755
index 7cae969..f349b0d
--- a/idh.code/frameworks/base/core/res/res/values/symbols.xml
+++ b/idh.code/frameworks/base/core/res/res/values/symbols.xml
@@ -1833,4 +1833,5 @@
   <!-- SPRD: 293759, modify restart service process -->
   <java-symbol type="integer" name="config_restartServiceInterval" />
   <java-symbol type="integer" name="config_restartAppServiceInterval" />
+  <java-symbol type="string" name="reboot_confirm" />
 </resources>
diff --git a/idh.code/frameworks/base/policy/src/com/android/internal/policy/impl/GlobalActions.java b/idh.code/frameworks/base/policy/
index 1f9e243..a48ca5f 100755
--- a/idh.code/frameworks/base/policy/src/com/android/internal/policy/impl/GlobalActions.java
+++ b/idh.code/frameworks/base/policy/src/com/android/internal/policy/impl/GlobalActions.java
@@ -300,7 +300,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
                     // shutdown by making sure radio and power are handled accordingly.
                     //mWindowManagerFuncs.shutdown(true);
                     //ShutdownThread.reboot(final Context context, String reason, boolean confirm)
-                    mWindowManagerFuncs.reboot(false);
+                    //mWindowManagerFuncs.reboot(false);
+                    mWindowManagerFuncs.reboot(true);//modify by Yang.Liu on 2014-12-02
                 }

                 public boolean onLongPress() {
diff --git a/idh.code/frameworks/base/services/java/com/android/server/power/ShutdownThread.java b/idh.code/frameworks/base/services/ja
old mode 100644
new mode 100755
index fa8a293..455ce79
--- a/idh.code/frameworks/base/services/java/com/android/server/power/ShutdownThread.java
+++ b/idh.code/frameworks/base/services/java/com/android/server/power/ShutdownThread.java
@@ -139,7 +139,9 @@ 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
+                                  ? com.android.internal.R.string.reboot_confirm
+                                  : com.android.internal.R.string.shutdown_confirm));

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

@@ -151,7 +153,9 @@ 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
+                                      ? com.android.internal.R.string.global_action_reboot
+                                      : com.android.internal.R.string.power_off))
                     .setMessage(resourceId)
                     .setPositiveButton(com.android.internal.R.string.yes, new DialogInterface.OnClickListener() {
                         public void onClick(DialogInterface dialog, int which) {

时间: 2024-11-08 04:37:53

长按power键弹出关机菜单,点击关机会弹出提示框,点击重启没有提示框确认直接进入重启状态,添加确认提示框的相关文章

关于一条定制长按Power键弹出Dialog的需求

如题,需要定制长按Power键弹出的Dialog,UI上的大致效果是:全屏,中间下拉按钮“Swipe Down To Power Off”下拉关机,底部左右两侧“Reboot”,“Cancel”按钮,分别是重启,取消操作.并要求弹出Dialog的同时,背景渐变模糊,操作控件有相应动画效果,执行相应操作有同步动画,退出界面背景渐变至透明消失.设计效果酱紫: 具体控件动画要求就不再详述.主要两件事:1.关机流程,更准确的说应该是对长按Power键的处理:2.定制Dialog. 1.长按Power键,

Android Framework层Power键关机流程(一,Power长按键操作处理)

一:Android处理Power按键长按操作 在Framework层中,Android4.x对Power键(KeyEvent.KEYCODE_POWER)的操作,我们从PhoneWindowManager开始分析,在分析前我这里打印了该方法的堆栈调用信息.大家可以参考一下. public long interceptKeyBeforeDispatching(WindowState win, KeyEvent event, int policyFlags) { ...... android.uti

Android5.0 长按电源键关机没有弹确定对话框直接关机

Android5.0 长按电源键关机没有弹确定对话框直接关机,但用户点击了关机选项之后,应该弹一个确定对话框给用户提示是否真的进入关机模式. 首先在frameworks层将对话框的标志位打开. frameworks\base\policy\src\com\android\internal\policy\impl\GlobalActions.java @Override public void onPress() { final boolean quickbootEnabled = Setting

ListView的使用(二)长按弹出上下文菜单

public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list); mDbHelper = new DiaryDbAdapter(this); mDbHelper.open(); renderListView(); ListView mylistView = getListView(); mylistView.setOnCreate

Android Framework层Power键关机流程(二,关机流程)

二,关机流程 从前一篇博文我们知道,当用户长按Power键时会弹出(关机.重新启动,飞行模式等选项)对话框,我们点击关机,则会弹出关机确认对话框.那么从选项对话框到关机确认对话框又是一个什么流程呢.以下我们在简单分析一下: showGlobalActionsDialog()-->showDialog()-->handleShow()-->createDialog()-->onPress()-->shutdown() PhoneWindowManager.java void s

Android 长按电源键关机整个流程小学习

最近研究了一下android关机跟重新启动功能,看了一些长按电源键到弹出关机对话框,到真正关机的一系列处理过程. 首先还是来看看这个长按电源键都干了些什么吧?一般来说,电源键都是接到PMU上的,PMU来判断是长按还短按,当有按键消息产生的时候,系统会有中断,然后去读PMU的状态就可以知道是什么了.笔者以全志平台的AXP209小议一下,先贴上关键代码: static int axp_battery_event(struct notifier_block *nb, unsigned long eve

windows10系统开机后直接弹出开始菜单的解决方案

win10正式版是新版的操作系统,所以用户在使用过程中可能也会碰到一些新的问题.比如,最近有用户反馈,Win10系统开机之后无法显示桌面内容,直接弹出开始菜单,占满了屏幕,而且点击Win键也无法关闭,这是怎么回事呢?其实,该问题是用户不小心进入了Win10系统平板模式导致的.下面,小编就给大家分享下解决方案. 步骤如下: 点击右下角的"通知中心"图标,然后点击"平板模式"即可关闭"平板模式",再次点击的话即可从新进入! 以上就是皇冠新2网址小编给

弹出上下文菜单

弹出上下文菜单 m_Main  m_menu_pop m_menu_pop =create  m_Main integer Px,Py  //设置弹出菜单位置 Px = this.x+ PointerX() Py = this.y +PointerY() m_menu_pop.PopMenu(Px,Py) destroy m_menu_pop return 0 如果在父窗口w_parent右击子窗口w_son后弹出上下文菜单,点击该菜单的 "打开窗口" 选项后弹出另一个窗口w_else

2015.7.29 第十三、十四课 jq实例(磁力图片、轮播图、腾讯课堂菜单、可弹出红色菜单、砸蛋游戏)

1.磁力图片: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <style type="text/cs