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

Commit 5f77adfd authored by Guang Zhu's avatar Guang Zhu Committed by The Android Automerger
Browse files

Make UiTestAutomationBridge see non-important views again

This problem was introduced in I74df9c24. The intention of the
change was still let UiTestAutomationBridge see the
non-important views, but there were bugs in the implementation:

1. AccessibilityManagerService was not really updating
   mIncludeNotImportantViews when mIsAutomation is true

2. Wrong constant is used to set the flag

Change-Id: Ia0a2e9ed9720bd0ea3a563e0b492e870a6ec1586
parent 324acbf6
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -189,7 +189,7 @@ public class UiTestAutomationBridge {
        final AccessibilityServiceInfo info = new AccessibilityServiceInfo();
        info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;
        info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;
        info.flags |= AccessibilityNodeInfo.INCLUDE_NOT_IMPORTANT_VIEWS;
        info.flags |= AccessibilityServiceInfo.INCLUDE_NOT_IMPORTANT_VIEWS;

        try {
            manager.registerUiTestAutomationService(mListener, info);
+8 −11
Original line number Diff line number Diff line
@@ -1266,17 +1266,14 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
            mNotificationTimeout = info.notificationTimeout;
            mIsDefault = (info.flags & DEFAULT) != 0;

            if (!mIsAutomation) {
                final int targetSdkVersion =
                    info.getResolveInfo().serviceInfo.applicationInfo.targetSdkVersion;
            if (mIsAutomation || info.getResolveInfo().serviceInfo.applicationInfo.targetSdkVersion
                    // TODO: Uncomment this line and remove the line below when JellyBean
                    // SDK version is finalized.
                // if (targetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN) {
                if (targetSdkVersion > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
                    // >= Build.VERSION_CODES.JELLY_BEAN) {
                    > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
                mIncludeNotImportantViews =
                    (info.flags & INCLUDE_NOT_IMPORTANT_VIEWS) != 0;
            }
            }

            synchronized (mLock) {
                tryAddServiceLocked(this);