android电源添加重启项
来源:互联网 发布:小土豆编程系统下载 编辑:程序博客网 时间:2024/05/22 12:10
首先找到按电源弹出的选项的源文件,也就是freamwork/base/policy/src/com/android/internal/policy/impl/GlobalActions.java
再找到private AlertDialog createDialog() 方法,里面有一个mItems的添加选项,在里面加入
//add by xxnan 2012-9-13
new SinglePressAction(
com.android.internal.R.drawable.ic_lock_power_off,
R.string.global_action_reboot) {
public void onPress() {
// reboot
ShutdownThread.reboot(mContext,null,false);
}
public boolean showDuringKeyguard() {
return true; freamwork/base/policy/src/com
}
public boolean showBeforeProvisioning() {
return true;
}
//add by xxnan 2012-9-13
代码即可,添加重启选项,但是R.string.global_action_reboot必须在资源文件下添加,再编译资源文件。。。
在 base/core/res/res/values/string.xml和base/core/res/res/values-zh-rCN/string.xml下添加
<string name="global_action_reboot">reboot</string>
<string name="reboot_progress">rebooting...</string>
然后找到freamwork/base/policy/src/com/android/internal/app/Shutdown.java的private static void beginShutdownSequence(Context context)
方法,将pd.setTitle(context.getText(com.android.internal.R.string.power_off));
pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress));
改为if(mReboot){ // reboot progress
pd.setTitle(context.getText(com.android.internal.R.string.global_action_reboot));
pd.setMessage(context.getText(com.android.internal.R.string.reboot_progress));
}
else
{
pd.setTitle(context.getText(com.android.internal.R.string.power_off));
pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress));
}
然后就是编译了,先编译源码下的framework/base/core/res
再编译base,最后编译policy(按顺序,不然会报错)
最后将编译好的out下的system/framework/framework.jar和framework-res.apk和android.policy.jar替换你机器里system/framework的三个文件,重启,ok完成了,感兴趣的人
赶紧试一下吧。。。。(好像android硬件不支持重启,所以只能关机之后并不能重启)。
- android电源添加重启项
- android电源添加重启项
- 为android电源键添加重启项
- 为android电源键添加重启项
- 为Android电源键添加重启项
- android 添加按电源键结束通话
- android 添加按电源键结束通话
- Android 添加按电源键结束通话
- Android 5.1长按电源键添加重启功能
- Android 5.1长按电源键添加重启功能
- android电源
- android电源
- 长按电源键,为Android手机添加自动重启Item
- 长按电源键,为Android手机添加自动重启Item
- 长按电源键,为Android手机添加自动重启Item
- Android电源管理
- android电源管理
- Android 的电源管理
- Android开发心得-横竖屏切换数据丢失
- (C#事务)
- android长按返回键弹出关机框
- 快速排序
- Nginx--负载均衡在项目中的应用
- android电源添加重启项
- DMA讲解《一》(清华大学)
- android模拟器如何支持sd卡
- Android横竖屏切换正确实现方式
- sqlite 中文解决方案
- bash中的引号
- 简单Struts2实例(入门级)
- dhcp,ip source guard,arp detection,acl
- 阿里云centos云主机运维问题汇总