Merge "Fixed some rotation while unlocking screen issue." into oc-dev

This commit is contained in:
TreeHugger Robot
2017-06-24 01:21:39 +00:00
committed by Android (Google) Code Review
3 changed files with 33 additions and 22 deletions

View File

@@ -17,6 +17,7 @@
package com.android.server.am; package com.android.server.am;
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID; 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_NO_WINDOW_ANIMATIONS;
import static android.view.WindowManagerPolicy.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE; import static android.view.WindowManagerPolicy.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE;
import static android.view.WindowManagerPolicy.KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER; 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.IBinder;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.Trace;
import android.util.Slog; import android.util.Slog;
import com.android.internal.policy.IKeyguardDismissCallback; import com.android.internal.policy.IKeyguardDismissCallback;
@@ -111,22 +113,28 @@ class KeyguardController {
* etc. * etc.
*/ */
void keyguardGoingAway(int flags) { void keyguardGoingAway(int flags) {
if (mKeyguardShowing) { if (!mKeyguardShowing) {
mWindowManager.deferSurfaceLayout(); return;
try { }
setKeyguardGoingAway(true); Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "keyguardGoingAway");
mWindowManager.prepareAppTransition(TRANSIT_KEYGUARD_GOING_AWAY, mWindowManager.deferSurfaceLayout();
false /* alwaysKeepCurrent */, convertTransitFlags(flags), try {
false /* forceOverride */); setKeyguardGoingAway(true);
mService.updateSleepIfNeededLocked(); mWindowManager.prepareAppTransition(TRANSIT_KEYGUARD_GOING_AWAY,
false /* alwaysKeepCurrent */, convertTransitFlags(flags),
false /* forceOverride */);
mService.updateSleepIfNeededLocked();
// Some stack visibility might change (e.g. docked stack) // Some stack visibility might change (e.g. docked stack)
mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS);
mStackSupervisor.addStartingWindowsForVisibleActivities(true /* taskSwitch */); mStackSupervisor.addStartingWindowsForVisibleActivities(true /* taskSwitch */);
mWindowManager.executeAppTransition(); mWindowManager.executeAppTransition();
} finally { } finally {
mWindowManager.continueSurfaceLayout(); Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "keyguardGoingAway: surfaceLayout");
} mWindowManager.continueSurfaceLayout();
Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
} }
} }

View File

@@ -614,8 +614,8 @@ public class AppWindowContainerController
return STARTING_WINDOW_TYPE_SPLASH_SCREEN; return STARTING_WINDOW_TYPE_SPLASH_SCREEN;
} else if (taskSwitch && allowTaskSnapshot) { } else if (taskSwitch && allowTaskSnapshot) {
return snapshot == null ? STARTING_WINDOW_TYPE_NONE return snapshot == null ? STARTING_WINDOW_TYPE_NONE
: snapshotFillsWidth(snapshot) || fromRecents ? STARTING_WINDOW_TYPE_SNAPSHOT : snapshotOrientationSameAsDisplay(snapshot) || fromRecents
: STARTING_WINDOW_TYPE_SPLASH_SCREEN; ? STARTING_WINDOW_TYPE_SNAPSHOT : STARTING_WINDOW_TYPE_SPLASH_SCREEN;
} else { } else {
return STARTING_WINDOW_TYPE_NONE; return STARTING_WINDOW_TYPE_NONE;
} }
@@ -640,7 +640,7 @@ public class AppWindowContainerController
return true; return true;
} }
private boolean snapshotFillsWidth(TaskSnapshot snapshot) { private boolean snapshotOrientationSameAsDisplay(TaskSnapshot snapshot) {
if (snapshot == null) { if (snapshot == null) {
return false; return false;
} }
@@ -655,7 +655,9 @@ public class AppWindowContainerController
mService.mPolicy.getStableInsetsLw(di.rotation, di.logicalWidth, di.logicalHeight, mService.mPolicy.getStableInsetsLw(di.rotation, di.logicalWidth, di.logicalHeight,
stableInsets); stableInsets);
displayBounds.inset(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() { public void removeStartingWindow() {

View File

@@ -2940,9 +2940,10 @@ public class WindowManagerService extends IWindowManager.Stub
} }
public void setKeyguardGoingAway(boolean keyguardGoingAway) { public void setKeyguardGoingAway(boolean keyguardGoingAway) {
synchronized (mWindowMap) { // TODO: Use of this can be removed. Revert ag/I8369723d6a77f2c602f1ef080371fa7cd9ee094e
mKeyguardGoingAway = keyguardGoingAway; // synchronized (mWindowMap) {
} // mKeyguardGoingAway = keyguardGoingAway;
// }
} }
// ------------------------------------------------------------- // -------------------------------------------------------------