diff options
| author | 2021-01-31 16:50:29 -0800 | |
|---|---|---|
| committer | 2021-03-24 13:46:34 -0700 | |
| commit | 0cdc94520147d0c563d139fc81241df84ca26f43 (patch) | |
| tree | ca79eec4d3a5e19964c2b68f58e89ca31c48713d | |
| parent | 3ca8fa18f963a32b6e30b030df729ca4750d6ce8 (diff) | |
Update some autofill var names for clarity
Renamed "componentName" to "clientActivity" and "uid" to "clientUid" to
avoid ambiguity.
Bug: 178978545
Test: Presubmit
Change-Id: I66246168bd71f577b9494e91b3a5df086c491cb1
4 files changed, 40 insertions, 37 deletions
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index b0b9d244f0d8..a169cb0f98fa 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -1921,20 +1921,20 @@ public final class AutofillManager { if (client == null) return; // NOTE: getClient() already logged it.. final SyncResultReceiver receiver = new SyncResultReceiver(SYNC_CALLS_TIMEOUT_MS); - final ComponentName componentName = client.autofillClientGetComponentName(); + final ComponentName clientActivity = client.autofillClientGetComponentName(); if (!mEnabledForAugmentedAutofillOnly && mOptions != null - && mOptions.isAutofillDisabledLocked(componentName)) { + && mOptions.isAutofillDisabledLocked(clientActivity)) { if (mOptions.isAugmentedAutofillEnabled(mContext)) { if (sDebug) { - Log.d(TAG, "startSession(" + componentName + "): disabled by service but " - + "whitelisted for augmented autofill"); + Log.d(TAG, "startSession(" + clientActivity + "): disabled by service but " + + "allowlisted for augmented autofill"); flags |= FLAG_ADD_CLIENT_ENABLED_FOR_AUGMENTED_AUTOFILL_ONLY; } } else { if (sDebug) { - Log.d(TAG, "startSession(" + componentName + "): ignored because " - + "disabled by service and not whitelisted for augmented autofill"); + Log.d(TAG, "startSession(" + clientActivity + "): ignored because " + + "disabled by service and not allowlisted for augmented autofill"); } setSessionFinished(AutofillManager.STATE_DISABLED_BY_SERVICE, null); client.autofillClientResetableStateAvailable(); @@ -1951,7 +1951,7 @@ public final class AutofillManager { mService.startSession(client.autofillClientGetActivityToken(), mServiceClient.asBinder(), id, bounds, value, mContext.getUserId(), - mCallback != null, flags, componentName, + mCallback != null, flags, clientActivity, isCompatibilityModeEnabledLocked(), receiver); mSessionId = receiver.getIntResult(); if (mSessionId != NO_SESSION) { @@ -1959,7 +1959,7 @@ public final class AutofillManager { } final int extraFlags = receiver.getOptionalExtraIntResult(0); if ((extraFlags & RECEIVER_FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY) != 0) { - if (sDebug) Log.d(TAG, "startSession(" + componentName + "): for augmented only"); + if (sDebug) Log.d(TAG, "startSession(" + clientActivity + "): for augmented only"); mForAugmentedAutofillOnly = true; } client.autofillClientResetableStateAvailable(); diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java index a1ad72c47784..312cde6c5152 100644 --- a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java +++ b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java @@ -25,6 +25,8 @@ import static com.android.server.autofill.Helper.sDebug; import static com.android.server.autofill.Helper.sFullScreenMode; import static com.android.server.autofill.Helper.sVerbose; +import static java.util.Objects.requireNonNull; + import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.UserIdInt; @@ -1370,15 +1372,16 @@ public final class AutofillManagerService } @Override - public void startSession(IBinder activityToken, IBinder appCallback, AutofillId autofillId, - Rect bounds, AutofillValue value, int userId, boolean hasCallback, int flags, - ComponentName componentName, boolean compatMode, IResultReceiver receiver) { + public void startSession(IBinder activityToken, IBinder clientCallback, + AutofillId autofillId, Rect bounds, AutofillValue value, int userId, + boolean hasCallback, int flags, ComponentName clientActivity, + boolean compatMode, IResultReceiver receiver) { - activityToken = Preconditions.checkNotNull(activityToken, "activityToken"); - appCallback = Preconditions.checkNotNull(appCallback, "appCallback"); - autofillId = Preconditions.checkNotNull(autofillId, "autoFillId"); - componentName = Preconditions.checkNotNull(componentName, "componentName"); - final String packageName = Preconditions.checkNotNull(componentName.getPackageName()); + requireNonNull(activityToken, "activityToken"); + requireNonNull(clientCallback, "clientCallback"); + requireNonNull(autofillId, "autofillId"); + requireNonNull(clientActivity, "clientActivity"); + final String packageName = requireNonNull(clientActivity.getPackageName()); Preconditions.checkArgument(userId == UserHandle.getUserId(getCallingUid()), "userId"); @@ -1395,7 +1398,7 @@ public final class AutofillManagerService synchronized (mLock) { final AutofillManagerServiceImpl service = getServiceForUserLocked(userId); result = service.startSessionLocked(activityToken, taskId, getCallingUid(), - appCallback, autofillId, bounds, value, hasCallback, componentName, + clientCallback, autofillId, bounds, value, hasCallback, clientActivity, compatMode, mAllowInstantService, flags); } final int sessionId = (int) result; diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java index b5f4813f239a..27be331163b7 100644 --- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java @@ -307,10 +307,10 @@ final class AutofillManagerServiceImpl * {@link AutofillManager#RECEIVER_FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY}). */ @GuardedBy("mLock") - long startSessionLocked(@NonNull IBinder activityToken, int taskId, int uid, - @NonNull IBinder appCallbackToken, @NonNull AutofillId autofillId, + long startSessionLocked(@NonNull IBinder activityToken, int taskId, int clientUid, + @NonNull IBinder clientCallback, @NonNull AutofillId autofillId, @NonNull Rect virtualBounds, @Nullable AutofillValue value, boolean hasCallback, - @NonNull ComponentName componentName, boolean compatMode, + @NonNull ComponentName clientActivity, boolean compatMode, boolean bindInstantServiceAllowed, int flags) { // FLAG_AUGMENTED_AUTOFILL_REQUEST is set in the flags when standard autofill is disabled // but the package is allowlisted for augmented autofill @@ -320,29 +320,29 @@ final class AutofillManagerServiceImpl return 0; } - if (!forAugmentedAutofillOnly && isAutofillDisabledLocked(componentName)) { + if (!forAugmentedAutofillOnly && isAutofillDisabledLocked(clientActivity)) { // Standard autofill is enabled, but service disabled autofill for this activity; that // means no session, unless the activity is allowlisted for augmented autofill - if (isWhitelistedForAugmentedAutofillLocked(componentName)) { + if (isWhitelistedForAugmentedAutofillLocked(clientActivity)) { if (sDebug) { - Slog.d(TAG, "startSession(" + componentName + "): disabled by service but " + Slog.d(TAG, "startSession(" + clientActivity + "): disabled by service but " + "whitelisted for augmented autofill"); } forAugmentedAutofillOnly = true; } else { if (sDebug) { - Slog.d(TAG, "startSession(" + componentName + "): ignored because " + Slog.d(TAG, "startSession(" + clientActivity + "): ignored because " + "disabled by service and not whitelisted for augmented autofill"); } final IAutoFillManagerClient client = IAutoFillManagerClient.Stub - .asInterface(appCallbackToken); + .asInterface(clientCallback); try { client.setSessionFinished(AutofillManager.STATE_DISABLED_BY_SERVICE, /* autofillableIds= */ null); } catch (RemoteException e) { Slog.w(TAG, - "Could not notify " + componentName + " that it's disabled: " + e); + "Could not notify " + clientActivity + " that it's disabled: " + e); } return NO_SESSION; @@ -357,8 +357,8 @@ final class AutofillManagerServiceImpl // Occasionally clean up abandoned sessions pruneAbandonedSessionsLocked(); - final Session newSession = createSessionByTokenLocked(activityToken, taskId, uid, - appCallbackToken, hasCallback, componentName, compatMode, + final Session newSession = createSessionByTokenLocked(activityToken, taskId, clientUid, + clientCallback, hasCallback, clientActivity, compatMode, bindInstantServiceAllowed, forAugmentedAutofillOnly, flags); if (newSession == null) { return NO_SESSION; @@ -367,7 +367,7 @@ final class AutofillManagerServiceImpl // Service can be null when it's only for augmented autofill String servicePackageName = mInfo == null ? null : mInfo.getServiceInfo().packageName; final String historyItem = - "id=" + newSession.id + " uid=" + uid + " a=" + componentName.toShortString() + "id=" + newSession.id + " uid=" + clientUid + " a=" + clientActivity.toShortString() + " s=" + servicePackageName + " u=" + mUserId + " i=" + autofillId + " b=" + virtualBounds + " hc=" + hasCallback + " f=" + flags + " aa=" + forAugmentedAutofillOnly; @@ -493,9 +493,9 @@ final class AutofillManagerServiceImpl } @GuardedBy("mLock") - private Session createSessionByTokenLocked(@NonNull IBinder activityToken, int taskId, int uid, - @NonNull IBinder appCallbackToken, boolean hasCallback, - @NonNull ComponentName componentName, boolean compatMode, + private Session createSessionByTokenLocked(@NonNull IBinder clientActivityToken, int taskId, + int clientUid, @NonNull IBinder clientCallback, boolean hasCallback, + @NonNull ComponentName clientActivity, boolean compatMode, boolean bindInstantServiceAllowed, boolean forAugmentedAutofillOnly, int flags) { // use random ids so that one app cannot know that another app creates sessions int sessionId; @@ -511,15 +511,15 @@ final class AutofillManagerServiceImpl } while (sessionId == 0 || sessionId == NO_SESSION || mSessions.indexOfKey(sessionId) >= 0); - assertCallerLocked(componentName, compatMode); + assertCallerLocked(clientActivity, compatMode); // It's null when the session is just for augmented autofill final ComponentName serviceComponentName = mInfo == null ? null : mInfo.getServiceInfo().getComponentName(); final Session newSession = new Session(this, mUi, getContext(), mHandler, mUserId, mLock, - sessionId, taskId, uid, activityToken, appCallbackToken, hasCallback, + sessionId, taskId, clientUid, clientActivityToken, clientCallback, hasCallback, mUiLatencyHistory, mWtfHistory, serviceComponentName, - componentName, compatMode, bindInstantServiceAllowed, forAugmentedAutofillOnly, + clientActivity, compatMode, bindInstantServiceAllowed, forAugmentedAutofillOnly, flags, mInputMethodManagerInternal); mSessions.put(newSession.id, newSession); diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index b7f736e4dc33..a230f808ee9e 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -196,7 +196,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState /** userId the session belongs to */ public final int userId; - /** uid the session is for */ + /** The uid of the app that's being autofilled */ public final int uid; /** ID of the task associated with this session's activity */ @@ -208,7 +208,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState @GuardedBy("mLock") @NonNull private IBinder mActivityToken; - /** Component that's being auto-filled */ + /** The app activity that's being autofilled */ @NonNull private final ComponentName mComponentName; /** Whether the app being autofilled is running in compat mode. */ |