Merge "Allowing SurfaceViewHost to show up in layout inspector" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-04-07 09:28:47 +00:00
committed by Android (Google) Code Review

View File

@@ -216,10 +216,14 @@ public final class WindowManagerGlobal {
public String[] getViewRootNames() { public String[] getViewRootNames() {
synchronized (mLock) { synchronized (mLock) {
final int numRoots = mRoots.size(); final int numRoots = mRoots.size();
String[] mViewRoots = new String[numRoots]; final int windowlessRoots = mWindowlessRoots.size();
String[] mViewRoots = new String[numRoots + windowlessRoots];
for (int i = 0; i < numRoots; ++i) { for (int i = 0; i < numRoots; ++i) {
mViewRoots[i] = getWindowName(mRoots.get(i)); mViewRoots[i] = getWindowName(mRoots.get(i));
} }
for (int i = 0; i < windowlessRoots; ++i) {
mViewRoots[i + numRoots] = getWindowName(mWindowlessRoots.get(i));
}
return mViewRoots; return mViewRoots;
} }
} }
@@ -288,6 +292,10 @@ public final class WindowManagerGlobal {
final ViewRootImpl root = mRoots.get(i); final ViewRootImpl root = mRoots.get(i);
if (name.equals(getWindowName(root))) return root.getView(); if (name.equals(getWindowName(root))) return root.getView();
} }
for (int i = mWindowlessRoots.size() - 1; i >= 0; --i) {
final ViewRootImpl root = mWindowlessRoots.get(i);
if (name.equals(getWindowName(root))) return root.getView();
}
} }
return null; return null;