Loading core/res/res/values-watch/config.xml +0 −3 Original line number Diff line number Diff line Loading @@ -91,9 +91,6 @@ devices. --> <bool name="config_viewRotaryEncoderHapticScrollFedbackEnabled">true</bool> <!-- If this is true, allow wake from theater mode from motion. --> <bool name="config_allowTheaterModeWakeFromMotion">true</bool> <!-- True if the device supports system decorations on secondary displays. --> <bool name="config_supportsSystemDecorsOnSecondaryDisplays">false</bool> Loading core/res/res/values/config.xml +0 −17 Original line number Diff line number Diff line Loading @@ -545,27 +545,10 @@ <!-- If this is true, allow wake from theater mode when plugged in or unplugged. --> <bool name="config_allowTheaterModeWakeFromUnplug">false</bool> <!-- If this is true, allow wake from theater mode from gesture. --> <bool name="config_allowTheaterModeWakeFromGesture">false</bool> <!-- If this is true, allow wake from theater mode from camera lens cover is switched. --> <bool name="config_allowTheaterModeWakeFromCameraLens">false</bool> <!-- If this is true, allow wake from theater mode from power key press. --> <bool name="config_allowTheaterModeWakeFromPowerKey">true</bool> <!-- If this is true, allow wake from theater mode from regular key press. Setting this value to true implies config_allowTheaterModeWakeFromPowerKey is also true--> <bool name="config_allowTheaterModeWakeFromKey">false</bool> <!-- If this is true, allow wake from theater mode from motion. --> <bool name="config_allowTheaterModeWakeFromMotion">false</bool> <!-- If this is true, allow wake from theater mode from motion. --> <bool name="config_allowTheaterModeWakeFromMotionWhenNotDreaming">false</bool> <!-- If this is true, allow wake from theater mode from lid switch. --> <bool name="config_allowTheaterModeWakeFromLidSwitch">false</bool> <!-- If this is true, allow wake from theater mode when docked. --> <bool name="config_allowTheaterModeWakeFromDock">false</bool> <!-- If this is true, allow wake from theater mode from window layout flag. --> <bool name="config_allowTheaterModeWakeFromWindowLayout">false</bool> <!-- If this is true, go to sleep when theater mode is enabled from button press --> <bool name="config_goToSleepOnButtonPressTheaterMode">true</bool> <!-- If this is true, long press on power button will be available from the non-interactive state --> <bool name="config_supportLongPressPowerWhenNonInteractive">false</bool> <!-- If this is true, short press on power button will be available whenever the default display Loading core/res/res/values/symbols.xml +0 −8 Original line number Diff line number Diff line Loading @@ -2102,13 +2102,6 @@ <java-symbol type="bool" name="config_skipScreenOffTransition" /> <java-symbol type="bool" name="config_allowAutoBrightnessWhileDozing" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromUnplug" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromGesture" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromCameraLens" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromPowerKey" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromKey" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromMotion" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromMotionWhenNotDreaming" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromLidSwitch" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromDock" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromWindowLayout" /> <java-symbol type="bool" name="config_keepDreamingWhenUnplugging" /> Loading @@ -2119,7 +2112,6 @@ <java-symbol type="bool" name="config_lowLightDisplayBehaviorEnabledDefault" /> <java-symbol type="integer" name="config_lowLightDisplayBehaviorDefault" /> <java-symbol type="integer" name="config_keyguardDrawnTimeout" /> <java-symbol type="bool" name="config_goToSleepOnButtonPressTheaterMode" /> <java-symbol type="bool" name="config_supportLongPressPowerWhenNonInteractive" /> <java-symbol type="bool" name="config_supportShortPressPowerWhenDefaultDisplayOn" /> <java-symbol type="bool" name="config_wimaxEnabled" /> Loading services/core/java/com/android/server/policy/PhoneWindowManager.java +1 −49 Original line number Diff line number Diff line Loading @@ -326,7 +326,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { // The config value can be overridden using Settings.Global.POWER_BUTTON_DOUBLE_PRESS and/or // Settings.Global.POWER_BUTTON_TRIPLE_PRESS static final int MULTI_PRESS_POWER_NOTHING = 0; static final int MULTI_PRESS_POWER_THEATER_MODE = 1; // Deprecated: static final int MULTI_PRESS_POWER_THEATER_MODE = 1; static final int MULTI_PRESS_POWER_BRIGHTNESS_BOOST = 2; static final int MULTI_PRESS_POWER_LAUNCH_TARGET_ACTIVITY = 3; Loading Loading @@ -677,9 +677,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { // behavior will be skipped if the default display is non-interactive. private boolean mSupportShortPressPowerWhenDefaultDisplayOn; // Whether to go to sleep entering theater mode from power button private boolean mGoToSleepOnButtonPressTheaterMode; // Ringer toggle should reuse timing and triggering from screenshot power and a11y vol up int mRingerToggleChord = VOLUME_HUSH_OFF; Loading Loading @@ -1368,30 +1365,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { switch (behavior) { case MULTI_PRESS_POWER_NOTHING: break; case MULTI_PRESS_POWER_THEATER_MODE: if (!isUserSetupComplete()) { Slog.i(TAG, "Ignoring toggling theater mode - device not setup."); break; } if (isTheaterModeEnabled()) { Slog.i(TAG, "Toggling theater mode off."); Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.THEATER_MODE_ON, 0); if (!interactive) { wakeUpFromWakeKey(eventTime, KEYCODE_POWER, /* isDown= */ false); } } else { Slog.i(TAG, "Toggling theater mode on."); Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.THEATER_MODE_ON, 1); if (mGoToSleepOnButtonPressTheaterMode && interactive) { goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, 0); } } break; case MULTI_PRESS_POWER_BRIGHTNESS_BOOST: Slog.i(TAG, "Starting brightness boost."); if (!interactive) { Loading Loading @@ -2365,9 +2338,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { mLidNavigationAccessibility = mContext.getResources().getInteger( com.android.internal.R.integer.config_lidNavigationAccessibility); mGoToSleepOnButtonPressTheaterMode = mContext.getResources().getBoolean( com.android.internal.R.bool.config_goToSleepOnButtonPressTheaterMode); mSupportLongPressPowerWhenNonInteractive = mContext.getResources().getBoolean( com.android.internal.R.bool.config_supportLongPressPowerWhenNonInteractive); mSupportShortPressPowerWhenDefaultDisplayOn = Loading Loading @@ -5088,17 +5058,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { return ACTION_PASS_TO_USER; } // If we have not passed the action up and we are in theater mode without dreaming, // there will be no dream to intercept the touch and wake into ambient. The device should // wake up in this case. if (isTheaterModeEnabled() && (policyFlags & FLAG_WAKE) != 0) { if (mWindowWakeUpPolicy.wakeUpFromMotion(displayId, whenNanos / 1000000, source, action == MotionEvent.ACTION_DOWN, mDeviceGoingToSleep)) { // Woke up. Pass motion events to user. return ACTION_PASS_TO_USER; } } return 0; } Loading Loading @@ -6360,11 +6319,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { return true; } private boolean isTheaterModeEnabled() { return Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.THEATER_MODE_ON, 0) == 1; } private void performHapticFeedback(int effectId, String reason) { performHapticFeedback(effectId, reason, 0 /* flags */); } Loading Loading @@ -6691,8 +6645,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { switch (behavior) { case MULTI_PRESS_POWER_NOTHING: return "MULTI_PRESS_POWER_NOTHING"; case MULTI_PRESS_POWER_THEATER_MODE: return "MULTI_PRESS_POWER_THEATER_MODE"; case MULTI_PRESS_POWER_BRIGHTNESS_BOOST: return "MULTI_PRESS_POWER_BRIGHTNESS_BOOST"; case MULTI_PRESS_POWER_LAUNCH_TARGET_ACTIVITY: Loading services/core/java/com/android/server/policy/WindowWakeUpPolicy.java +0 −85 Original line number Diff line number Diff line Loading @@ -29,15 +29,12 @@ import static com.android.server.power.feature.flags.Flags.perDisplayWakeByTouch import android.annotation.Nullable; import android.content.Context; import android.content.res.Resources; import android.os.PowerManager; import android.os.PowerManager.WakeReason; import android.os.SystemClock; import android.provider.Settings; import android.util.Slog; import android.view.Display; import android.view.KeyEvent; import android.view.WindowManager; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.os.Clock; Loading @@ -47,20 +44,9 @@ import com.android.server.LocalServices; class WindowWakeUpPolicy { private static final String TAG = "WindowWakeUpPolicy"; private static final boolean DEBUG = false; private final Context mContext; private final PowerManager mPowerManager; private final WindowManager mWindowManager; private final Clock mClock; private final boolean mAllowTheaterModeWakeFromKey; private final boolean mAllowTheaterModeWakeFromPowerKey; private final boolean mAllowTheaterModeWakeFromMotion; private final boolean mAllowTheaterModeWakeFromCameraLens; private final boolean mAllowTheaterModeWakeFromLidSwitch; private final boolean mAllowTheaterModeWakeFromWakeGesture; // The policy will handle input-based wake ups if this delegate is null. @Nullable private WindowWakeUpPolicyInternal.InputWakeUpDelegate mInputWakeUpDelegate; Loading @@ -70,26 +56,9 @@ class WindowWakeUpPolicy { @VisibleForTesting WindowWakeUpPolicy(Context context, Clock clock) { mContext = context; mPowerManager = context.getSystemService(PowerManager.class); mWindowManager = context.getSystemService(WindowManager.class); mClock = clock; final Resources res = context.getResources(); mAllowTheaterModeWakeFromKey = res.getBoolean( com.android.internal.R.bool.config_allowTheaterModeWakeFromKey); mAllowTheaterModeWakeFromPowerKey = mAllowTheaterModeWakeFromKey || res.getBoolean( com.android.internal.R.bool.config_allowTheaterModeWakeFromPowerKey); mAllowTheaterModeWakeFromMotion = res.getBoolean( com.android.internal.R.bool.config_allowTheaterModeWakeFromMotion); mAllowTheaterModeWakeFromCameraLens = res.getBoolean( com.android.internal.R.bool.config_allowTheaterModeWakeFromCameraLens); mAllowTheaterModeWakeFromLidSwitch = res.getBoolean( com.android.internal.R.bool.config_allowTheaterModeWakeFromLidSwitch); mAllowTheaterModeWakeFromWakeGesture = res.getBoolean( com.android.internal.R.bool.config_allowTheaterModeWakeFromGesture); if (supportInputWakeupDelegate()) { LocalServices.addService(WindowWakeUpPolicyInternal.class, new LocalService()); } Loading Loading @@ -117,14 +86,6 @@ class WindowWakeUpPolicy { * executed; {@code false} otherwise. */ boolean wakeUpFromKey(int displayId, long eventTime, int keyCode, boolean isDown) { final boolean wakeAllowedDuringTheaterMode = keyCode == KEYCODE_POWER ? mAllowTheaterModeWakeFromPowerKey : mAllowTheaterModeWakeFromKey; if (!canWakeUp(wakeAllowedDuringTheaterMode)) { if (DEBUG) Slog.d(TAG, "Unable to wake up from " + KeyEvent.keyCodeToString(keyCode)); return false; } if (mInputWakeUpDelegate != null && mInputWakeUpDelegate.wakeUpFromKey(eventTime, keyCode, isDown)) { return true; Loading Loading @@ -159,10 +120,6 @@ class WindowWakeUpPolicy { boolean wakeUpFromMotion( int displayId, long eventTime, int source, boolean isDown, boolean deviceGoingToSleep) { if (!canWakeUp(mAllowTheaterModeWakeFromMotion)) { if (DEBUG) Slog.d(TAG, "Unable to wake up from motion."); return false; } if (mInputWakeUpDelegate != null && mInputWakeUpDelegate.wakeUpFromMotion( eventTime, source, isDown, deviceGoingToSleep)) { Loading @@ -184,10 +141,6 @@ class WindowWakeUpPolicy { * executed; {@code false} otherwise. */ boolean wakeUpFromCameraCover(long eventTime) { if (!canWakeUp(mAllowTheaterModeWakeFromCameraLens)) { if (DEBUG) Slog.d(TAG, "Unable to wake up from camera cover."); return false; } wakeUp(eventTime, WAKE_REASON_CAMERA_LAUNCH, "CAMERA_COVER"); return true; } Loading @@ -199,10 +152,6 @@ class WindowWakeUpPolicy { * executed; {@code false} otherwise. */ boolean wakeUpFromLid() { if (!canWakeUp(mAllowTheaterModeWakeFromLidSwitch)) { if (DEBUG) Slog.d(TAG, "Unable to wake up from lid."); return false; } wakeUp(mClock.uptimeMillis(), WAKE_REASON_LID, "LID"); return true; } Loading @@ -214,10 +163,6 @@ class WindowWakeUpPolicy { * executed; {@code false} otherwise. */ boolean wakeUpFromPowerKeyCameraGesture() { if (!canWakeUp(mAllowTheaterModeWakeFromPowerKey)) { if (DEBUG) Slog.d(TAG, "Unable to wake up from power key camera gesture."); return false; } wakeUp(mClock.uptimeMillis(), WAKE_REASON_CAMERA_LAUNCH, "CAMERA_GESTURE_PREVENT_LOCK"); return true; } Loading @@ -229,10 +174,6 @@ class WindowWakeUpPolicy { * executed; {@code false} otherwise. */ boolean wakeUpFromWakeGesture() { if (!canWakeUp(mAllowTheaterModeWakeFromWakeGesture)) { if (DEBUG) Slog.d(TAG, "Unable to wake up from gesture."); return false; } wakeUp(mClock.uptimeMillis(), WAKE_REASON_GESTURE, "GESTURE"); return true; } Loading @@ -240,40 +181,14 @@ class WindowWakeUpPolicy { /** * Wakes up due to a Bluetooth HID profile connection. * * The policy at the theater mode is the same as the motion, because Bluetooth HID * connection is caused by user motions. * * @return {@code true} if the policy allows the requested wake up and the request has been * executed; {@code false} otherwise. */ boolean wakeUpFromBluetooth() { if (!canWakeUp(mAllowTheaterModeWakeFromMotion)) { if (DEBUG) Slog.d(TAG, "Unable to wake up from Bluetooth."); return false; } wakeUp(mClock.uptimeMillis(), WAKE_REASON_WAKE_MOTION, "BLUETOOTH_DEVICE_CONNECTED"); return true; } private boolean canWakeUp(boolean wakeInTheaterMode) { if (supportInputWakeupDelegate() && isDefaultDisplayOn()) { // If the default display is on, theater mode should not influence whether or not // waking up is allowed. This is because the theater mode checks are there to block // the display from being on in situations where the user may not want it to be // on (so if the display is already on, no need to check for theater mode at all). return true; } final boolean isTheaterModeEnabled = Settings.Global.getInt( mContext.getContentResolver(), Settings.Global.THEATER_MODE_ON, 0) == 1; return wakeInTheaterMode || !isTheaterModeEnabled; } private boolean isDefaultDisplayOn() { return Display.isOnState(mWindowManager.getDefaultDisplay().getState()); } /** Wakes up {@link PowerManager}. */ private void wakeUp(long wakeTime, @WakeReason int reason, String details) { mPowerManager.wakeUp(wakeTime, reason, "android.policy:" + details); Loading Loading
core/res/res/values-watch/config.xml +0 −3 Original line number Diff line number Diff line Loading @@ -91,9 +91,6 @@ devices. --> <bool name="config_viewRotaryEncoderHapticScrollFedbackEnabled">true</bool> <!-- If this is true, allow wake from theater mode from motion. --> <bool name="config_allowTheaterModeWakeFromMotion">true</bool> <!-- True if the device supports system decorations on secondary displays. --> <bool name="config_supportsSystemDecorsOnSecondaryDisplays">false</bool> Loading
core/res/res/values/config.xml +0 −17 Original line number Diff line number Diff line Loading @@ -545,27 +545,10 @@ <!-- If this is true, allow wake from theater mode when plugged in or unplugged. --> <bool name="config_allowTheaterModeWakeFromUnplug">false</bool> <!-- If this is true, allow wake from theater mode from gesture. --> <bool name="config_allowTheaterModeWakeFromGesture">false</bool> <!-- If this is true, allow wake from theater mode from camera lens cover is switched. --> <bool name="config_allowTheaterModeWakeFromCameraLens">false</bool> <!-- If this is true, allow wake from theater mode from power key press. --> <bool name="config_allowTheaterModeWakeFromPowerKey">true</bool> <!-- If this is true, allow wake from theater mode from regular key press. Setting this value to true implies config_allowTheaterModeWakeFromPowerKey is also true--> <bool name="config_allowTheaterModeWakeFromKey">false</bool> <!-- If this is true, allow wake from theater mode from motion. --> <bool name="config_allowTheaterModeWakeFromMotion">false</bool> <!-- If this is true, allow wake from theater mode from motion. --> <bool name="config_allowTheaterModeWakeFromMotionWhenNotDreaming">false</bool> <!-- If this is true, allow wake from theater mode from lid switch. --> <bool name="config_allowTheaterModeWakeFromLidSwitch">false</bool> <!-- If this is true, allow wake from theater mode when docked. --> <bool name="config_allowTheaterModeWakeFromDock">false</bool> <!-- If this is true, allow wake from theater mode from window layout flag. --> <bool name="config_allowTheaterModeWakeFromWindowLayout">false</bool> <!-- If this is true, go to sleep when theater mode is enabled from button press --> <bool name="config_goToSleepOnButtonPressTheaterMode">true</bool> <!-- If this is true, long press on power button will be available from the non-interactive state --> <bool name="config_supportLongPressPowerWhenNonInteractive">false</bool> <!-- If this is true, short press on power button will be available whenever the default display Loading
core/res/res/values/symbols.xml +0 −8 Original line number Diff line number Diff line Loading @@ -2102,13 +2102,6 @@ <java-symbol type="bool" name="config_skipScreenOffTransition" /> <java-symbol type="bool" name="config_allowAutoBrightnessWhileDozing" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromUnplug" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromGesture" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromCameraLens" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromPowerKey" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromKey" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromMotion" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromMotionWhenNotDreaming" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromLidSwitch" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromDock" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromWindowLayout" /> <java-symbol type="bool" name="config_keepDreamingWhenUnplugging" /> Loading @@ -2119,7 +2112,6 @@ <java-symbol type="bool" name="config_lowLightDisplayBehaviorEnabledDefault" /> <java-symbol type="integer" name="config_lowLightDisplayBehaviorDefault" /> <java-symbol type="integer" name="config_keyguardDrawnTimeout" /> <java-symbol type="bool" name="config_goToSleepOnButtonPressTheaterMode" /> <java-symbol type="bool" name="config_supportLongPressPowerWhenNonInteractive" /> <java-symbol type="bool" name="config_supportShortPressPowerWhenDefaultDisplayOn" /> <java-symbol type="bool" name="config_wimaxEnabled" /> Loading
services/core/java/com/android/server/policy/PhoneWindowManager.java +1 −49 Original line number Diff line number Diff line Loading @@ -326,7 +326,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { // The config value can be overridden using Settings.Global.POWER_BUTTON_DOUBLE_PRESS and/or // Settings.Global.POWER_BUTTON_TRIPLE_PRESS static final int MULTI_PRESS_POWER_NOTHING = 0; static final int MULTI_PRESS_POWER_THEATER_MODE = 1; // Deprecated: static final int MULTI_PRESS_POWER_THEATER_MODE = 1; static final int MULTI_PRESS_POWER_BRIGHTNESS_BOOST = 2; static final int MULTI_PRESS_POWER_LAUNCH_TARGET_ACTIVITY = 3; Loading Loading @@ -677,9 +677,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { // behavior will be skipped if the default display is non-interactive. private boolean mSupportShortPressPowerWhenDefaultDisplayOn; // Whether to go to sleep entering theater mode from power button private boolean mGoToSleepOnButtonPressTheaterMode; // Ringer toggle should reuse timing and triggering from screenshot power and a11y vol up int mRingerToggleChord = VOLUME_HUSH_OFF; Loading Loading @@ -1368,30 +1365,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { switch (behavior) { case MULTI_PRESS_POWER_NOTHING: break; case MULTI_PRESS_POWER_THEATER_MODE: if (!isUserSetupComplete()) { Slog.i(TAG, "Ignoring toggling theater mode - device not setup."); break; } if (isTheaterModeEnabled()) { Slog.i(TAG, "Toggling theater mode off."); Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.THEATER_MODE_ON, 0); if (!interactive) { wakeUpFromWakeKey(eventTime, KEYCODE_POWER, /* isDown= */ false); } } else { Slog.i(TAG, "Toggling theater mode on."); Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.THEATER_MODE_ON, 1); if (mGoToSleepOnButtonPressTheaterMode && interactive) { goToSleep(eventTime, PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, 0); } } break; case MULTI_PRESS_POWER_BRIGHTNESS_BOOST: Slog.i(TAG, "Starting brightness boost."); if (!interactive) { Loading Loading @@ -2365,9 +2338,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { mLidNavigationAccessibility = mContext.getResources().getInteger( com.android.internal.R.integer.config_lidNavigationAccessibility); mGoToSleepOnButtonPressTheaterMode = mContext.getResources().getBoolean( com.android.internal.R.bool.config_goToSleepOnButtonPressTheaterMode); mSupportLongPressPowerWhenNonInteractive = mContext.getResources().getBoolean( com.android.internal.R.bool.config_supportLongPressPowerWhenNonInteractive); mSupportShortPressPowerWhenDefaultDisplayOn = Loading Loading @@ -5088,17 +5058,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { return ACTION_PASS_TO_USER; } // If we have not passed the action up and we are in theater mode without dreaming, // there will be no dream to intercept the touch and wake into ambient. The device should // wake up in this case. if (isTheaterModeEnabled() && (policyFlags & FLAG_WAKE) != 0) { if (mWindowWakeUpPolicy.wakeUpFromMotion(displayId, whenNanos / 1000000, source, action == MotionEvent.ACTION_DOWN, mDeviceGoingToSleep)) { // Woke up. Pass motion events to user. return ACTION_PASS_TO_USER; } } return 0; } Loading Loading @@ -6360,11 +6319,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { return true; } private boolean isTheaterModeEnabled() { return Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.THEATER_MODE_ON, 0) == 1; } private void performHapticFeedback(int effectId, String reason) { performHapticFeedback(effectId, reason, 0 /* flags */); } Loading Loading @@ -6691,8 +6645,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { switch (behavior) { case MULTI_PRESS_POWER_NOTHING: return "MULTI_PRESS_POWER_NOTHING"; case MULTI_PRESS_POWER_THEATER_MODE: return "MULTI_PRESS_POWER_THEATER_MODE"; case MULTI_PRESS_POWER_BRIGHTNESS_BOOST: return "MULTI_PRESS_POWER_BRIGHTNESS_BOOST"; case MULTI_PRESS_POWER_LAUNCH_TARGET_ACTIVITY: Loading
services/core/java/com/android/server/policy/WindowWakeUpPolicy.java +0 −85 Original line number Diff line number Diff line Loading @@ -29,15 +29,12 @@ import static com.android.server.power.feature.flags.Flags.perDisplayWakeByTouch import android.annotation.Nullable; import android.content.Context; import android.content.res.Resources; import android.os.PowerManager; import android.os.PowerManager.WakeReason; import android.os.SystemClock; import android.provider.Settings; import android.util.Slog; import android.view.Display; import android.view.KeyEvent; import android.view.WindowManager; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.os.Clock; Loading @@ -47,20 +44,9 @@ import com.android.server.LocalServices; class WindowWakeUpPolicy { private static final String TAG = "WindowWakeUpPolicy"; private static final boolean DEBUG = false; private final Context mContext; private final PowerManager mPowerManager; private final WindowManager mWindowManager; private final Clock mClock; private final boolean mAllowTheaterModeWakeFromKey; private final boolean mAllowTheaterModeWakeFromPowerKey; private final boolean mAllowTheaterModeWakeFromMotion; private final boolean mAllowTheaterModeWakeFromCameraLens; private final boolean mAllowTheaterModeWakeFromLidSwitch; private final boolean mAllowTheaterModeWakeFromWakeGesture; // The policy will handle input-based wake ups if this delegate is null. @Nullable private WindowWakeUpPolicyInternal.InputWakeUpDelegate mInputWakeUpDelegate; Loading @@ -70,26 +56,9 @@ class WindowWakeUpPolicy { @VisibleForTesting WindowWakeUpPolicy(Context context, Clock clock) { mContext = context; mPowerManager = context.getSystemService(PowerManager.class); mWindowManager = context.getSystemService(WindowManager.class); mClock = clock; final Resources res = context.getResources(); mAllowTheaterModeWakeFromKey = res.getBoolean( com.android.internal.R.bool.config_allowTheaterModeWakeFromKey); mAllowTheaterModeWakeFromPowerKey = mAllowTheaterModeWakeFromKey || res.getBoolean( com.android.internal.R.bool.config_allowTheaterModeWakeFromPowerKey); mAllowTheaterModeWakeFromMotion = res.getBoolean( com.android.internal.R.bool.config_allowTheaterModeWakeFromMotion); mAllowTheaterModeWakeFromCameraLens = res.getBoolean( com.android.internal.R.bool.config_allowTheaterModeWakeFromCameraLens); mAllowTheaterModeWakeFromLidSwitch = res.getBoolean( com.android.internal.R.bool.config_allowTheaterModeWakeFromLidSwitch); mAllowTheaterModeWakeFromWakeGesture = res.getBoolean( com.android.internal.R.bool.config_allowTheaterModeWakeFromGesture); if (supportInputWakeupDelegate()) { LocalServices.addService(WindowWakeUpPolicyInternal.class, new LocalService()); } Loading Loading @@ -117,14 +86,6 @@ class WindowWakeUpPolicy { * executed; {@code false} otherwise. */ boolean wakeUpFromKey(int displayId, long eventTime, int keyCode, boolean isDown) { final boolean wakeAllowedDuringTheaterMode = keyCode == KEYCODE_POWER ? mAllowTheaterModeWakeFromPowerKey : mAllowTheaterModeWakeFromKey; if (!canWakeUp(wakeAllowedDuringTheaterMode)) { if (DEBUG) Slog.d(TAG, "Unable to wake up from " + KeyEvent.keyCodeToString(keyCode)); return false; } if (mInputWakeUpDelegate != null && mInputWakeUpDelegate.wakeUpFromKey(eventTime, keyCode, isDown)) { return true; Loading Loading @@ -159,10 +120,6 @@ class WindowWakeUpPolicy { boolean wakeUpFromMotion( int displayId, long eventTime, int source, boolean isDown, boolean deviceGoingToSleep) { if (!canWakeUp(mAllowTheaterModeWakeFromMotion)) { if (DEBUG) Slog.d(TAG, "Unable to wake up from motion."); return false; } if (mInputWakeUpDelegate != null && mInputWakeUpDelegate.wakeUpFromMotion( eventTime, source, isDown, deviceGoingToSleep)) { Loading @@ -184,10 +141,6 @@ class WindowWakeUpPolicy { * executed; {@code false} otherwise. */ boolean wakeUpFromCameraCover(long eventTime) { if (!canWakeUp(mAllowTheaterModeWakeFromCameraLens)) { if (DEBUG) Slog.d(TAG, "Unable to wake up from camera cover."); return false; } wakeUp(eventTime, WAKE_REASON_CAMERA_LAUNCH, "CAMERA_COVER"); return true; } Loading @@ -199,10 +152,6 @@ class WindowWakeUpPolicy { * executed; {@code false} otherwise. */ boolean wakeUpFromLid() { if (!canWakeUp(mAllowTheaterModeWakeFromLidSwitch)) { if (DEBUG) Slog.d(TAG, "Unable to wake up from lid."); return false; } wakeUp(mClock.uptimeMillis(), WAKE_REASON_LID, "LID"); return true; } Loading @@ -214,10 +163,6 @@ class WindowWakeUpPolicy { * executed; {@code false} otherwise. */ boolean wakeUpFromPowerKeyCameraGesture() { if (!canWakeUp(mAllowTheaterModeWakeFromPowerKey)) { if (DEBUG) Slog.d(TAG, "Unable to wake up from power key camera gesture."); return false; } wakeUp(mClock.uptimeMillis(), WAKE_REASON_CAMERA_LAUNCH, "CAMERA_GESTURE_PREVENT_LOCK"); return true; } Loading @@ -229,10 +174,6 @@ class WindowWakeUpPolicy { * executed; {@code false} otherwise. */ boolean wakeUpFromWakeGesture() { if (!canWakeUp(mAllowTheaterModeWakeFromWakeGesture)) { if (DEBUG) Slog.d(TAG, "Unable to wake up from gesture."); return false; } wakeUp(mClock.uptimeMillis(), WAKE_REASON_GESTURE, "GESTURE"); return true; } Loading @@ -240,40 +181,14 @@ class WindowWakeUpPolicy { /** * Wakes up due to a Bluetooth HID profile connection. * * The policy at the theater mode is the same as the motion, because Bluetooth HID * connection is caused by user motions. * * @return {@code true} if the policy allows the requested wake up and the request has been * executed; {@code false} otherwise. */ boolean wakeUpFromBluetooth() { if (!canWakeUp(mAllowTheaterModeWakeFromMotion)) { if (DEBUG) Slog.d(TAG, "Unable to wake up from Bluetooth."); return false; } wakeUp(mClock.uptimeMillis(), WAKE_REASON_WAKE_MOTION, "BLUETOOTH_DEVICE_CONNECTED"); return true; } private boolean canWakeUp(boolean wakeInTheaterMode) { if (supportInputWakeupDelegate() && isDefaultDisplayOn()) { // If the default display is on, theater mode should not influence whether or not // waking up is allowed. This is because the theater mode checks are there to block // the display from being on in situations where the user may not want it to be // on (so if the display is already on, no need to check for theater mode at all). return true; } final boolean isTheaterModeEnabled = Settings.Global.getInt( mContext.getContentResolver(), Settings.Global.THEATER_MODE_ON, 0) == 1; return wakeInTheaterMode || !isTheaterModeEnabled; } private boolean isDefaultDisplayOn() { return Display.isOnState(mWindowManager.getDefaultDisplay().getState()); } /** Wakes up {@link PowerManager}. */ private void wakeUp(long wakeTime, @WakeReason int reason, String details) { mPowerManager.wakeUp(wakeTime, reason, "android.policy:" + details); Loading