• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

frameworks/base


Commit MetaInfo

Revisionbb1a46a7ae4e5ea620ca5fa33315eaff4a8456db (tree)
Time2020-01-09 11:02:58
Authorandroid-build-team Robot <android-build-team-robot@goog...>
Commiterandroid-build-team Robot

Log Message

Snap for 6120535 from 9595ad654b547711c1af56a562dbf429e608d176 to qt-qpr2-release

Change-Id: I831b75f3f7350376063409d5c53cd1f96c4e8a24

Change Summary

Incremental Difference

--- a/core/java/android/service/autofill/FillRequest.java
+++ b/core/java/android/service/autofill/FillRequest.java
@@ -71,12 +71,21 @@ public final class FillRequest implements Parcelable {
7171 */
7272 public static final int FLAG_COMPATIBILITY_MODE_REQUEST = 0x2;
7373
74+ /**
75+ * Indicates the request came from a password field.
76+ *
77+ * (TODO: b/141703197) Temporary fix for augmented autofill showing passwords.
78+ *
79+ * @hide
80+ */
81+ public static final @RequestFlags int FLAG_PASSWORD_INPUT_TYPE = 0x4;
82+
7483 /** @hide */
7584 public static final int INVALID_REQUEST_ID = Integer.MIN_VALUE;
7685
7786 /** @hide */
7887 @IntDef(flag = true, prefix = { "FLAG_" }, value = {
79- FLAG_MANUAL_REQUEST, FLAG_COMPATIBILITY_MODE_REQUEST
88+ FLAG_MANUAL_REQUEST, FLAG_COMPATIBILITY_MODE_REQUEST, FLAG_PASSWORD_INPUT_TYPE
8089 })
8190 @Retention(RetentionPolicy.SOURCE)
8291 @interface RequestFlags{}
@@ -100,7 +109,7 @@ public final class FillRequest implements Parcelable {
100109 @Nullable Bundle clientState, @RequestFlags int flags) {
101110 mId = id;
102111 mFlags = Preconditions.checkFlagsArgument(flags,
103- FLAG_MANUAL_REQUEST | FLAG_COMPATIBILITY_MODE_REQUEST);
112+ FLAG_MANUAL_REQUEST | FLAG_COMPATIBILITY_MODE_REQUEST | FLAG_PASSWORD_INPUT_TYPE);
104113 mContexts = Preconditions.checkCollectionElementsNotNull(contexts, "contexts");
105114 mClientState = clientState;
106115 }
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -17,6 +17,7 @@
1717 package android.view.autofill;
1818
1919 import static android.service.autofill.FillRequest.FLAG_MANUAL_REQUEST;
20+import static android.service.autofill.FillRequest.FLAG_PASSWORD_INPUT_TYPE;
2021 import static android.view.autofill.Helper.sDebug;
2122 import static android.view.autofill.Helper.sVerbose;
2223 import static android.view.autofill.Helper.toList;
@@ -60,6 +61,7 @@ import android.view.accessibility.AccessibilityManager;
6061 import android.view.accessibility.AccessibilityNodeInfo;
6162 import android.view.accessibility.AccessibilityNodeProvider;
6263 import android.view.accessibility.AccessibilityWindowInfo;
64+import android.widget.TextView;
6365
6466 import com.android.internal.annotations.GuardedBy;
6567 import com.android.internal.logging.MetricsLogger;
@@ -966,6 +968,10 @@ public final class AutofillManager {
966968 if (!isClientDisablingEnterExitEvent()) {
967969 final AutofillValue value = view.getAutofillValue();
968970
971+ if (view instanceof TextView && ((TextView) view).isAnyPasswordInputType()) {
972+ flags |= FLAG_PASSWORD_INPUT_TYPE;
973+ }
974+
969975 if (!isActiveLocked()) {
970976 // Starts new session.
971977 startSessionLocked(id, null, value, flags);
@@ -1130,6 +1136,10 @@ public final class AutofillManager {
11301136 } else {
11311137 // don't notify entered when Activity is already in background
11321138 if (!isClientDisablingEnterExitEvent()) {
1139+ if (view instanceof TextView && ((TextView) view).isAnyPasswordInputType()) {
1140+ flags |= FLAG_PASSWORD_INPUT_TYPE;
1141+ }
1142+
11331143 if (!isActiveLocked()) {
11341144 // Starts new session.
11351145 startSessionLocked(id, bounds, null, flags);
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -6582,6 +6582,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
65826582 return mTransformation instanceof PasswordTransformationMethod;
65836583 }
65846584
6585+ /**
6586+ * Returns true if the current inputType is any type of password.
6587+ *
6588+ * @hide
6589+ */
6590+ public boolean isAnyPasswordInputType() {
6591+ final int inputType = getInputType();
6592+ return isPasswordInputType(inputType) || isVisiblePasswordInputType(inputType);
6593+ }
6594+
65856595 static boolean isPasswordInputType(int inputType) {
65866596 final int variation =
65876597 inputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_MASK_VARIATION);
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -952,7 +952,9 @@ public class ChooserActivity extends ResolverActivity {
952952 name = pkgRes.getString(nameResId);
953953 final int resId = metaData.getInt(CHIP_ICON_METADATA_KEY);
954954 icon = pkgRes.getDrawable(resId);
955- } catch (NameNotFoundException ex) { }
955+ } catch (Resources.NotFoundException ex) {
956+ } catch (NameNotFoundException ex) {
957+ }
956958 }
957959 if (TextUtils.isEmpty(name)) {
958960 name = ri.loadLabel(getPackageManager());
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -18,6 +18,7 @@ package com.android.server.autofill;
1818
1919 import static android.service.autofill.AutofillFieldClassificationService.EXTRA_SCORES;
2020 import static android.service.autofill.FillRequest.FLAG_MANUAL_REQUEST;
21+import static android.service.autofill.FillRequest.FLAG_PASSWORD_INPUT_TYPE;
2122 import static android.service.autofill.FillRequest.INVALID_REQUEST_ID;
2223 import static android.view.autofill.AutofillManager.ACTION_START_SESSION;
2324 import static android.view.autofill.AutofillManager.ACTION_VALUE_CHANGED;
@@ -581,7 +582,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
581582 + ", flags=" + flags + ")");
582583 }
583584 mForAugmentedAutofillOnly = true;
584- triggerAugmentedAutofillLocked();
585+ triggerAugmentedAutofillLocked(flags);
585586 return;
586587 }
587588 viewState.setState(newState);
@@ -780,7 +781,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
780781 id, mCompatMode);
781782 }
782783 // Although "standard" autofill is disabled, it might still trigger augmented autofill
783- if (triggerAugmentedAutofillLocked() != null) {
784+ if (triggerAugmentedAutofillLocked(requestFlags) != null) {
784785 mForAugmentedAutofillOnly = true;
785786 if (sDebug) {
786787 Slog.d(TAG, "Service disabled autofill for " + mComponentName
@@ -2424,7 +2425,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
24242425 if (sDebug) Slog.d(TAG, "updateLocked(" + id + "): augmented-autofillable");
24252426
24262427 // ...then trigger the augmented autofill UI
2427- triggerAugmentedAutofillLocked();
2428+ triggerAugmentedAutofillLocked(flags);
24282429 return;
24292430 }
24302431
@@ -2688,8 +2689,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
26882689
26892690 // The default autofill service cannot fullfill the request, let's check if the augmented
26902691 // autofill service can.
2691- mAugmentedAutofillDestroyer = triggerAugmentedAutofillLocked();
2692- if (mAugmentedAutofillDestroyer == null) {
2692+ mAugmentedAutofillDestroyer = triggerAugmentedAutofillLocked(flags);
2693+ if (mAugmentedAutofillDestroyer == null && ((flags & FLAG_PASSWORD_INPUT_TYPE) == 0)) {
26932694 if (sVerbose) {
26942695 Slog.v(TAG, "canceling session " + id + " when service returned null and it cannot "
26952696 + "be augmented. AutofillableIds: " + autofillableIds);
@@ -2699,8 +2700,14 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
26992700 removeSelf();
27002701 } else {
27012702 if (sVerbose) {
2702- Slog.v(TAG, "keeping session " + id + " when service returned null but "
2703- + "it can be augmented. AutofillableIds: " + autofillableIds);
2703+ if ((flags & FLAG_PASSWORD_INPUT_TYPE) != 0) {
2704+ Slog.v(TAG, "keeping session " + id + " when service returned null and "
2705+ + "augmented service is disabled for password fields. "
2706+ + "AutofillableIds: " + autofillableIds);
2707+ } else {
2708+ Slog.v(TAG, "keeping session " + id + " when service returned null but "
2709+ + "it can be augmented. AutofillableIds: " + autofillableIds);
2710+ }
27042711 }
27052712 mAugmentedAutofillableIds = autofillableIds;
27062713 try {
@@ -2719,7 +2726,12 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
27192726 // TODO(b/123099468): might need to call it in other places, like when the service returns a
27202727 // non-null response but without datasets (for example, just SaveInfo)
27212728 @GuardedBy("mLock")
2722- private Runnable triggerAugmentedAutofillLocked() {
2729+ private Runnable triggerAugmentedAutofillLocked(int flags) {
2730+ // (TODO: b/141703197) Fix later by passing info to service.
2731+ if ((flags & FLAG_PASSWORD_INPUT_TYPE) != 0) {
2732+ return null;
2733+ }
2734+
27232735 // Check if Smart Suggestions is supported...
27242736 final @SmartSuggestionMode int supportedModes = mService
27252737 .getSupportedSmartSuggestionModesLocked();