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

Commit c17f4944 authored by Felipe Leme's avatar Felipe Leme Committed by android-build-merger
Browse files

Merge "Implemented notifyViewClicked() on compat mode." into pi-dev

am: f99b1d8f

Change-Id: Iff367b925d93bb5796d13a048b1690e3477c5689
parents 3d92e55f f99b1d8f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -7978,6 +7978,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    private void onProvideVirtualStructureCompat(ViewStructure structure, boolean forAutofill) {
        final AccessibilityNodeProvider provider = getAccessibilityNodeProvider();
        if (provider != null) {
            if (android.view.autofill.Helper.sVerbose && forAutofill) {
                Log.v(VIEW_LOG_TAG, "onProvideVirtualStructureCompat() for " + this);
            }
            final AccessibilityNodeInfo info = createAccessibilityNodeInfo();
            structure.setChildCount(1);
            final ViewStructure root = structure.newChild(0);
+24 −0
Original line number Diff line number Diff line
@@ -986,6 +986,7 @@ public final class AutofillManager {
     * @param virtualId id identifying the virtual child inside the parent view.
     */
    public void notifyViewExited(@NonNull View view, int virtualId) {
        if (sVerbose) Log.v(TAG, "notifyViewExited(" + view.getAutofillId() + ", " + virtualId);
        if (!hasAutofillFeature()) {
            return;
        }
@@ -2190,6 +2191,7 @@ public final class AutofillManager {
        public int getRelevantEventTypes(int relevantEventTypes) {
            return relevantEventTypes | AccessibilityEvent.TYPE_VIEW_FOCUSED
                    | AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED
                    | AccessibilityEvent.TYPE_VIEW_CLICKED
                    | AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED;
        }

@@ -2248,6 +2250,12 @@ public final class AutofillManager {
                    }
                } break;

                case AccessibilityEvent.TYPE_VIEW_CLICKED: {
                    synchronized (mLock) {
                        notifyViewClicked(event.getWindowId(), event.getSourceNodeId());
                    }
                } break;

                case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED: {
                    final AutofillClient client = getClient();
                    if (client != null) {
@@ -2319,6 +2327,22 @@ public final class AutofillManager {
                    AutofillValue.forText(node.getText()));
        }

        private void notifyViewClicked(int windowId, long nodeId) {
            final int virtualId = AccessibilityNodeInfo.getVirtualDescendantId(nodeId);
            if (!isVirtualNode(virtualId)) {
                return;
            }
            final View view = findViewByAccessibilityId(windowId, nodeId);
            if (view == null) {
                return;
            }
            final AccessibilityNodeInfo node = findVirtualNodeByAccessibilityId(view, virtualId);
            if (node == null) {
                return;
            }
            AutofillManager.this.notifyViewClicked(view, virtualId);
        }

        @GuardedBy("mLock")
        private void updateTrackedViewsLocked() {
            if (mTrackedViews != null) {
+9 −4
Original line number Diff line number Diff line
@@ -565,16 +565,19 @@ public final class AutofillManagerService extends SystemService {
        }
    }

    private @Nullable Set<String> getWhitelistedCompatModePackages() {
        final String compatPackagesSetting = Settings.Global.getString(
    private String getWhitelistedCompatModePackagesFromSettings() {
        return Settings.Global.getString(
                mContext.getContentResolver(),
                Settings.Global.AUTOFILL_COMPAT_ALLOWED_PACKAGES);
    }

    private @Nullable Set<String> getWhitelistedCompatModePackages() {
        final String compatPackagesSetting = getWhitelistedCompatModePackagesFromSettings();
        if (TextUtils.isEmpty(compatPackagesSetting)) {
            return null;
        }
        final Set<String> compatPackages = new ArraySet<>();
        final SimpleStringSplitter splitter = new SimpleStringSplitter(
                COMPAT_PACKAGE_DELIMITER);
        final SimpleStringSplitter splitter = new SimpleStringSplitter(COMPAT_PACKAGE_DELIMITER);
        splitter.setString(compatPackagesSetting);
        while (splitter.hasNext()) {
            compatPackages.add(splitter.next());
@@ -1045,6 +1048,8 @@ public final class AutofillManagerService extends SystemService {
                    mUi.dump(pw);
                    pw.print("Autofill Compat State: ");
                    pw.println(mAutofillCompatState.mUserSpecs);
                    pw.print(prefix); pw.print("from settings: ");
                    pw.println(getWhitelistedCompatModePackagesFromSettings());
                }
                if (showHistory) {
                    pw.println(); pw.println("Requests history:"); pw.println();