Merge "Implemented notifyViewClicked() on compat mode." into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f99b1d8fd9
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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();
|
||||
|
Reference in New Issue
Block a user