Merge "Reduce computing unused ChangeInfo in Transition" into tm-qpr-dev
This commit is contained in:
@@ -341,7 +341,11 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {
|
||||
if (childArea == null) {
|
||||
continue;
|
||||
}
|
||||
pw.println(prefix + "* " + childArea.getName());
|
||||
pw.print(prefix + "* " + childArea.getName());
|
||||
if (childArea.isOrganized()) {
|
||||
pw.print(" (organized)");
|
||||
}
|
||||
pw.println();
|
||||
if (childArea.isTaskDisplayArea()) {
|
||||
// TaskDisplayArea can only contain task. And it is already printed by display.
|
||||
continue;
|
||||
|
||||
@@ -3458,9 +3458,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
|
||||
@Override
|
||||
public void dump(PrintWriter pw, String prefix, boolean dumpAll) {
|
||||
super.dump(pw, prefix, dumpAll);
|
||||
pw.print(prefix);
|
||||
pw.println("Display: mDisplayId=" + mDisplayId + " rootTasks=" + getRootTaskCount());
|
||||
pw.println("Display: mDisplayId=" + mDisplayId + (isOrganized() ? " (organized)" : ""));
|
||||
final String subPrefix = " " + prefix;
|
||||
pw.print(subPrefix); pw.print("init="); pw.print(mInitialDisplayWidth); pw.print("x");
|
||||
pw.print(mInitialDisplayHeight); pw.print(" "); pw.print(mInitialDisplayDensity);
|
||||
@@ -3491,6 +3490,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
pw.println(" mTouchExcludeRegion=" + mTouchExcludeRegion);
|
||||
|
||||
pw.println();
|
||||
super.dump(pw, prefix, dumpAll);
|
||||
pw.print(prefix); pw.print("mLayoutSeq="); pw.println(mLayoutSeq);
|
||||
|
||||
pw.print(" mCurrentFocus="); pw.println(mCurrentFocus);
|
||||
@@ -3582,6 +3582,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
pw.println();
|
||||
mInsetsStateController.dump(prefix, pw);
|
||||
mDwpcHelper.dump(prefix, pw);
|
||||
pw.println();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3457,7 +3457,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
|
||||
final DisplayContent display = getChildAt(i);
|
||||
display.dump(pw, prefix, dumpAll);
|
||||
}
|
||||
pw.println();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -167,9 +167,9 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
|
||||
private SurfaceControl.Transaction mFinishTransaction = null;
|
||||
|
||||
/**
|
||||
* Contains change infos for both participants and all ancestors. We have to track ancestors
|
||||
* because they are all promotion candidates and thus we need their start-states
|
||||
* to be captured.
|
||||
* Contains change infos for both participants and all remote-animatable ancestors. The
|
||||
* ancestors can be the promotion candidates so their start-states need to be captured.
|
||||
* @see #getAnimatableParent
|
||||
*/
|
||||
final ArrayMap<WindowContainer, ChangeInfo> mChanges = new ArrayMap<>();
|
||||
|
||||
@@ -417,8 +417,9 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
|
||||
mSyncId, wc);
|
||||
// "snapshot" all parents (as potential promotion targets). Do this before checking
|
||||
// if this is already a participant in case it has since been re-parented.
|
||||
for (WindowContainer curr = wc.getParent(); curr != null && !mChanges.containsKey(curr);
|
||||
curr = curr.getParent()) {
|
||||
for (WindowContainer<?> curr = getAnimatableParent(wc);
|
||||
curr != null && !mChanges.containsKey(curr);
|
||||
curr = getAnimatableParent(curr)) {
|
||||
mChanges.put(curr, new ChangeInfo(curr));
|
||||
if (isReadyGroup(curr)) {
|
||||
mReadyTracker.addGroup(curr);
|
||||
@@ -1299,6 +1300,16 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/** Returns the parent that the remote animator can animate or control. */
|
||||
private static WindowContainer<?> getAnimatableParent(WindowContainer<?> wc) {
|
||||
WindowContainer<?> parent = wc.getParent();
|
||||
while (parent != null
|
||||
&& (!parent.canCreateRemoteAnimationTarget() && !parent.isOrganized())) {
|
||||
parent = parent.getParent();
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
private static boolean reportIfNotTop(WindowContainer wc) {
|
||||
// Organized tasks need to be reported anyways because Core won't show() their surfaces
|
||||
// and we can't rely on onTaskAppeared because it isn't in sync.
|
||||
@@ -1522,7 +1533,8 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
|
||||
intermediates.clear();
|
||||
boolean foundParentInTargets = false;
|
||||
// Collect the intermediate parents between target and top changed parent.
|
||||
for (WindowContainer<?> p = wc.getParent(); p != null; p = p.getParent()) {
|
||||
for (WindowContainer<?> p = getAnimatableParent(wc); p != null;
|
||||
p = getAnimatableParent(p)) {
|
||||
final ChangeInfo parentChange = changes.get(p);
|
||||
if (parentChange == null || !parentChange.hasChanged(p)) break;
|
||||
if (p.mRemoteToken == null) {
|
||||
|
||||
@@ -113,12 +113,6 @@ class WallpaperController {
|
||||
|
||||
private boolean mShouldUpdateZoom;
|
||||
|
||||
/**
|
||||
* Temporary storage for taking a screenshot of the wallpaper.
|
||||
* @see #screenshotWallpaperLocked()
|
||||
*/
|
||||
private WindowState mTmpTopWallpaper;
|
||||
|
||||
@Nullable private Point mLargestDisplaySize = null;
|
||||
|
||||
private final FindWallpaperTargetResult mFindResults = new FindWallpaperTargetResult();
|
||||
@@ -962,21 +956,16 @@ class WallpaperController {
|
||||
}
|
||||
|
||||
WindowState getTopVisibleWallpaper() {
|
||||
mTmpTopWallpaper = null;
|
||||
|
||||
for (int curTokenNdx = mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) {
|
||||
final WallpaperWindowToken token = mWallpaperTokens.get(curTokenNdx);
|
||||
token.forAllWindows(w -> {
|
||||
final WindowStateAnimator winAnim = w.mWinAnimator;
|
||||
if (winAnim != null && winAnim.getShown() && winAnim.mLastAlpha > 0f) {
|
||||
mTmpTopWallpaper = w;
|
||||
return true;
|
||||
for (int i = token.getChildCount() - 1; i >= 0; i--) {
|
||||
final WindowState w = token.getChildAt(i);
|
||||
if (w.mWinAnimator.getShown() && w.mWinAnimator.mLastAlpha > 0f) {
|
||||
return w;
|
||||
}
|
||||
return false;
|
||||
}, true /* traverseTopToBottom */);
|
||||
}
|
||||
}
|
||||
|
||||
return mTmpTopWallpaper;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -476,6 +476,8 @@ public class TransitionTests extends WindowTestsBase {
|
||||
wallpaperWindow.mHasSurface = true;
|
||||
doReturn(true).when(mDisplayContent).isAttached();
|
||||
transition.collect(mDisplayContent);
|
||||
assertFalse("The change of non-interesting window container should be skipped",
|
||||
transition.mChanges.containsKey(mDisplayContent.getParent()));
|
||||
mDisplayContent.getWindowConfiguration().setRotation(
|
||||
(mDisplayContent.getWindowConfiguration().getRotation() + 1) % 4);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user