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

Commit 89043e2e authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Hide keyguard earlier when exiting lockscreen" into udc-dev am: 049923ce

parents 8482827b 049923ce
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -2426,7 +2426,7 @@ public final class ViewRootImpl implements ViewParent,
     *
     *
     * @hide
     * @hide
     */
     */
    void notifyRendererOfExpensiveFrame() {
    public void notifyRendererOfExpensiveFrame() {
        if (mAttachInfo.mThreadedRenderer != null) {
        if (mAttachInfo.mThreadedRenderer != null) {
            mAttachInfo.mThreadedRenderer.notifyExpensiveFrame();
            mAttachInfo.mThreadedRenderer.notifyExpensiveFrame();
        }
        }
+32 −0
Original line number Original line Diff line number Diff line
@@ -29,13 +29,17 @@ import android.os.IBinder;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.StrictMode;
import android.os.StrictMode;
import android.os.SystemProperties;
import android.os.SystemProperties;
import android.os.Trace;
import android.view.Choreographer;
import android.view.Choreographer;
import android.view.View;
import android.view.ViewRootImpl;


import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.util.Assert;
import com.android.systemui.util.Assert;


import java.util.ArrayList;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.HashSet;
import java.util.Random;
import java.util.Stack;
import java.util.Stack;
import java.util.function.Supplier;
import java.util.function.Supplier;


@@ -43,12 +47,14 @@ import java.util.function.Supplier;
 * Utility class for methods used to dejank the UI.
 * Utility class for methods used to dejank the UI.
 */
 */
public class DejankUtils {
public class DejankUtils {
    private static final String TRACK_NAME = "DejankUtils";


    public static final boolean STRICT_MODE_ENABLED = Build.IS_ENG
    public static final boolean STRICT_MODE_ENABLED = Build.IS_ENG
            || SystemProperties.getBoolean("persist.sysui.strictmode", false);
            || SystemProperties.getBoolean("persist.sysui.strictmode", false);
    private static final Choreographer sChoreographer = Choreographer.getInstance();
    private static final Choreographer sChoreographer = Choreographer.getInstance();
    private static final Handler sHandler = new Handler();
    private static final Handler sHandler = new Handler();
    private static final ArrayList<Runnable> sPendingRunnables = new ArrayList<>();
    private static final ArrayList<Runnable> sPendingRunnables = new ArrayList<>();
    private static final Random sRandom = new Random();
    private static Stack<String> sBlockingIpcs = new Stack<>();
    private static Stack<String> sBlockingIpcs = new Stack<>();
    private static boolean sTemporarilyIgnoreStrictMode;
    private static boolean sTemporarilyIgnoreStrictMode;
    private static final HashSet<String> sWhitelistedFrameworkClasses = new HashSet<>();
    private static final HashSet<String> sWhitelistedFrameworkClasses = new HashSet<>();
@@ -254,4 +260,30 @@ public class DejankUtils {
    public static void setImmediate(boolean immediate) {
    public static void setImmediate(boolean immediate) {
        sImmediate = immediate;
        sImmediate = immediate;
    }
    }

    /**
     * Calls notifyRendererOfExpensiveFrame on the ViewRootImpl after performing null checks.
     */
    public static void notifyRendererOfExpensiveFrame(View view, String reason) {
        if (view == null) return;
        notifyRendererOfExpensiveFrame(view.getViewRootImpl(), reason);
    }

    /**
     * Calls notifyRendererOfExpensiveFrame on the ViewRootImpl after performing null checks.
     */
    public static void notifyRendererOfExpensiveFrame(ViewRootImpl viewRoot, String reason) {
        if (viewRoot == null) return;
        if (Trace.isTagEnabled(Trace.TRACE_TAG_APP)) {
            int cookie = sRandom.nextInt();
            Trace.asyncTraceForTrackBegin(
                    Trace.TRACE_TAG_APP,
                    TRACK_NAME,
                    "notifyRendererOfExpensiveFrame (" + reason + ")",
                    cookie);
            DejankUtils.postAfterTraversal(
                    () -> Trace.asyncTraceForTrackEnd(Trace.TRACE_TAG_APP, TRACK_NAME, cookie));
        }
        viewRoot.notifyRendererOfExpensiveFrame();
    }
}
}
+5 −2
Original line number Original line Diff line number Diff line
@@ -182,7 +182,8 @@ public class KeyguardService extends Service {


    // Wrap Keyguard going away animation.
    // Wrap Keyguard going away animation.
    // Note: Also used for wrapping occlude by Dream animation. It works (with some redundancy).
    // Note: Also used for wrapping occlude by Dream animation. It works (with some redundancy).
    public static IRemoteTransition wrap(IRemoteAnimationRunner runner) {
    public static IRemoteTransition wrap(IRemoteAnimationRunner runner,
            boolean lockscreenLiveWallpaperEnabled) {
        return new IRemoteTransition.Stub() {
        return new IRemoteTransition.Stub() {


            private final ArrayMap<SurfaceControl, SurfaceControl> mLeashMap = new ArrayMap<>();
            private final ArrayMap<SurfaceControl, SurfaceControl> mLeashMap = new ArrayMap<>();
@@ -213,7 +214,9 @@ public class KeyguardService extends Service {
                        }
                        }
                    }
                    }
                    initAlphaForAnimationTargets(t, apps);
                    initAlphaForAnimationTargets(t, apps);
                    if (lockscreenLiveWallpaperEnabled) {
                        initAlphaForAnimationTargets(t, wallpapers);
                        initAlphaForAnimationTargets(t, wallpapers);
                    }
                    t.apply();
                    t.apply();
                    mFinishCallback = finishCallback;
                    mFinishCallback = finishCallback;
                    runner.onAnimationStart(
                    runner.onAnimationStart(
+8 −4
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.keyguard
import android.animation.Animator
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.AnimatorListenerAdapter
import android.animation.ValueAnimator
import android.animation.ValueAnimator
import android.app.WallpaperManager
import android.content.Context
import android.content.Context
import android.graphics.Matrix
import android.graphics.Matrix
import android.graphics.Rect
import android.graphics.Rect
@@ -148,7 +149,8 @@ class KeyguardUnlockAnimationController @Inject constructor(
    private val biometricUnlockControllerLazy: Lazy<BiometricUnlockController>,
    private val biometricUnlockControllerLazy: Lazy<BiometricUnlockController>,
    private val statusBarStateController: SysuiStatusBarStateController,
    private val statusBarStateController: SysuiStatusBarStateController,
    private val notificationShadeWindowController: NotificationShadeWindowController,
    private val notificationShadeWindowController: NotificationShadeWindowController,
    private val powerManager: PowerManager
    private val powerManager: PowerManager,
    private val wallpaperManager: WallpaperManager
) : KeyguardStateController.Callback, ISysuiUnlockAnimationController.Stub() {
) : KeyguardStateController.Callback, ISysuiUnlockAnimationController.Stub() {


    interface KeyguardUnlockAnimationListener {
    interface KeyguardUnlockAnimationListener {
@@ -686,8 +688,10 @@ class KeyguardUnlockAnimationController @Inject constructor(
                return@postDelayed
                return@postDelayed
            }
            }


            if (wallpaperTargets != null) {
            if ((wallpaperTargets?.isNotEmpty() == true) &&
                    wallpaperManager.isLockscreenLiveWallpaperEnabled()) {
                fadeInWallpaper()
                fadeInWallpaper()
                hideKeyguardViewAfterRemoteAnimation()
            } else {
            } else {
                keyguardViewMediator.get().exitKeyguardAndFinishSurfaceBehindRemoteAnimation(
                keyguardViewMediator.get().exitKeyguardAndFinishSurfaceBehindRemoteAnimation(
                    false /* cancelled */)
                    false /* cancelled */)
@@ -961,7 +965,7 @@ class KeyguardUnlockAnimationController @Inject constructor(
                0 /* fadeOutDuration */
                0 /* fadeOutDuration */
            )
            )
        } else {
        } else {
            Log.e(TAG, "#hideKeyguardViewAfterRemoteAnimation called when keyguard view is not " +
            Log.i(TAG, "#hideKeyguardViewAfterRemoteAnimation called when keyguard view is not " +
                    "showing. Ignoring...")
                    "showing. Ignoring...")
        }
        }
    }
    }
+15 −4
Original line number Original line Diff line number Diff line
@@ -45,6 +45,7 @@ import android.app.AlarmManager;
import android.app.BroadcastOptions;
import android.app.BroadcastOptions;
import android.app.PendingIntent;
import android.app.PendingIntent;
import android.app.StatusBarManager;
import android.app.StatusBarManager;
import android.app.WallpaperManager;
import android.app.WindowConfiguration;
import android.app.WindowConfiguration;
import android.app.trust.TrustManager;
import android.app.trust.TrustManager;
import android.content.BroadcastReceiver;
import android.content.BroadcastReceiver;
@@ -280,6 +281,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
    private AlarmManager mAlarmManager;
    private AlarmManager mAlarmManager;
    private AudioManager mAudioManager;
    private AudioManager mAudioManager;
    private StatusBarManager mStatusBarManager;
    private StatusBarManager mStatusBarManager;
    private WallpaperManager mWallpaperManager;
    private final IStatusBarService mStatusBarService;
    private final IStatusBarService mStatusBarService;
    private final IBinder mStatusBarDisableToken = new Binder();
    private final IBinder mStatusBarDisableToken = new Binder();
    private final UserTracker mUserTracker;
    private final UserTracker mUserTracker;
@@ -1350,11 +1352,12 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
            setShowingLocked(false /* showing */, true /* forceCallbacks */);
            setShowingLocked(false /* showing */, true /* forceCallbacks */);
        }
        }


        boolean isLockscreenLwpEnabled = getWallpaperManager().isLockscreenLiveWallpaperEnabled();
        mKeyguardTransitions.register(
        mKeyguardTransitions.register(
                KeyguardService.wrap(getExitAnimationRunner()),
                KeyguardService.wrap(getExitAnimationRunner(), isLockscreenLwpEnabled),
                KeyguardService.wrap(getOccludeAnimationRunner()),
                KeyguardService.wrap(getOccludeAnimationRunner(), isLockscreenLwpEnabled),
                KeyguardService.wrap(getOccludeByDreamAnimationRunner()),
                KeyguardService.wrap(getOccludeByDreamAnimationRunner(), isLockscreenLwpEnabled),
                KeyguardService.wrap(getUnoccludeAnimationRunner()));
                KeyguardService.wrap(getUnoccludeAnimationRunner(), isLockscreenLwpEnabled));


        final ContentResolver cr = mContext.getContentResolver();
        final ContentResolver cr = mContext.getContentResolver();


@@ -1400,6 +1403,14 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
        mWorkLockController = new WorkLockActivityController(mContext, mUserTracker);
        mWorkLockController = new WorkLockActivityController(mContext, mUserTracker);
    }
    }


    // TODO(b/273443374) remove, temporary util to get a feature flag
    private WallpaperManager getWallpaperManager() {
        if (mWallpaperManager == null) {
            mWallpaperManager = mContext.getSystemService(WallpaperManager.class);
        }
        return mWallpaperManager;
    }

    @Override
    @Override
    public void start() {
    public void start() {
        synchronized (this) {
        synchronized (this) {
Loading