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

Commit 7f171695 authored by Michael Kwan's avatar Michael Kwan
Browse files

Add config to allow start activities on long press.

Bug: 76225182
Test: manual test
Change-Id: I64142f202638ef7a6a85f9777688a0f4f31e9e99
parent d6997b05
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -974,6 +974,9 @@
    -->
    <integer name="config_longPressOnBackBehavior">0</integer>

    <!-- Allows activities to be launched on a long press on power during device setup. -->
    <bool name="config_allowStartActivityForLongPressOnPowerInSetup">false</bool>

    <!-- Control the behavior when the user short presses the power button.
            0 - Nothing
            1 - Go to sleep (doze)
+1 −0
Original line number Diff line number Diff line
@@ -433,6 +433,7 @@
  <java-symbol type="integer" name="config_veryLongPressOnPowerBehavior" />
  <java-symbol type="integer" name="config_veryLongPressTimeout" />
  <java-symbol type="integer" name="config_longPressOnBackBehavior" />
  <java-symbol type="bool" name="config_allowStartActivityForLongPressOnPowerInSetup" />
  <java-symbol type="integer" name="config_lowMemoryKillerMinFreeKbytesAdjust" />
  <java-symbol type="integer" name="config_lowMemoryKillerMinFreeKbytesAbsolute" />
  <java-symbol type="integer" name="config_max_pan_devices" />
+11 −1
Original line number Diff line number Diff line
@@ -618,6 +618,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    boolean mTranslucentDecorEnabled = true;
    boolean mUseTvRouting;
    int mVeryLongPressTimeout;
    boolean mAllowStartActivityForLongPressOnPowerDuringSetup;

    private boolean mHandleVolumeKeysInWM;

@@ -1622,8 +1623,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    : mKeyguardDelegate.isShowing();
            if (!keyguardActive) {
                Intent intent = new Intent(Intent.ACTION_VOICE_ASSIST);
                if (mAllowStartActivityForLongPressOnPowerDuringSetup) {
                    mContext.startActivityAsUser(intent, UserHandle.CURRENT_OR_SELF);
                } else {
                    startActivityAsUser(intent, UserHandle.CURRENT_OR_SELF);
                }
            }
            break;
        }
    }
@@ -2134,6 +2139,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                com.android.internal.R.integer.config_shortPressOnSleepBehavior);
        mVeryLongPressTimeout = mContext.getResources().getInteger(
                com.android.internal.R.integer.config_veryLongPressTimeout);
        mAllowStartActivityForLongPressOnPowerDuringSetup = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_allowStartActivityForLongPressOnPowerInSetup);

        mUseTvRouting = AudioSystem.getPlatformType(mContext) == AudioSystem.PLATFORM_TELEVISION;

@@ -8654,6 +8661,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        pw.print(prefix);
                pw.print("mShortPressOnWindowBehavior=");
                pw.println(shortPressOnWindowBehaviorToString(mShortPressOnWindowBehavior));
        pw.print(prefix);
                pw.print("mAllowStartActivityForLongPressOnPowerDuringSetup=");
                pw.println(mAllowStartActivityForLongPressOnPowerDuringSetup);
        pw.print(prefix);
                pw.print("mHasSoftInput="); pw.print(mHasSoftInput);
                pw.print(" mDismissImeOnBackKeyPressed="); pw.println(mDismissImeOnBackKeyPressed);