长按电源键中增加重启和飞行模式选项及显示情景模式(静音、震动、响铃)

2019-07-14 00:59发布

1.frameworks/base/services/core/java/com/android/server/policy/GlobalActions.java private final class PowerAction extends SinglePressAction implements LongPressAction { ....... } //add by zjx private final class RebootAction extends SinglePressAction implements LongPressAction {
        private RebootAction() {
            super(com.mediatek.internal.R.drawable.ic_lock_reboot,
                com.mediatek.internal.R.string.global_action_reboot);
        }


        @Override
        public boolean onLongPress() {
            //mWindowManagerFuncs.rebootSafeMode(true);
            return true;
        }


        @Override
        public boolean showDuringKeyguard() {
            return true;
        }


        @Override
        public boolean showBeforeProvisioning() {
            return true;
        }


        @Override
        public void onPress() {
            // shutdown by making sure radio and power are handled accordingly.
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
                builder.setTitle(com.android.internal.R.string.factorytest_reboot);
                builder.setMessage(com.mediatek.internal.R.string.global_action_reboot_info);
                builder.setNegativeButton(com.android.internal.R.string.cancel, null);
                builder.setPositiveButton(com.android.internal.R.string.yes,
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                PowerManager pm = (PowerManager) mContext
                                            .getSystemService(Context.POWER_SERVICE);
                                    // SPRD: add reboot reason for PhoneInfo
                                    // feature @{
                                    pm.reboot("power_reboot");
                            }
                        });
                AlertDialog dialog = builder.create();
                dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
                dialog.show();
        }
    }
//end by zjx 2.frameworks/base/services/core/java/com/android/server/power/ShutdownThread.java private static void beginShutdownSequence(Context context) { ................... //add by zjx } else {
if(mReboot&&(!mRebootSafeMode)){
pd.setTitle(context.getText(com.android.internal.R.string.factorytest_reboot));
pd.setMessage(context.getText(com.mediatek.internal.R.string.global_action_reboot_message));
}else{
pd.setTitle(context.getText(com.android.internal.R.string.power_off));
pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress));
}
//
end by zjx pd.setIndeterminate(true);         } } 3.frameworks/base/core/res/res/values/config.xml          power airplane         bugreport         users         silent //显示情景模式

   
4,vendormediatekproprietaryframeworksase es esvaluessymbols.xml //add by zjx  
   

//end by zjx 5.vendormediatekproprietaryframeworksase es esvaluesstrings.xml Reboot
Screenshot
Would you like to reboot your phone now?
Rebooting...