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

Commit cfa439f0 authored by Michael Kwan's avatar Michael Kwan Committed by Android (Google) Code Review
Browse files

Merge "Add config to allow start activities on long press." into pi-dev

parents 80e87e4d 7f171695
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
@@ -434,6 +434,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;

@@ -8660,6 +8667,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);