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

Commit 9aca5890 authored by Lucas Dupin's avatar Lucas Dupin Committed by android-build-merger
Browse files

Merge "Disable scrim focus on AOD" into pi-dev

am: 0487601e

Change-Id: I1800a1de9842e52188fe6b40ce5da6f9a96b19ea
parents f8f74a5e 0487601e
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -106,11 +106,6 @@ public class ScrimView extends View implements ConfigurationController.Configura
                Utils.getThemeAttr(mContext, android.R.attr.dialogCornerRadius));
    }

    @Override
    public void setBackground(Drawable background) {
        Log.wtfStack(TAG, "ScrimView should never have a background.");
    }

    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
+7 −2
Original line number Diff line number Diff line
@@ -239,6 +239,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
        mCurrentBehindAlpha = state.getBehindAlpha(mNotificationDensity);
        applyExpansionToAlpha();

        // Scrim might acquire focus when user is navigating with a D-pad or a keyboard.
        // We need to disable focus otherwise AOD would end up with a gray overlay.
        mScrimInFront.setFocusable(!state.isLowPowerState());
        mScrimBehind.setFocusable(!state.isLowPowerState());

        // Cancel blanking transitions that were pending before we requested a new state
        if (mPendingFrameCallback != null) {
            Choreographer.getInstance().removeFrameCallback(mPendingFrameCallback);
@@ -257,7 +262,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
        // the animation plays properly until the last frame.
        // It's important to avoid holding the wakelock unless necessary because
        // WakeLock#aqcuire will trigger an IPC and will cause jank.
        if (mState == ScrimState.AOD) {
        if (mState.isLowPowerState()) {
            holdWakeLock();
        }

@@ -528,7 +533,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
            scrim.setClickable(false);
        } else {
            // Eat touch events (unless dozing).
            scrim.setClickable(!(mState == ScrimState.AOD));
            scrim.setClickable(!mState.isLowPowerState());
        }
        updateScrim(scrim, alpha);
    }
+9 −0
Original line number Diff line number Diff line
@@ -116,6 +116,11 @@ public enum ScrimState {
            // to set our state.
            mAnimateChange = mCanControlScreenOff;
        }

        @Override
        public boolean isLowPowerState() {
            return true;
        }
    },

    /**
@@ -250,4 +255,8 @@ public enum ScrimState {
    public void setWallpaperSupportsAmbientMode(boolean wallpaperSupportsAmbientMode) {
        mWallpaperSupportsAmbientMode = wallpaperSupportsAmbientMode;
    }

    public boolean isLowPowerState() {
        return false;
    }
}
 No newline at end of file
+12 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import android.testing.TestableLooper;
import android.view.Choreographer;
import android.view.View;

import com.android.internal.util.Preconditions;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.statusbar.ScrimView;
@@ -463,6 +464,17 @@ public class ScrimControllerTest extends SysuiTestCase {
                mHeadsUpScrim.getAlpha(), 0.01f);
    }

    @Test
    public void testScrimFocus() {
        mScrimController.transitionTo(ScrimState.AOD);
        Assert.assertFalse("Should not be focusable on AOD", mScrimBehind.isFocusable());
        Assert.assertFalse("Should not be focusable on AOD", mScrimInFront.isFocusable());

        mScrimController.transitionTo(ScrimState.KEYGUARD);
        Assert.assertTrue("Should be focusable on keyguard", mScrimBehind.isFocusable());
        Assert.assertTrue("Should be focusable on keyguard", mScrimInFront.isFocusable());
    }

    /**
     * Conserves old notification density after leaving state and coming back.
     *