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

Commit dfb7fb25 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Fixed some rotation while unlocking screen issue.

- Don't use snapshot that is in different orientation than the current
display orientation. This is a follow up to a previous CL whose
implementation wasn't complete.
- Disabled fixed for unnecessary relaunches when unlocking with
fingerprint sensor introduced in ag/2310557. This causes regression in
the experience from N. We still have the relaunches, but we cover up the
delay by displaying the apps starting window.
- Added more trace log points.

Fixes: 62796190
Fixes: 62904487
Bug: 38494778
Test: go/wm-smoke and manual verification of bug.
Change-Id: Id161a334cb4455dd9eb25c6bb63d5bb3f8a6f1f0
parent d406f38d
Loading
Loading
Loading
Loading
+24 −16
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.am;

import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER;
import static android.view.WindowManagerPolicy.KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS;
import static android.view.WindowManagerPolicy.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE;
import static android.view.WindowManagerPolicy.KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER;
@@ -34,6 +35,7 @@ import static com.android.server.wm.AppTransition.TRANSIT_UNSET;

import android.os.IBinder;
import android.os.RemoteException;
import android.os.Trace;
import android.util.Slog;

import com.android.internal.policy.IKeyguardDismissCallback;
@@ -111,7 +113,10 @@ class KeyguardController {
     *              etc.
     */
    void keyguardGoingAway(int flags) {
        if (mKeyguardShowing) {
        if (!mKeyguardShowing) {
            return;
        }
        Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "keyguardGoingAway");
        mWindowManager.deferSurfaceLayout();
        try {
            setKeyguardGoingAway(true);
@@ -125,8 +130,11 @@ class KeyguardController {
            mStackSupervisor.addStartingWindowsForVisibleActivities(true /* taskSwitch */);
            mWindowManager.executeAppTransition();
        } finally {
            Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "keyguardGoingAway: surfaceLayout");
            mWindowManager.continueSurfaceLayout();
            }
            Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);

            Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
        }
    }

+6 −4
Original line number Diff line number Diff line
@@ -614,8 +614,8 @@ public class AppWindowContainerController
            return STARTING_WINDOW_TYPE_SPLASH_SCREEN;
        } else if (taskSwitch && allowTaskSnapshot) {
            return snapshot == null ? STARTING_WINDOW_TYPE_NONE
                    : snapshotFillsWidth(snapshot) || fromRecents ? STARTING_WINDOW_TYPE_SNAPSHOT
                    : STARTING_WINDOW_TYPE_SPLASH_SCREEN;
                    : snapshotOrientationSameAsDisplay(snapshot) || fromRecents
                            ? STARTING_WINDOW_TYPE_SNAPSHOT : STARTING_WINDOW_TYPE_SPLASH_SCREEN;
        } else {
            return STARTING_WINDOW_TYPE_NONE;
        }
@@ -640,7 +640,7 @@ public class AppWindowContainerController
        return true;
    }

    private boolean snapshotFillsWidth(TaskSnapshot snapshot) {
    private boolean snapshotOrientationSameAsDisplay(TaskSnapshot snapshot) {
        if (snapshot == null) {
            return false;
        }
@@ -655,7 +655,9 @@ public class AppWindowContainerController
        mService.mPolicy.getStableInsetsLw(di.rotation, di.logicalWidth, di.logicalHeight,
                stableInsets);
        displayBounds.inset(stableInsets);
        return rect.width() >= displayBounds.width();
        final boolean snapshotInLandscape = rect.width() >= rect.height();
        final boolean displayInLandscape = displayBounds.width() >= displayBounds.height();
        return snapshotInLandscape == displayInLandscape;
    }

    public void removeStartingWindow() {
+4 −3
Original line number Diff line number Diff line
@@ -2940,9 +2940,10 @@ public class WindowManagerService extends IWindowManager.Stub
    }

    public void setKeyguardGoingAway(boolean keyguardGoingAway) {
        synchronized (mWindowMap) {
            mKeyguardGoingAway = keyguardGoingAway;
        }
// TODO: Use of this can be removed. Revert ag/I8369723d6a77f2c602f1ef080371fa7cd9ee094e
//        synchronized (mWindowMap) {
//            mKeyguardGoingAway = keyguardGoingAway;
//        }
    }

    // -------------------------------------------------------------