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

Notifies the magnifier stuff that a transition is happening so
it can, in turn, notify some observer

Bug: 267646116
Test: open an app with magnifier enabled
Change-Id: Icf6e4ce937dcd804b483091bd995ec7b40d7384e
This commit is contained in:
Evan Rosky
2023-02-02 14:07:45 -08:00
parent 1e98008195
commit 3cd02c2b03
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

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