Skip to content
Snippets Groups Projects
Commit 5a22666b authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "AccessibilityWindowsPopulator:fix CWE problem by add mLock in dump...

Merge "AccessibilityWindowsPopulator:fix CWE problem by add mLock in dump method." into main am: ef549343

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3109838



Change-Id: I58c24b9d03135d5d981eb6936a11afa3a1d19169
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 5a5fb36a ef549343
No related branches found
No related tags found
No related merge requests found
......@@ -562,32 +562,35 @@ public final class AccessibilityWindowsPopulator extends WindowInfosListener {
}
void dump(PrintWriter pw, String prefix) {
pw.print(prefix); pw.println("AccessibilityWindowsPopulator");
String prefix2 = prefix + " ";
synchronized (mLock) {
pw.print(prefix); pw.println("AccessibilityWindowsPopulator");
String prefix2 = prefix + " ";
pw.print(prefix2); pw.print("mWindowsNotificationEnabled: ");
pw.println(mWindowsNotificationEnabled);
pw.print(prefix2); pw.print("mWindowsNotificationEnabled: ");
pw.println(mWindowsNotificationEnabled);
if (mVisibleWindows.isEmpty()) {
pw.print(prefix2); pw.println("No visible windows");
} else {
pw.print(prefix2); pw.print(mVisibleWindows.size());
pw.print(" visible windows: "); pw.println(mVisibleWindows);
}
KeyDumper noKeyDumper = (i, k) -> {}; // display id is already shown on value;
KeyDumper displayDumper = (i, d) -> pw.printf("%sDisplay #%d: ", prefix, d);
// Ideally magnificationSpecDumper should use spec.dump(pw), but there is no such method
ValueDumper<MagnificationSpec> magnificationSpecDumper = spec -> pw.print(spec);
dumpSparseArray(pw, prefix2, mDisplayInfos, "display info", noKeyDumper, d -> pw.print(d));
dumpSparseArray(pw, prefix2, mInputWindowHandlesOnDisplays, "window handles on display",
displayDumper, list -> pw.print(list));
dumpSparseArray(pw, prefix2, mMagnificationSpecInverseMatrix, "magnification spec matrix",
noKeyDumper, matrix -> matrix.dump(pw));
dumpSparseArray(pw, prefix2, mCurrentMagnificationSpec, "current magnification spec",
noKeyDumper, magnificationSpecDumper);
dumpSparseArray(pw, prefix2, mPreviousMagnificationSpec, "previous magnification spec",
noKeyDumper, magnificationSpecDumper);
if (mVisibleWindows.isEmpty()) {
pw.print(prefix2); pw.println("No visible windows");
} else {
pw.print(prefix2); pw.print(mVisibleWindows.size());
pw.print(" visible windows: "); pw.println(mVisibleWindows);
}
KeyDumper noKeyDumper = (i, k) -> {}; // display id is already shown on value;
KeyDumper displayDumper = (i, d) -> pw.printf("%sDisplay #%d: ", prefix, d);
// Ideally magnificationSpecDumper should use spec.dump(pw), but there is no such method
ValueDumper<MagnificationSpec> magnificationSpecDumper = spec -> pw.print(spec);
dumpSparseArray(pw, prefix2, mDisplayInfos,
"display info", noKeyDumper, d -> pw.print(d));
dumpSparseArray(pw, prefix2, mInputWindowHandlesOnDisplays,
"window handles on display", displayDumper, list -> pw.print(list));
dumpSparseArray(pw, prefix2, mMagnificationSpecInverseMatrix,
"magnification spec matrix", noKeyDumper, matrix -> matrix.dump(pw));
dumpSparseArray(pw, prefix2, mCurrentMagnificationSpec,
"current magnification spec", noKeyDumper, magnificationSpecDumper);
dumpSparseArray(pw, prefix2, mPreviousMagnificationSpec,
"previous magnification spec", noKeyDumper, magnificationSpecDumper);
}
}
@GuardedBy("mLock")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment