Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3cd02c2b authored by Evan Rosky's avatar Evan Rosky
Browse files

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
parent 1e980081
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -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",
+5 −0
Original line number Diff line number Diff line
@@ -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();