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

Commit b531f7e3 authored by Gabriele M's avatar Gabriele M Committed by Dan Pasanen
Browse files

Show lockscreen wallpaper when blur effect is enabled

Showing the content of the screen allows to use the device
without unlocking it first. Don't alter the way windows are hidden
to prevent any interaction.

BUGBASH-268

Change-Id: Id1d7ba4c51b62ea6b514ece9ac03ab271e63df84
(cherry picked from commit 267b43ce)
parent 22a3f026
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -728,11 +728,6 @@ public interface WindowManagerPolicy {
     */
    public WindowState getWinShowWhenLockedLw();

    /**
     * Returns the current keyguard panel, if such a thing exists.
     */
    public WindowState getWinKeyguardPanelLw();

    /**
     * Called when the system would like to show a UI to indicate that an
     * application is starting.  You can use this to add a
+0 −5
Original line number Diff line number Diff line
@@ -3157,11 +3157,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        return mWinShowWhenLocked;
    }

    @Override
    public WindowState getWinKeyguardPanelLw() {
        return mKeyguardPanel;
    }

    /** {@inheritDoc} */
    @Override
    public View addStartingWindow(IBinder appToken, String packageName, int theme,
+3 −45
Original line number Diff line number Diff line
@@ -46,8 +46,6 @@ import static com.android.server.wm.WindowSurfacePlacer.SET_WALLPAPER_ACTION_PEN
import static com.android.server.wm.WindowSurfacePlacer.SET_WALLPAPER_MAY_CHANGE;

import android.content.Context;
import android.database.ContentObserver;
import android.os.Handler;
import android.os.Trace;
import android.util.Slog;
import android.util.SparseArray;
@@ -60,8 +58,6 @@ import android.view.WindowManagerPolicy;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;

import cyanogenmod.providers.CMSettings;

import java.io.PrintWriter;
import java.util.ArrayList;

@@ -139,21 +135,12 @@ public class WindowAnimator {
        }
    }

    private boolean mKeyguardBlurEnabled;

    WindowAnimator(final WindowManagerService service) {
        mService = service;
        mContext = service.mContext;
        mPolicy = service.mPolicy;
        mWindowPlacerLocked = service.mWindowPlacerLocked;

        final boolean isBlurSupported = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_uiBlurEnabled);
        if (isBlurSupported) {
            final SettingsObserver observer = new SettingsObserver(new Handler());
            observer.observe(mContext);
        }

        mAnimationFrameCallback = new Choreographer.FrameCallback() {
            public void doFrame(long frameTimeNs) {
                synchronized (mService.mWindowMap) {
@@ -291,14 +278,6 @@ public class WindowAnimator {
        // Only hide windows if the keyguard is active and not animating away.
        boolean keyguardOn = mPolicy.isKeyguardShowingOrOccluded()
                && mForceHiding != KEYGUARD_ANIMATING_OUT;

        final WindowState winKeyguardPanel = (WindowState) mPolicy.getWinKeyguardPanelLw();
        // If a keyguard panel is currently being shown, we should
        // continue to hide the windows as if blur is disabled.
        if (winKeyguardPanel == null) {
            keyguardOn &= !mKeyguardBlurEnabled;
        }

        boolean hideDockDivider = win.mAttrs.type == TYPE_DOCK_DIVIDER
                && win.getDisplayContent().getDockedStackLocked() == null;
        return keyguardOn && !allowWhenLocked && (win.getDisplayId() == Display.DEFAULT_DISPLAY)
@@ -317,7 +296,7 @@ public class WindowAnimator {
        final boolean keyguardGoingAwayWithWallpaper =
                (mKeyguardGoingAwayFlags & KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER) != 0;

        if (mKeyguardGoingAway && !mKeyguardBlurEnabled) {
        if (mKeyguardGoingAway) {
            for (int i = windows.size() - 1; i >= 0; i--) {
                WindowState win = windows.get(i);
                if (!mPolicy.isKeyguardHostWindow(win.mAttrs)) {
@@ -331,8 +310,7 @@ public class WindowAnimator {

                        // Create a new animation to delay until keyguard is gone on its own.
                        winAnimator.mAnimation = new AlphaAnimation(1.0f, 1.0f);
                        winAnimator.mAnimation.setDuration(mKeyguardBlurEnabled
                                ? 0 : KEYGUARD_ANIM_TIMEOUT_MS);
                        winAnimator.mAnimation.setDuration(KEYGUARD_ANIM_TIMEOUT_MS);
                        winAnimator.mAnimationIsEntrance = false;
                        winAnimator.mAnimationStartTime = -1;
                        winAnimator.mKeyguardGoingAwayAnimation = true;
@@ -409,8 +387,7 @@ public class WindowAnimator {
                        if (nowAnimating && win.mWinAnimator.mKeyguardGoingAwayAnimation) {
                            mForceHiding = KEYGUARD_ANIMATING_OUT;
                        } else {
                            mForceHiding = win.isDrawnLw() && !mKeyguardBlurEnabled
                                    ? KEYGUARD_SHOWN : KEYGUARD_NOT_SHOWN;
                            mForceHiding = win.isDrawnLw() ? KEYGUARD_SHOWN : KEYGUARD_NOT_SHOWN;
                        }
                    }
                    if (DEBUG_KEYGUARD || DEBUG_VISIBILITY) Slog.v(TAG,
@@ -1033,23 +1010,4 @@ public class WindowAnimator {
    void orAnimating(boolean animating) {
        mAnimating |= animating;
    }

    private class SettingsObserver extends ContentObserver {
        SettingsObserver(Handler handler) {
            super(handler);
        }

        void observe(Context context) {
            context.getContentResolver().registerContentObserver(
                    CMSettings.Secure.getUriFor(CMSettings.Secure.LOCK_SCREEN_BLUR_ENABLED),
                    false, this);
            onChange(true);
        }

        @Override
        public void onChange(boolean selfChange) {
            mKeyguardBlurEnabled = CMSettings.Secure.getInt(mContext.getContentResolver(),
                    CMSettings.Secure.LOCK_SCREEN_BLUR_ENABLED, 0) == 1;
        }
    }
}