Merge "Hook-up the accessibility (magnifier) ontransition cb to shell"

This commit is contained in:
Evan Rosky
2023-02-06 18:34:11 +00:00
committed by Android (Google) Code Review
2 changed files with 39 additions and 0 deletions

View File

@@ -342,6 +342,18 @@ final class AccessibilityController {
// Not relevant for the window observer.
}
void onWMTransition(int displayId, @WindowManager.TransitionType int type) {
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
mAccessibilityTracing.logTrace(TAG + ".onAppWindowTransition",
FLAGS_MAGNIFICATION_CALLBACK, "displayId=" + displayId + "; type=" + type);
}
final DisplayMagnifier displayMagnifier = mDisplayMagnifiers.get(displayId);
if (displayMagnifier != null) {
displayMagnifier.onWMTransition(displayId, type);
}
// Not relevant for the window observer.
}
void onWindowTransition(WindowState windowState, int transition) {
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK
| FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK)) {
@@ -708,6 +720,28 @@ final class AccessibilityController {
}
}
void onWMTransition(int displayId, @WindowManager.TransitionType int type) {
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
mAccessibilityTracing.logTrace(LOG_TAG + ".onWMTransition",
FLAGS_MAGNIFICATION_CALLBACK, "displayId=" + displayId + "; type=" + type);
}
if (DEBUG_WINDOW_TRANSITIONS) {
Slog.i(LOG_TAG, "Window transition: " + WindowManager.transitTypeToString(type)
+ " displayId: " + displayId);
}
final boolean magnifying = mMagnifedViewport.isMagnifying();
if (magnifying) {
// All opening/closing situations.
switch (type) {
case WindowManager.TRANSIT_OPEN:
case WindowManager.TRANSIT_TO_FRONT:
case WindowManager.TRANSIT_CLOSE:
case WindowManager.TRANSIT_TO_BACK:
mHandler.sendEmptyMessage(MyHandler.MESSAGE_NOTIFY_USER_CONTEXT_CHANGED);
}
}
}
void onWindowTransition(WindowState windowState, int transition) {
if (mAccessibilityTracing.isTracingEnabled(FLAGS_MAGNIFICATION_CALLBACK)) {
mAccessibilityTracing.logTrace(LOG_TAG + ".onWindowTransition",

View File

@@ -1136,6 +1136,11 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
// client, we should finish and apply it here so the transactions aren't lost.
postCleanupOnFailure();
}
final AccessibilityController accessibilityController =
dc.mWmService.mAccessibilityController;
if (accessibilityController.hasCallbacks()) {
accessibilityController.onWMTransition(dc.getDisplayId(), mType);
}
} else {
// No player registered or it's not enabled, so just finish/apply immediately
if (!mIsPlayerEnabled) {