Add AccessibilityTracing and trace AccessibilityController.
The tracing is for a11y engineering team use for debugging purpose. It
is disabled by default and can be enabled only by shell command. The cl
for the shell command change will be submitted after this cl. See "Test"
section below for the command details.
Expose interface through WindowManagerInternal to allow a11y use the trace feature.
Bug: 157601519
Test: adb shell cmd accessibility start-trace
adb shell cmd accessibility stop-trace
Change-Id: I4cdb8798b29cd4a246db71d8cb17fe2c4429cd51
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -712,8 +712,7 @@ public class AppTransitionController {
|
||||
final AccessibilityController accessibilityController =
|
||||
mDisplayContent.mWmService.mAccessibilityController;
|
||||
if (accessibilityController != null) {
|
||||
accessibilityController.onAppWindowTransitionLocked(
|
||||
mDisplayContent.getDisplayId(), transit);
|
||||
accessibilityController.onAppWindowTransition(mDisplayContent.getDisplayId(), transit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1226,7 +1226,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
|
||||
if (mWmService.mAccessibilityController != null) {
|
||||
final int prevDisplayId = prevDc != null ? prevDc.getDisplayId() : INVALID_DISPLAY;
|
||||
mWmService.mAccessibilityController.onSomeWindowResizedOrMovedLocked(prevDisplayId,
|
||||
mWmService.mAccessibilityController.onSomeWindowResizedOrMoved(prevDisplayId,
|
||||
getDisplayId());
|
||||
}
|
||||
}
|
||||
@@ -1850,7 +1850,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
}
|
||||
|
||||
if (mWmService.mAccessibilityController != null) {
|
||||
mWmService.mAccessibilityController.onRotationChangedLocked(this);
|
||||
mWmService.mAccessibilityController.onRotationChanged(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3400,7 +3400,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
}
|
||||
|
||||
void updateAccessibilityOnWindowFocusChanged(AccessibilityController accessibilityController) {
|
||||
accessibilityController.onWindowFocusChangedNotLocked(getDisplayId());
|
||||
accessibilityController.onWindowFocusChangedNot(getDisplayId());
|
||||
}
|
||||
|
||||
private static void onWindowFocusChanged(WindowState oldFocus, WindowState newFocus) {
|
||||
@@ -4963,7 +4963,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
if (!mLocationInParentWindow.equals(x, y)) {
|
||||
mLocationInParentWindow.set(x, y);
|
||||
if (mWmService.mAccessibilityController != null) {
|
||||
mWmService.mAccessibilityController.onSomeWindowResizedOrMovedLocked(mDisplayId);
|
||||
mWmService.mAccessibilityController.onSomeWindowResizedOrMoved(mDisplayId);
|
||||
}
|
||||
notifyLocationInParentDisplayChanged();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class DockedStackDividerController {
|
||||
mTouchRegion.set(touchRegion);
|
||||
// We need to report touchable region changes to accessibility.
|
||||
if (mDisplayContent.mWmService.mAccessibilityController != null) {
|
||||
mDisplayContent.mWmService.mAccessibilityController.onSomeWindowResizedOrMovedLocked(
|
||||
mDisplayContent.mWmService.mAccessibilityController.onSomeWindowResizedOrMoved(
|
||||
mDisplayContent.getDisplayId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ public class ShellRoot {
|
||||
}
|
||||
}
|
||||
if (mDisplayContent.mWmService.mAccessibilityController != null) {
|
||||
mDisplayContent.mWmService.mAccessibilityController.onSomeWindowResizedOrMovedLocked(
|
||||
mDisplayContent.mWmService.mAccessibilityController.onSomeWindowResizedOrMoved(
|
||||
mDisplayContent.getDisplayId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ public class WindowAnimator {
|
||||
|
||||
dc.checkAppWindowsReadyToShow();
|
||||
if (accessibilityController != null) {
|
||||
accessibilityController.drawMagnifiedRegionBorderIfNeededLocked(displayId,
|
||||
accessibilityController.drawMagnifiedRegionBorderIfNeeded(displayId,
|
||||
mTransaction);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,41 @@ import java.util.List;
|
||||
*/
|
||||
public abstract class WindowManagerInternal {
|
||||
|
||||
/**
|
||||
* Interface for accessibility features implemented by AccessibilityController inside
|
||||
* WindowManager.
|
||||
*/
|
||||
public interface AccessibilityControllerInternal {
|
||||
/**
|
||||
* Enable the accessibility trace logging.
|
||||
*/
|
||||
void startTrace();
|
||||
|
||||
/**
|
||||
* Disable the accessibility trace logging.
|
||||
*/
|
||||
void stopTrace();
|
||||
|
||||
/**
|
||||
* Is trace enabled or not.
|
||||
*/
|
||||
boolean isEnabled();
|
||||
|
||||
/**
|
||||
* Add an accessibility trace entry.
|
||||
*
|
||||
* @param where A string to identify this log entry, which can be used to filter/search
|
||||
* through the tracing file.
|
||||
* @param callingParams The parameters for the method to be logged.
|
||||
* @param a11yDump The proto byte array for a11y state when the entry is generated.
|
||||
* @param callingUid The calling uid.
|
||||
* @param stackTrace The stack trace, null if not needed.
|
||||
*/
|
||||
void logTrace(
|
||||
String where, String callingParams, byte[] a11yDump, int callingUid,
|
||||
StackTraceElement[] stackTrace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface to receive a callback when the windows reported for
|
||||
* accessibility changed.
|
||||
@@ -206,6 +241,11 @@ public abstract class WindowManagerInternal {
|
||||
default void postCancelDragAndDrop() {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the interface to access features implemented by AccessibilityController.
|
||||
*/
|
||||
public abstract AccessibilityControllerInternal getAccessibilityController();
|
||||
|
||||
/**
|
||||
* Request that the window manager call
|
||||
* {@link DisplayManagerInternal#performTraversalInTransactionFromWindowManager}
|
||||
|
||||
@@ -2170,6 +2170,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
void setInsetsWindow(Session session, IWindow client, int touchableInsets, Rect contentInsets,
|
||||
Rect visibleInsets, Region touchableRegion) {
|
||||
int uid = Binder.getCallingUid();
|
||||
final long origId = Binder.clearCallingIdentity();
|
||||
try {
|
||||
synchronized (mGlobalLock) {
|
||||
@@ -2195,8 +2196,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
// We need to report touchable region changes to accessibility.
|
||||
if (mAccessibilityController != null) {
|
||||
mAccessibilityController.onSomeWindowResizedOrMovedLocked(
|
||||
w.getDisplayContent().getDisplayId());
|
||||
mAccessibilityController.onSomeWindowResizedOrMovedWithCallingUid(
|
||||
uid, w.getDisplayContent().getDisplayId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2210,7 +2211,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
if (mAccessibilityController != null) {
|
||||
WindowState window = mWindowMap.get(token);
|
||||
if (window != null) {
|
||||
mAccessibilityController.onRectangleOnScreenRequestedLocked(
|
||||
mAccessibilityController.onRectangleOnScreenRequested(
|
||||
window.getDisplayId(), rectangle);
|
||||
}
|
||||
}
|
||||
@@ -2313,8 +2314,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
if (((attrChanges & LayoutParams.ACCESSIBILITY_TITLE_CHANGED) != 0)
|
||||
&& (mAccessibilityController != null)) {
|
||||
// No move or resize, but the controller checks for title changes as well
|
||||
mAccessibilityController.onSomeWindowResizedOrMovedLocked(
|
||||
win.getDisplayContent().getDisplayId());
|
||||
mAccessibilityController.onSomeWindowResizedOrMovedWithCallingUid(
|
||||
uid, win.getDisplayContent().getDisplayId());
|
||||
}
|
||||
|
||||
if ((privateFlagChanges & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS) != 0) {
|
||||
@@ -2615,7 +2616,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
win.destroySurface(false, stopped);
|
||||
}
|
||||
if (mAccessibilityController != null) {
|
||||
mAccessibilityController.onWindowTransitionLocked(win, transit);
|
||||
mAccessibilityController.onWindowTransition(win, transit);
|
||||
}
|
||||
|
||||
return focusMayChange;
|
||||
@@ -7154,6 +7155,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
checkCallerOwnsDisplay(displayId);
|
||||
|
||||
synchronized (mGlobalLock) {
|
||||
int uid = Binder.getCallingUid();
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
final WindowState win = windowForClientLocked(null, client, false);
|
||||
@@ -7165,8 +7167,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
// Notifies AccessibilityController to re-compute the window observer of
|
||||
// this embedded display
|
||||
if (mAccessibilityController != null) {
|
||||
mAccessibilityController.handleWindowObserverOfEmbeddedDisplayLocked(displayId,
|
||||
win);
|
||||
mAccessibilityController.handleWindowObserverOfEmbeddedDisplay(
|
||||
displayId, win, uid);
|
||||
}
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
@@ -7531,6 +7533,12 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
private final class LocalService extends WindowManagerInternal {
|
||||
|
||||
@Override
|
||||
public AccessibilityControllerInternal getAccessibilityController() {
|
||||
return AccessibilityController.getAccessibilityControllerInternal(
|
||||
WindowManagerService.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearSnapshotCache() {
|
||||
synchronized (mGlobalLock) {
|
||||
@@ -7549,7 +7557,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
public void setMagnificationSpec(int displayId, MagnificationSpec spec) {
|
||||
synchronized (mGlobalLock) {
|
||||
if (mAccessibilityController != null) {
|
||||
mAccessibilityController.setMagnificationSpecLocked(displayId, spec);
|
||||
mAccessibilityController.setMagnificationSpec(displayId, spec);
|
||||
} else {
|
||||
throw new IllegalStateException("Magnification callbacks not set!");
|
||||
}
|
||||
@@ -7560,7 +7568,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
public void setForceShowMagnifiableBounds(int displayId, boolean show) {
|
||||
synchronized (mGlobalLock) {
|
||||
if (mAccessibilityController != null) {
|
||||
mAccessibilityController.setForceShowMagnifiableBoundsLocked(displayId, show);
|
||||
mAccessibilityController.setForceShowMagnifiableBounds(displayId, show);
|
||||
} else {
|
||||
throw new IllegalStateException("Magnification callbacks not set!");
|
||||
}
|
||||
@@ -7571,8 +7579,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
public void getMagnificationRegion(int displayId, @NonNull Region magnificationRegion) {
|
||||
synchronized (mGlobalLock) {
|
||||
if (mAccessibilityController != null) {
|
||||
mAccessibilityController.getMagnificationRegionLocked(displayId,
|
||||
magnificationRegion);
|
||||
mAccessibilityController.getMagnificationRegion(displayId, magnificationRegion);
|
||||
} else {
|
||||
throw new IllegalStateException("Magnification callbacks not set!");
|
||||
}
|
||||
@@ -7588,7 +7595,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
MagnificationSpec spec = null;
|
||||
if (mAccessibilityController != null) {
|
||||
spec = mAccessibilityController.getMagnificationSpecForWindowLocked(windowState);
|
||||
spec = mAccessibilityController.getMagnificationSpecForWindow(windowState);
|
||||
}
|
||||
if ((spec == null || spec.isNop()) && windowState.mGlobalScale == 1.0f) {
|
||||
return null;
|
||||
@@ -7610,9 +7617,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mAccessibilityController = new AccessibilityController(
|
||||
WindowManagerService.this);
|
||||
}
|
||||
boolean result = mAccessibilityController.setMagnificationCallbacksLocked(
|
||||
boolean result = mAccessibilityController.setMagnificationCallbacks(
|
||||
displayId, callbacks);
|
||||
if (!mAccessibilityController.hasCallbacksLocked()) {
|
||||
if (!mAccessibilityController.hasCallbacks()) {
|
||||
mAccessibilityController = null;
|
||||
}
|
||||
return result;
|
||||
@@ -7628,9 +7635,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
WindowManagerService.this);
|
||||
}
|
||||
final boolean result =
|
||||
mAccessibilityController.setWindowsForAccessibilityCallbackLocked(
|
||||
mAccessibilityController.setWindowsForAccessibilityCallback(
|
||||
displayId, callback);
|
||||
if (!mAccessibilityController.hasCallbacksLocked()) {
|
||||
if (!mAccessibilityController.hasCallbacks()) {
|
||||
mAccessibilityController = null;
|
||||
}
|
||||
return result;
|
||||
@@ -7819,7 +7826,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
accessibilityController = mAccessibilityController;
|
||||
}
|
||||
if (accessibilityController != null) {
|
||||
accessibilityController.performComputeChangedWindowsNotLocked(displayId, true);
|
||||
accessibilityController.performComputeChangedWindowsNot(displayId, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2021,7 +2021,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
final int winTransit = TRANSIT_EXIT;
|
||||
mWinAnimator.applyAnimationLocked(winTransit, false /* isEntrance */);
|
||||
if (accessibilityController != null) {
|
||||
accessibilityController.onWindowTransitionLocked(this, winTransit);
|
||||
accessibilityController.onWindowTransition(this, winTransit);
|
||||
}
|
||||
}
|
||||
setDisplayLayoutNeeded();
|
||||
@@ -2035,7 +2035,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
if (isVisibleNow()) {
|
||||
mWinAnimator.applyAnimationLocked(TRANSIT_EXIT, false);
|
||||
if (mWmService.mAccessibilityController != null) {
|
||||
mWmService.mAccessibilityController.onWindowTransitionLocked(this, TRANSIT_EXIT);
|
||||
mWmService.mAccessibilityController.onWindowTransition(this, TRANSIT_EXIT);
|
||||
}
|
||||
changed = true;
|
||||
if (displayContent != null) {
|
||||
@@ -2113,7 +2113,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
}
|
||||
|
||||
if (mWmService.mAccessibilityController != null) {
|
||||
mWmService.mAccessibilityController.onSomeWindowResizedOrMovedLocked(getDisplayId());
|
||||
mWmService.mAccessibilityController.onSomeWindowResizedOrMoved(getDisplayId());
|
||||
}
|
||||
updateLocationInParentDisplayIfNeeded();
|
||||
|
||||
@@ -2347,7 +2347,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
mWmService.requestTraversal();
|
||||
}
|
||||
if (mWmService.mAccessibilityController != null) {
|
||||
mWmService.mAccessibilityController.onWindowTransitionLocked(this, transit);
|
||||
mWmService.mAccessibilityController.onWindowTransition(this, transit);
|
||||
}
|
||||
}
|
||||
final boolean isAnimating = mAnimatingExit || isAnimating(TRANSITION | PARENTS,
|
||||
@@ -3679,7 +3679,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
displayId);
|
||||
|
||||
if (mWmService.mAccessibilityController != null) {
|
||||
mWmService.mAccessibilityController.onSomeWindowResizedOrMovedLocked(displayId);
|
||||
mWmService.mAccessibilityController.onSomeWindowResizedOrMoved(displayId);
|
||||
}
|
||||
updateLocationInParentDisplayIfNeeded();
|
||||
} catch (RemoteException e) {
|
||||
@@ -4782,7 +4782,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
return;
|
||||
}
|
||||
if (mWmService.mAccessibilityController != null) {
|
||||
mWmService.mAccessibilityController.onSomeWindowResizedOrMovedLocked(getDisplayId());
|
||||
mWmService.mAccessibilityController.onSomeWindowResizedOrMoved(getDisplayId());
|
||||
}
|
||||
|
||||
if (!isSelfOrAncestorWindowAnimatingExit()) {
|
||||
|
||||
@@ -946,7 +946,7 @@ class WindowStateAnimator {
|
||||
}
|
||||
|
||||
if (mService.mAccessibilityController != null) {
|
||||
mService.mAccessibilityController.onWindowTransitionLocked(mWin, transit);
|
||||
mService.mAccessibilityController.onWindowTransition(mWin, transit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user