I.MX6 android 移除shutdown功能

时间:2022-07-03 09:23:39
/************************************************************************
 *                    I.MX6 android 移除shutdown功能
 * 说明:
 *     有时候,我们可能会只是不需要android中的shutdown功能。
 *
 *                                     2016-3-17 深圳 南山平山村 曾剑锋
 ***********************************************************************/

cat frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
    ......
    public class PhoneWindowManager implements WindowManagerPolicy {
        ......
        private final Runnable mPowerLongPress = new Runnable() {
            @Override
            public void run() {
                // The context isn't read
                if (mLongPressOnPowerBehavior < 0) {
                    mLongPressOnPowerBehavior = mContext.getResources().getInteger(
                            com.android.internal.R.integer.config_longPressOnPowerBehavior);
                }
                int resolvedBehavior = mLongPressOnPowerBehavior;
                if (FactoryTest.isLongPressOnPowerOffEnabled()) {
                    resolvedBehavior = LONG_PRESS_POWER_SHUT_OFF_NO_CONFIRM;
                }
    
                switch (resolvedBehavior) {
                case LONG_PRESS_POWER_NOTHING:
                    break;
                case LONG_PRESS_POWER_GLOBAL_ACTIONS:
                    mPowerKeyHandled = true;
                    if (!performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false)) {
                        performAuditoryFeedbackForAccessibilityIfNeed();
                    }
                    sendCloseSystemWindows(SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS);
                    // modify by zengjf 2016-3-17
                    //showGlobalActionsDialog();
                    //mWindowManagerFuncs.shutdown(resolvedBehavior == LONG_PRESS_POWER_SHUT_OFF);
                    break;
                case LONG_PRESS_POWER_SHUT_OFF:
                case LONG_PRESS_POWER_SHUT_OFF_NO_CONFIRM:
                    mPowerKeyHandled = true;
                    performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false);
                    sendCloseSystemWindows(SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS);
                    mWindowManagerFuncs.shutdown(resolvedBehavior == LONG_PRESS_POWER_SHUT_OFF);
                    break;
                }
            }
        };
        ......
    }   
    ......