当前位置: 首页 > news >正文

Android 6.0长按电源键添加重启菜单

  1. 重启图标:frameworks/base/core/res/res/drawable-hdpi/ic_lock_power_reboot_alpha.png
  2. frameworks/base/core/res/res/drawable/ic_lock_power_reboot.xml
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+    android:src="@drawable/ic_lock_power_reboot_alpha"
+    android:tint="?attr/colorControlNormal" />
  1. frameworks/base/core/res/res/values/config.xml
     <string-array translatable="false" name="config_globalActionsList"><item>power</item>
+        <item>reboot</item><!-- mh.mmi add reboot --><item>bugreport</item><item>users</item></string-array>
  1. frameworks/base/core/res/res/values/public.xml
     <public type="string" name="fingerprint_icon_content_description" />
+    <!-- mh.mmi reboot icon -->
+    <public type="drawable" name="ic_lock_power_reboot" id="0x010800b4" />   
  1. frameworks/base/services/core/java/com/android/server/policy/GlobalActions.java
 import java.util.List;+import android.os.IPowerManager;///mh.mmi/*** Helper to show the global actions dialog.  Each item is an {@link Action} that* may show depending on whether the keyguard is showing, and whether the device
@@ -93,6 +95,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac/* Valid settings for global actions keys.* see config.xml config_globalActionList */private static final String GLOBAL_ACTION_KEY_POWER = "power";
+    private static final String GLOBAL_ACTION_KEY_REBOOT = "reboot";///mh.mmiprivate 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)) {///mh.mmi
+                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, DialogInterfacmWindowManagerFuncs.shutdown(false /* confirm */);}}
+       
+    ///mh.mmi start
+    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;
+            }
+        }
+    }
+    ///mh.endprivate Action getBugReportAction() {return new SinglePressAction(com.android.internal.R.drawable.ic_lock_bugreport,
http://www.lryc.cn/news/147382.html

相关文章:

  • Python股票交易---均值回归
  • 机器人制作开源方案 | 桌面级机械臂--本体说明+驱动及控制
  • 有哪些前端调试和测试工具? - 易智编译EaseEditing
  • 【数据结构】手撕单链表
  • 两个git本地如何配置两个ssh密钥for mac
  • iOS逆向进阶:iOS进程间通信方案深入探究与local socket介绍
  • qt day 1
  • 针对java中list.parallelStream()的多线程数据安全问题我们采用什么方法最好呢?
  • 校园用电安全管理系统可以识别违规电器吗
  • 前端(十五)——开源一个用react封装的图片预览组件
  • idea新建Java-maven项目时,出现Dependency ‘ xxx(jar包名)‘ not found的解决方案
  • C# 获取Windows系统版本注意事项
  • STM32设计的宠物投喂器(正点原子mini开发板+2.8寸屏)
  • Python编程——深入了解不可变的元组
  • JVM——类加载与字节码技术—类加载器+运行期优化
  • [linux实战] 华为云耀云服务器L实例 Java、node环境配置
  • python面试:使用cProfile剖析程序性能
  • leetcode-188-买卖股票的最佳时机 IV
  • Grounded Language-Image Pre-training论文笔记
  • 成集云 | 钉钉财务费用单同步至畅捷通 | 解决方案
  • Redis——》死锁
  • URL重定向漏洞
  • JavaScript(函数,作用域和闭包)
  • C# 实现 国密SM4/ECB/PKCS7Padding对称加密解密
  • 【docker-compose】【nginx】动态配置
  • ExpressLRS开源之接收机固件编译烧录步骤
  • 提取视频文件里的音频和无声视频
  • SpringBoot原理
  • MySQL事务原理、MVCC详解
  • 在Windows操作系统上安装Neo4j数据库