diff options
4 files changed, 28 insertions, 11 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index f765620a2eb9..0fb85d25cf1a 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -1342,6 +1342,7 @@ public class Activity extends ContextThemeWrapper if (DEBUG_LIFECYCLE) Slog.v(TAG, "onResume " + this); getApplication().dispatchActivityResumed(this); mActivityTransitionState.onResume(this, isTopOfTask()); + enableAutofillCompatibilityIfNeeded(); if (mAutoFillResetNeeded) { if (!mAutoFillIgnoreFirstResumePause) { View focus = getCurrentFocus(); @@ -7108,7 +7109,6 @@ public class Activity extends ContextThemeWrapper mWindow.setColorMode(info.colorMode); setAutofillCompatibilityEnabled(application.isAutofillCompatibilityEnabled()); - enableAutofillCompatibilityIfNeeded(); } private void enableAutofillCompatibilityIfNeeded() { diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index d21cb3e64b8c..8b3ce42b076b 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -44,6 +44,7 @@ import android.service.autofill.UserData; import android.util.ArrayMap; import android.util.ArraySet; import android.util.Log; +import android.util.Slog; import android.util.SparseArray; import android.view.Choreographer; import android.view.KeyEvent; @@ -548,6 +549,9 @@ public final class AutofillManager { // different bridge based on which activity is currently focused // in the current process. Since compat would be rarely used, just // create and register a new instance every time. + if (sDebug) { + Slog.d(TAG, "creating CompatibilityBridge for " + mContext); + } mCompatibilityBridge = new CompatibilityBridge(); } } diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 2941e93d12dc..22ac65df4337 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -400,6 +400,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo private MagnificationSpec mMagnificationSpec; + /** Caches the value whether told display manager that we have content. */ + private boolean mLastHasContent; + private final Consumer<WindowState> mUpdateWindowsForAnimator = w -> { WindowStateAnimator winAnimator = w.mWinAnimator; final AppWindowToken atoken = w.mAppToken; @@ -2916,8 +2919,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo forAllWindows(mApplySurfaceChangesTransaction, true /* traverseTopToBottom */); prepareSurfaces(); + mLastHasContent = mTmpApplySurfaceChangesTransactionState.displayHasContent; mService.mDisplayManagerInternal.setDisplayProperties(mDisplayId, - mTmpApplySurfaceChangesTransactionState.displayHasContent, + mLastHasContent, mTmpApplySurfaceChangesTransactionState.preferredRefreshRate, mTmpApplySurfaceChangesTransactionState.preferredModeId, true /* inTraversal, must call performTraversalInTrans... below */); @@ -4052,4 +4056,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo private boolean canUpdateImeTarget() { return mDeferUpdateImeTargetCount == 0; } + + /** + * @return Cached value whether we told display manager that we have content. + */ + boolean getLastHasContent() { + return mLastHasContent; + } } diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index 08b8150fbc6f..c56c3035e127 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -1185,15 +1185,17 @@ class WindowStateAnimator { if (mIsWallpaper) { w.dispatchWallpaperVisibility(true); } - // This draw means the difference between unique content and mirroring. - // Run another pass through performLayout to set mHasContent in the - // LogicalDisplay. - mAnimator.setPendingLayoutChanges(w.getDisplayId(), - FINISH_LAYOUT_REDO_ANIM); - if (DEBUG_LAYOUT_REPEATS) { - mService.mWindowPlacerLocked.debugLayoutRepeats( - "showSurfaceRobustlyLocked " + w, - mAnimator.getPendingLayoutChanges(w.getDisplayId())); + if (!w.getDisplayContent().getLastHasContent()) { + // This draw means the difference between unique content and mirroring. + // Run another pass through performLayout to set mHasContent in the + // LogicalDisplay. + mAnimator.setPendingLayoutChanges(w.getDisplayId(), + FINISH_LAYOUT_REDO_ANIM); + if (DEBUG_LAYOUT_REPEATS) { + mService.mWindowPlacerLocked.debugLayoutRepeats( + "showSurfaceRobustlyLocked " + w, + mAnimator.getPendingLayoutChanges(w.getDisplayId())); + } } } else { w.setOrientationChanging(false); |