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) {
|
private void onProvideVirtualStructureCompat(ViewStructure structure, boolean forAutofill) {
|
||||||
final AccessibilityNodeProvider provider = getAccessibilityNodeProvider();
|
final AccessibilityNodeProvider provider = getAccessibilityNodeProvider();
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
|
if (android.view.autofill.Helper.sVerbose && forAutofill) {
|
||||||
|
Log.v(VIEW_LOG_TAG, "onProvideVirtualStructureCompat() for " + this);
|
||||||
|
}
|
||||||
|
|
||||||
final AccessibilityNodeInfo info = createAccessibilityNodeInfo();
|
final AccessibilityNodeInfo info = createAccessibilityNodeInfo();
|
||||||
structure.setChildCount(1);
|
structure.setChildCount(1);
|
||||||
final ViewStructure root = structure.newChild(0);
|
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.
|
* @param virtualId id identifying the virtual child inside the parent view.
|
||||||
*/
|
*/
|
||||||
public void notifyViewExited(@NonNull View view, int virtualId) {
|
public void notifyViewExited(@NonNull View view, int virtualId) {
|
||||||
|
if (sVerbose) Log.v(TAG, "notifyViewExited(" + view.getAutofillId() + ", " + virtualId);
|
||||||
if (!hasAutofillFeature()) {
|
if (!hasAutofillFeature()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2190,6 +2191,7 @@ public final class AutofillManager {
|
|||||||
public int getRelevantEventTypes(int relevantEventTypes) {
|
public int getRelevantEventTypes(int relevantEventTypes) {
|
||||||
return relevantEventTypes | AccessibilityEvent.TYPE_VIEW_FOCUSED
|
return relevantEventTypes | AccessibilityEvent.TYPE_VIEW_FOCUSED
|
||||||
| AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED
|
| AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED
|
||||||
|
| AccessibilityEvent.TYPE_VIEW_CLICKED
|
||||||
| AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED;
|
| AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2248,6 +2250,12 @@ public final class AutofillManager {
|
|||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case AccessibilityEvent.TYPE_VIEW_CLICKED: {
|
||||||
|
synchronized (mLock) {
|
||||||
|
notifyViewClicked(event.getWindowId(), event.getSourceNodeId());
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED: {
|
case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED: {
|
||||||
final AutofillClient client = getClient();
|
final AutofillClient client = getClient();
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
@@ -2319,6 +2327,22 @@ public final class AutofillManager {
|
|||||||
AutofillValue.forText(node.getText()));
|
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")
|
@GuardedBy("mLock")
|
||||||
private void updateTrackedViewsLocked() {
|
private void updateTrackedViewsLocked() {
|
||||||
if (mTrackedViews != null) {
|
if (mTrackedViews != null) {
|
||||||
|
|||||||
@@ -565,16 +565,19 @@ public final class AutofillManagerService extends SystemService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private @Nullable Set<String> getWhitelistedCompatModePackages() {
|
private String getWhitelistedCompatModePackagesFromSettings() {
|
||||||
final String compatPackagesSetting = Settings.Global.getString(
|
return Settings.Global.getString(
|
||||||
mContext.getContentResolver(),
|
mContext.getContentResolver(),
|
||||||
Settings.Global.AUTOFILL_COMPAT_ALLOWED_PACKAGES);
|
Settings.Global.AUTOFILL_COMPAT_ALLOWED_PACKAGES);
|
||||||
|
}
|
||||||
|
|
||||||
|
private @Nullable Set<String> getWhitelistedCompatModePackages() {
|
||||||
|
final String compatPackagesSetting = getWhitelistedCompatModePackagesFromSettings();
|
||||||
if (TextUtils.isEmpty(compatPackagesSetting)) {
|
if (TextUtils.isEmpty(compatPackagesSetting)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final Set<String> compatPackages = new ArraySet<>();
|
final Set<String> compatPackages = new ArraySet<>();
|
||||||
final SimpleStringSplitter splitter = new SimpleStringSplitter(
|
final SimpleStringSplitter splitter = new SimpleStringSplitter(COMPAT_PACKAGE_DELIMITER);
|
||||||
COMPAT_PACKAGE_DELIMITER);
|
|
||||||
splitter.setString(compatPackagesSetting);
|
splitter.setString(compatPackagesSetting);
|
||||||
while (splitter.hasNext()) {
|
while (splitter.hasNext()) {
|
||||||
compatPackages.add(splitter.next());
|
compatPackages.add(splitter.next());
|
||||||
@@ -1045,6 +1048,8 @@ public final class AutofillManagerService extends SystemService {
|
|||||||
mUi.dump(pw);
|
mUi.dump(pw);
|
||||||
pw.print("Autofill Compat State: ");
|
pw.print("Autofill Compat State: ");
|
||||||
pw.println(mAutofillCompatState.mUserSpecs);
|
pw.println(mAutofillCompatState.mUserSpecs);
|
||||||
|
pw.print(prefix); pw.print("from settings: ");
|
||||||
|
pw.println(getWhitelistedCompatModePackagesFromSettings());
|
||||||
}
|
}
|
||||||
if (showHistory) {
|
if (showHistory) {
|
||||||
pw.println(); pw.println("Requests history:"); pw.println();
|
pw.println(); pw.println("Requests history:"); pw.println();
|
||||||
|
|||||||
Reference in New Issue
Block a user