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

Commit ff6d6d94 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Persistable accessibility ID from ContextWrappers

Only IDs beyond LAST_APP_ACCESSIBILITY_ID can be reliably used for
autofilling. Other ids might change occasionally.

All Views attached to activities get usable IDs. Hence if a
ContextWrapper wraps an activity forward the goodness.

Also make sure that we don't accidentially autofill an unsafe view.

Test: Before the messaging handed out unusable Ids because it uses a
      Contextwrapper. Now it hands out good ideas (accoring to dumpsys)
      CtsAutoFillServiceTestCases
Bug: 38070352
Change-Id: Ibc72c84d77197019939abd231e8960988af7a592
parent 33948042
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -952,4 +952,12 @@ public class ContextWrapper extends Context {
    public Handler getMainThreadHandler() {
        return mBase.getMainThreadHandler();
    }

    /**
     * @hide
     */
    @Override
    public int getNextAccessibilityId() {
        return mBase.getNextAccessibilityId();
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -7706,7 +7706,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    }
    private boolean isAutofillable() {
        return getAutofillType() != AUTOFILL_TYPE_NONE && isImportantForAutofill();
        return getAutofillType() != AUTOFILL_TYPE_NONE && isImportantForAutofill()
                && getAccessibilityViewId() > LAST_APP_ACCESSIBILITY_ID;
    }
    private void populateVirtualStructure(ViewStructure structure,