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

Commit 06f2cac3 authored by invisiblek's avatar invisiblek Committed by Steve Kondik
Browse files

immersive mode: don't unconfirm a package, that's just dumb

* This is very annoying for specialized apps
* See here for a great explanation http://stackoverflow.com/a/20309721
* The fact that it doesn't even notify the user until the NEXT time they
  run it makes it completely pointless in my opinion anyway.

Change-Id: I423611efc07d467e1d81c66d58adcff331be8b38
parent 0f195e02
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -1724,10 +1724,6 @@
    <string-array translatable="false" name="config_operatorConsideredNonRoaming">
    </string-array>

    <!-- Threshold (in ms) under which a screen off / screen on will be considered a reset of the
         immersive mode confirmation prompt.-->
    <integer name="config_immersive_mode_confirmation_panic">5000</integer>

    <!-- For some operators, PDU has garbages. To fix it, need to use valid index -->
    <integer name="config_valid_wappush_index">-1</integer>

+0 −1
Original line number Diff line number Diff line
@@ -358,7 +358,6 @@
  <java-symbol type="integer" name="config_cursorWindowSize" />
  <java-symbol type="integer" name="config_extraFreeKbytesAdjust" />
  <java-symbol type="integer" name="config_extraFreeKbytesAbsolute" />
  <java-symbol type="integer" name="config_immersive_mode_confirmation_panic" />
  <java-symbol type="integer" name="config_longPressOnPowerBehavior" />
  <java-symbol type="integer" name="config_lowMemoryKillerMinFreeKbytesAdjust" />
  <java-symbol type="integer" name="config_lowMemoryKillerMinFreeKbytesAbsolute" />
+0 −34
Original line number Diff line number Diff line
@@ -60,12 +60,9 @@ public class ImmersiveModeConfirmation {
    private final Context mContext;
    private final H mHandler;
    private final long mShowDelayMs;
    private final long mPanicThresholdMs;
    private final SparseBooleanArray mUserPanicResets = new SparseBooleanArray();

    private boolean mConfirmed;
    private ClingWindowView mClingWindow;
    private long mPanicTime;
    private WindowManager mWindowManager;
    private int mCurrentUserId;

@@ -73,8 +70,6 @@ public class ImmersiveModeConfirmation {
        mContext = context;
        mHandler = new H();
        mShowDelayMs = getNavBarExitDuration() * 3;
        mPanicThresholdMs = context.getResources()
                .getInteger(R.integer.config_immersive_mode_confirmation_panic);
        mWindowManager = (WindowManager)
                mContext.getSystemService(Context.WINDOW_SERVICE);
    }
@@ -87,8 +82,6 @@ public class ImmersiveModeConfirmation {
    public void loadSetting(int currentUserId) {
        mConfirmed = false;
        mCurrentUserId = currentUserId;
        if (DEBUG) Slog.d(TAG, String.format("loadSetting() mCurrentUserId=%d resetForPanic=%s",
                mCurrentUserId, mUserPanicResets.get(mCurrentUserId, false)));
        String value = null;
        try {
            value = Settings.Secure.getStringForUser(mContext.getContentResolver(),
@@ -130,21 +123,6 @@ public class ImmersiveModeConfirmation {
        }
    }

    public boolean onPowerKeyDown(boolean isScreenOn, long time, boolean inImmersiveMode) {
        if (!isScreenOn && (time - mPanicTime < mPanicThresholdMs)) {
            // turning the screen back on within the panic threshold
            mHandler.sendEmptyMessage(H.PANIC);
            return mClingWindow == null;
        }
        if (isScreenOn && inImmersiveMode) {
            // turning the screen off, remember if we were in immersive mode
            mPanicTime = time;
        } else {
            mPanicTime = 0;
        }
        return false;
    }

    public void confirmCurrentPrompt() {
        if (mClingWindow != null) {
            if (DEBUG) Slog.d(TAG, "confirmCurrentPrompt()");
@@ -152,14 +130,6 @@ public class ImmersiveModeConfirmation {
        }
    }

    private void handlePanic() {
        if (DEBUG) Slog.d(TAG, "handlePanic()");
        if (mUserPanicResets.get(mCurrentUserId, false)) return;  // already reset for panic
        mUserPanicResets.put(mCurrentUserId, true);
        mConfirmed = false;
        saveSetting();
    }

    private void handleHide() {
        if (mClingWindow != null) {
            if (DEBUG) Slog.d(TAG, "Hiding immersive mode confirmation");
@@ -327,7 +297,6 @@ public class ImmersiveModeConfirmation {
    private final class H extends Handler {
        private static final int SHOW = 1;
        private static final int HIDE = 2;
        private static final int PANIC = 3;

        @Override
        public void handleMessage(Message msg) {
@@ -338,9 +307,6 @@ public class ImmersiveModeConfirmation {
                case HIDE:
                    handleHide();
                    break;
                case PANIC:
                    handlePanic();
                    break;
            }
        }
    }
+0 −5
Original line number Diff line number Diff line
@@ -4999,11 +4999,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            case KeyEvent.KEYCODE_POWER: {
                result &= ~ACTION_PASS_TO_USER;
                if (down) {
                    boolean panic = mImmersiveModeConfirmation.onPowerKeyDown(interactive,
                            event.getDownTime(), isImmersiveMode(mLastSystemUiFlags));
                    if (panic && !PolicyControl.isImmersiveFiltersActive()) {
                        mHandler.post(mRequestTransientNav);
                    }
                    if (interactive && !mPowerKeyTriggered
                            && (event.getFlags() & KeyEvent.FLAG_FALLBACK) == 0) {
                        mPowerKeyTriggered = true;