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

Commit 8a2b46d5 authored by Svetoslav's avatar Svetoslav Committed by Android (Google) Code Review
Browse files

Merge "Wrong constant used for undefined accessibility window id."

parents da5c13eb cbcc9695
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -5726,7 +5726,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @hide
     */
    public int getAccessibilityWindowId() {
        return mAttachInfo != null ? mAttachInfo.mAccessibilityWindowId : NO_ID;
        return mAttachInfo != null ? mAttachInfo.mAccessibilityWindowId
                : AccessibilityNodeInfo.UNDEFINED_ITEM_ID;
    }
    /**
@@ -19725,7 +19726,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        /**
         * The id of the window for accessibility purposes.
         */
        int mAccessibilityWindowId = View.NO_ID;
        int mAccessibilityWindowId = AccessibilityNodeInfo.UNDEFINED_ITEM_ID;
        /**
         * Flags related to accessibility processing.
+13 −28
Original line number Diff line number Diff line
@@ -397,9 +397,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
                return true; // yes, recycle the event
            }
            if (mSecurityPolicy.canDispatchAccessibilityEventLocked(event)) {
                mSecurityPolicy.updateActiveWindowLocked(event.getWindowId(), event.getEventType());
                mSecurityPolicy.updateEventSourceLocked(event);
                mMainHandler.obtainMessage(MainHandler.MSG_UPDATE_ACTIVE_WINDOW,
                        event.getWindowId(), event.getEventType()).sendToTarget();
                notifyAccessibilityServicesDelayedLocked(event, false);
                notifyAccessibilityServicesDelayedLocked(event, true);
            }
@@ -503,7 +502,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
                mGlobalWindowTokens.put(windowId, windowToken.asBinder());
                if (DEBUG) {
                    Slog.i(LOG_TAG, "Added global connection for pid:" + Binder.getCallingPid()
                            + " with windowId: " + windowId);
                            + " with windowId: " + windowId + " and  token: " + windowToken.asBinder());
                }
            } else {
                AccessibilityConnectionWrapper wrapper = new AccessibilityConnectionWrapper(
@@ -514,12 +513,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
                userState.mWindowTokens.put(windowId, windowToken.asBinder());
                if (DEBUG) {
                    Slog.i(LOG_TAG, "Added user connection for pid:" + Binder.getCallingPid()
                            + " with windowId: " + windowId + " and userId:" + mCurrentUserId);
                            + " with windowId: " + windowId + " and userId:" + mCurrentUserId
                            + " and  token: " + windowToken.asBinder());
                }
            }
            if (DEBUG) {
                Slog.i(LOG_TAG, "Adding interaction connection to windowId: " + windowId);
            }
            return windowId;
        }
    }
@@ -534,7 +531,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
            if (removedWindowId >= 0) {
                if (DEBUG) {
                    Slog.i(LOG_TAG, "Removed global connection for pid:" + Binder.getCallingPid()
                            + " with windowId: " + removedWindowId);
                            + " with windowId: " + removedWindowId + " and token: " + window.asBinder());
                }
                return;
            }
@@ -548,7 +545,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
                    if (DEBUG) {
                        Slog.i(LOG_TAG, "Removed user connection for pid:" + Binder.getCallingPid()
                                + " with windowId: " + removedWindowIdForUser + " and userId:"
                                + mUserStates.keyAt(i));
                                + mUserStates.keyAt(i) + " and token: " + window.asBinder());
                    }
                    return;
                }
@@ -1622,7 +1619,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
        public static final int MSG_SEND_ACCESSIBILITY_EVENT_TO_INPUT_FILTER = 1;
        public static final int MSG_SEND_STATE_TO_CLIENTS = 2;
        public static final int MSG_SEND_CLEARED_STATE_TO_CLIENTS_FOR_USER = 3;
        public static final int MSG_UPDATE_ACTIVE_WINDOW = 4;
        public static final int MSG_ANNOUNCE_NEW_USER_IF_NEEDED = 5;
        public static final int MSG_UPDATE_INPUT_FILTER = 6;
        public static final int MSG_SHOW_ENABLED_TOUCH_EXPLORATION_DIALOG = 7;
@@ -1669,12 +1665,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
                    sendStateToClientsForUser(0, userId);
                } break;

                case MSG_UPDATE_ACTIVE_WINDOW: {
                    final int windowId = msg.arg1;
                    final int eventType = msg.arg2;
                    mSecurityPolicy.updateActiveWindow(windowId, eventType);
                } break;

                case MSG_ANNOUNCE_NEW_USER_IF_NEEDED: {
                    announceNewUserIfNeeded();
                } break;
@@ -3168,7 +3158,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
            }
        }

        public void updateActiveWindow(int windowId, int eventType) {
        public void updateActiveWindowLocked(int windowId, int eventType) {
            // The active window is either the window that has input focus or
            // the window that the user is currently touching. If the user is
            // touching a window that does not have input focus as soon as the
@@ -3185,19 +3175,12 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
                    // what the focused window is to update the active one.
                    // The active window also determined events from which
                    // windows are delivered.
                    boolean focusedWindowActive = false;
                    synchronized (mLock) {
                        if (mWindowsForAccessibilityCallback == null) {
                            focusedWindowActive = true;
                        }
                    }
                    if (focusedWindowActive) {
                        if (windowId == getFocusedWindowId()) {
                    synchronized (mLock) {
                        if (mWindowsForAccessibilityCallback == null
                                && windowId == getFocusedWindowId()) {
                            mActiveWindowId = windowId;
                        }
                    }
                    }
                } break;

                case AccessibilityEvent.TYPE_VIEW_HOVER_ENTER: {
@@ -3337,9 +3320,11 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {

        private int getFocusedWindowId() {
            IBinder token = mWindowManagerService.getFocusedWindowToken();
            synchronized (mLock) {
                return findWindowIdLocked(token);
            }
        }
    }

    private class UserState {
        public final int mUserId;