1.长按powe on 键列表添加重新启动
android\frameworks\base\policy\src\com\android\internal\policy\impl\GlobalActions.java
mItems = Lists.newArrayList(
// silent mode
mSilentModeToggle,
// next: airplane mode
mAirplaneModeOn,
// last: power off
new SinglePressAction(
com.android.internal.R.drawable.ic_lock_power_off,
R.string.global_action_power_off) {
public void onPress() {
// shutdown by making sure radio and power are handled accordingly.
ShutdownThread.shutdown(mContext, true);
//LGE_DEV_PORTING UNIVA_S jonghyuck.shin@lge.com - can't create LowBattery Popup while power-off
Intent shutdownIntent = new Intent(Intent.ACTION_START_SHUTDOWN);
mContext.sendBroadcast(shutdownIntent);
//LGE_DEV_PORTING UNIVA_E
}
public boolean showDuringKeyguard() {
return true;
}
public boolean showBeforeProvisioning() {
return true;
}
},
//haifeng.gong 20120328 add Reboot[START]
new SinglePressAction(
com.android.internal.R.drawable.ic_lock_restart,
R.string.global_action_power_restart) {
public void onPress() {
// Reboot by making sure radio and power are handled accordingly.
ShutdownThread.reboot(mContext, "",true);
}
public boolean showDuringKeyguard() {
return true;
}
public boolean showBeforeProvisioning() {
return true;
}
}
//haifeng.gong 20120328 add Reboot[END]
);
添加values/string ---global_action_power_restart (android\frameworks\base\core\res\res\values)
<!--haifeng.gong 20120328 add Reboot[START]-->
<string name="global_action_power_restart">Restart</string>
<!--haifeng.gong 20120328 add Reboot[END]-->
以及对应中文等其他语言
添加drawable ---ic_lock_restart.png(android\frameworks\base\core\res\res\drawable-mdpi)
2.弹出对话框
修改弹出框token(android\frameworks\base\core\java\com\android\internal\app)
new AlertDialog.Builder(context)
.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle(mReboot?com.android.internal.R.string.global_action_power_restart:com.android.internal.R.string.power_off)
.setMessage(mReboot?com.android.internal.R.string.restart_confirm:com.android.internal.R.string.shutdown_confirm)
.setPositiveButton(com.android.internal.R.string.yes, new DialogInterface.OnClickListener() {
....}
根据mReboot显示 关机还是重启