Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1a389df authored by Tim Tsai's avatar Tim Tsai Committed by Android (Google) Code Review
Browse files

Merge "Suppress "Long press power button to turn off TV" toast" into main

parents 73122b7a 4db21376
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -7646,4 +7646,8 @@
    <!-- Action for opening trusted location settings page [CHAR LIMIT=NONE] [DO NOT TRANSLATE] -->
    <string name="trusted_location_settings_action" translatable="false"></string>

    <!-- The delay in milliseconds to suppress the toast after the user presses the
         power button. -->
    <integer name="config_turnOffTvToastSuppressionDelayMs">0</integer>

</resources>
+1 −0
Original line number Diff line number Diff line
@@ -833,6 +833,7 @@
  <java-symbol type="string" name="lockscreen_emergency_call" />
  <java-symbol type="string" name="lockscreen_return_to_call" />
  <java-symbol type="string" name="long_press_power_to_turn_off_tv_toast" />
  <java-symbol type="integer" name="config_turnOffTvToastSuppressionDelayMs" />
  <java-symbol type="string" name="low_memory" />
  <java-symbol type="string" name="mic_access_off_toast" />
  <java-symbol type="string" name="mic_access_on_toast" />
+15 −6
Original line number Diff line number Diff line
@@ -609,6 +609,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    boolean mWakeOnBackKeyPress;
    boolean mSilenceRingerOnSleepKey;
    long mWakeUpToLastStateTimeout;
    long mTurnOffTvToastSuppressionDelay;
    long mLastShortPressTurnOffTvHintToastTime = 0;
    ComponentName mSearchKeyTargetActivity;

    // Key Behavior - Stem Primary
@@ -1308,6 +1310,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        dreamManagerInternal.requestDream();
        if (mHasFeatureLeanback
                && getResolvedLongPressOnPowerBehavior() == LONG_PRESS_POWER_GO_TO_SLEEP) {
            final long now = SystemClock.uptimeMillis();
            if (now - mLastShortPressTurnOffTvHintToastTime >= mTurnOffTvToastSuppressionDelay) {
                mLastShortPressTurnOffTvHintToastTime = now;
                Toast.makeText(
                        mContext,
                        UiThread.get().getLooper(),
@@ -1316,6 +1321,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                        .show();
            }
        }
    }

    /**
     * Sends the default display to sleep as a result of a power button press.
@@ -2381,6 +2387,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                com.android.internal.R.string.config_searchKeyTargetActivity));
        readConfigurationDependentBehaviors();

        mTurnOffTvToastSuppressionDelay = mContext.getResources().getInteger(
                com.android.internal.R.integer.config_turnOffTvToastSuppressionDelayMs);

        mDisplayFoldController = DisplayFoldController.create(mContext, DEFAULT_DISPLAY);

        mAccessibilityManager = mContext.getSystemService(AccessibilityManager.class);