Loading core/java/android/view/autofill/AutofillManager.java +10 −3 Original line number Diff line number Diff line Loading @@ -1592,7 +1592,8 @@ public final class AutofillManager { // request comes in but PCC Detection hasn't been triggered. There is no benefit to // trigger PCC Detection separately in those cases. if (!isActiveLocked()) { final boolean clientAdded = tryAddServiceClientIfNeededLocked(); final boolean clientAdded = tryAddServiceClientIfNeededLocked(isCredmanRequested); if (clientAdded) { startSessionLocked(/* id= */ AutofillId.NO_AUTOFILL_ID, /* bounds= */ null, /* value= */ null, /* flags= */ FLAG_PCC_DETECTION); Loading Loading @@ -1850,7 +1851,8 @@ public final class AutofillManager { Rect bounds, AutofillValue value, int flags) { if (shouldIgnoreViewEnteredLocked(id, flags)) return null; final boolean clientAdded = tryAddServiceClientIfNeededLocked(); boolean credmanRequested = isCredmanRequested(view); final boolean clientAdded = tryAddServiceClientIfNeededLocked(credmanRequested); if (!clientAdded) { if (sVerbose) Log.v(TAG, "ignoring notifyViewEntered(" + id + "): no service client"); return null; Loading Loading @@ -2645,6 +2647,11 @@ public final class AutofillManager { */ @GuardedBy("mLock") private boolean tryAddServiceClientIfNeededLocked() { return tryAddServiceClientIfNeededLocked(/*credmanRequested=*/ false); } @GuardedBy("mLock") private boolean tryAddServiceClientIfNeededLocked(boolean credmanRequested) { final AutofillClient client = getClient(); if (client == null) { return false; Loading @@ -2659,7 +2666,7 @@ public final class AutofillManager { final int userId = mContext.getUserId(); final SyncResultReceiver receiver = new SyncResultReceiver(SYNC_CALLS_TIMEOUT_MS); mService.addClient(mServiceClient, client.autofillClientGetComponentName(), userId, receiver); userId, receiver, credmanRequested); int flags = 0; try { flags = receiver.getIntResult(); Loading core/java/android/view/autofill/IAutoFillManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ import com.android.internal.os.IResultReceiver; oneway interface IAutoFillManager { // Returns flags: FLAG_ADD_CLIENT_ENABLED | FLAG_ADD_CLIENT_DEBUG | FLAG_ADD_CLIENT_VERBOSE void addClient(in IAutoFillManagerClient client, in ComponentName componentName, int userId, in IResultReceiver result); in IResultReceiver result, boolean credmanRequested); void removeClient(in IAutoFillManagerClient client, int userId); void startSession(IBinder activityToken, in IBinder appCallback, in AutofillId autoFillId, in Rect bounds, in AutofillValue value, int userId, boolean hasCallback, int flags, Loading packages/CredentialManager/res/xml/autofill_service_configuration.xml +1 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,6 @@ Note: This file is ignored for devices older that API 31 See https://developer.android.com/about/versions/12/backup-restore --> <autofill-service-configuration <autofill-service xmlns:android="http://schemas.android.com/apk/res/android" android:supportsInlineSuggestions="true"/> No newline at end of file services/autofill/java/com/android/server/autofill/AutofillManagerService.java +3 −3 Original line number Diff line number Diff line Loading @@ -1625,13 +1625,13 @@ public final class AutofillManagerService final class AutoFillManagerServiceStub extends IAutoFillManager.Stub { @Override public void addClient(IAutoFillManagerClient client, ComponentName componentName, int userId, IResultReceiver receiver) { int userId, IResultReceiver receiver, boolean credmanRequested) { int flags = 0; try { synchronized (mLock) { final int enabledFlags = getServiceForUserWithLocalBinderIdentityLocked(userId) .addClientLocked(client, componentName); .addClientLocked(client, componentName, credmanRequested); if (enabledFlags != 0) { flags |= enabledFlags; } Loading @@ -1644,7 +1644,7 @@ public final class AutofillManagerService } } catch (Exception ex) { // Don't do anything, send back default flags Log.wtf(TAG, "addClient(): failed " + ex.toString()); Log.wtf(TAG, "addClient(): failed " + ex.toString(), ex); } finally { send(receiver, flags); } Loading services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +41 −11 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityManagerInternal; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; Loading Loading @@ -96,6 +97,7 @@ import com.android.server.wm.ActivityTaskManagerInternal; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Random; /** * Bridge between the {@code system_server}'s {@link AutofillManagerService} and the Loading Loading @@ -293,8 +295,19 @@ final class AutofillManagerServiceImpl * @return {@code 0} if disabled, {@code FLAG_ADD_CLIENT_ENABLED} if enabled (it might be * OR'ed with {@code FLAG_AUGMENTED_AUTOFILL_REQUEST}). */ @GuardedBy("mLock") int addClientLocked(IAutoFillManagerClient client, ComponentName componentName) { int addClientLocked(IAutoFillManagerClient client, ComponentName componentName, boolean credmanRequested) { synchronized (mLock) { ComponentName credComponentName = getCredentialAutofillService(getContext()); if (!credmanRequested && Objects.equals(credComponentName, mInfo == null ? null : mInfo.getServiceInfo().getComponentName())) { // If the service component name corresponds to cred component name, then it means // no autofill provider is selected by the user. Cred Autofill Service should only // be active if there is a credman request. return 0; } if (mClients == null) { mClients = new RemoteCallbackList<>(); } Loading @@ -307,6 +320,7 @@ final class AutofillManagerServiceImpl && isWhitelistedForAugmentedAutofillLocked(componentName)) { return FLAG_ADD_CLIENT_ENABLED_FOR_AUGMENTED_AUTOFILL_ONLY; } } // No flags / disabled return 0; Loading Loading @@ -1486,6 +1500,22 @@ final class AutofillManagerServiceImpl return true; } @Nullable private ComponentName getCredentialAutofillService(Context context) { ComponentName componentName = null; String credentialManagerAutofillCompName = context.getResources().getString( R.string.config_defaultCredentialManagerAutofillService); if (credentialManagerAutofillCompName != null && !credentialManagerAutofillCompName.isEmpty()) { componentName = ComponentName.unflattenFromString( credentialManagerAutofillCompName); } if (componentName == null) { Slog.w(TAG, "Invalid CredentialAutofillService"); } return componentName; } @GuardedBy("mLock") private int getAugmentedAutofillServiceUidLocked() { if (mRemoteAugmentedAutofillServiceInfo == null) { Loading Loading
core/java/android/view/autofill/AutofillManager.java +10 −3 Original line number Diff line number Diff line Loading @@ -1592,7 +1592,8 @@ public final class AutofillManager { // request comes in but PCC Detection hasn't been triggered. There is no benefit to // trigger PCC Detection separately in those cases. if (!isActiveLocked()) { final boolean clientAdded = tryAddServiceClientIfNeededLocked(); final boolean clientAdded = tryAddServiceClientIfNeededLocked(isCredmanRequested); if (clientAdded) { startSessionLocked(/* id= */ AutofillId.NO_AUTOFILL_ID, /* bounds= */ null, /* value= */ null, /* flags= */ FLAG_PCC_DETECTION); Loading Loading @@ -1850,7 +1851,8 @@ public final class AutofillManager { Rect bounds, AutofillValue value, int flags) { if (shouldIgnoreViewEnteredLocked(id, flags)) return null; final boolean clientAdded = tryAddServiceClientIfNeededLocked(); boolean credmanRequested = isCredmanRequested(view); final boolean clientAdded = tryAddServiceClientIfNeededLocked(credmanRequested); if (!clientAdded) { if (sVerbose) Log.v(TAG, "ignoring notifyViewEntered(" + id + "): no service client"); return null; Loading Loading @@ -2645,6 +2647,11 @@ public final class AutofillManager { */ @GuardedBy("mLock") private boolean tryAddServiceClientIfNeededLocked() { return tryAddServiceClientIfNeededLocked(/*credmanRequested=*/ false); } @GuardedBy("mLock") private boolean tryAddServiceClientIfNeededLocked(boolean credmanRequested) { final AutofillClient client = getClient(); if (client == null) { return false; Loading @@ -2659,7 +2666,7 @@ public final class AutofillManager { final int userId = mContext.getUserId(); final SyncResultReceiver receiver = new SyncResultReceiver(SYNC_CALLS_TIMEOUT_MS); mService.addClient(mServiceClient, client.autofillClientGetComponentName(), userId, receiver); userId, receiver, credmanRequested); int flags = 0; try { flags = receiver.getIntResult(); Loading
core/java/android/view/autofill/IAutoFillManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ import com.android.internal.os.IResultReceiver; oneway interface IAutoFillManager { // Returns flags: FLAG_ADD_CLIENT_ENABLED | FLAG_ADD_CLIENT_DEBUG | FLAG_ADD_CLIENT_VERBOSE void addClient(in IAutoFillManagerClient client, in ComponentName componentName, int userId, in IResultReceiver result); in IResultReceiver result, boolean credmanRequested); void removeClient(in IAutoFillManagerClient client, int userId); void startSession(IBinder activityToken, in IBinder appCallback, in AutofillId autoFillId, in Rect bounds, in AutofillValue value, int userId, boolean hasCallback, int flags, Loading
packages/CredentialManager/res/xml/autofill_service_configuration.xml +1 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,6 @@ Note: This file is ignored for devices older that API 31 See https://developer.android.com/about/versions/12/backup-restore --> <autofill-service-configuration <autofill-service xmlns:android="http://schemas.android.com/apk/res/android" android:supportsInlineSuggestions="true"/> No newline at end of file
services/autofill/java/com/android/server/autofill/AutofillManagerService.java +3 −3 Original line number Diff line number Diff line Loading @@ -1625,13 +1625,13 @@ public final class AutofillManagerService final class AutoFillManagerServiceStub extends IAutoFillManager.Stub { @Override public void addClient(IAutoFillManagerClient client, ComponentName componentName, int userId, IResultReceiver receiver) { int userId, IResultReceiver receiver, boolean credmanRequested) { int flags = 0; try { synchronized (mLock) { final int enabledFlags = getServiceForUserWithLocalBinderIdentityLocked(userId) .addClientLocked(client, componentName); .addClientLocked(client, componentName, credmanRequested); if (enabledFlags != 0) { flags |= enabledFlags; } Loading @@ -1644,7 +1644,7 @@ public final class AutofillManagerService } } catch (Exception ex) { // Don't do anything, send back default flags Log.wtf(TAG, "addClient(): failed " + ex.toString()); Log.wtf(TAG, "addClient(): failed " + ex.toString(), ex); } finally { send(receiver, flags); } Loading
services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +41 −11 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityManagerInternal; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; Loading Loading @@ -96,6 +97,7 @@ import com.android.server.wm.ActivityTaskManagerInternal; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Random; /** * Bridge between the {@code system_server}'s {@link AutofillManagerService} and the Loading Loading @@ -293,8 +295,19 @@ final class AutofillManagerServiceImpl * @return {@code 0} if disabled, {@code FLAG_ADD_CLIENT_ENABLED} if enabled (it might be * OR'ed with {@code FLAG_AUGMENTED_AUTOFILL_REQUEST}). */ @GuardedBy("mLock") int addClientLocked(IAutoFillManagerClient client, ComponentName componentName) { int addClientLocked(IAutoFillManagerClient client, ComponentName componentName, boolean credmanRequested) { synchronized (mLock) { ComponentName credComponentName = getCredentialAutofillService(getContext()); if (!credmanRequested && Objects.equals(credComponentName, mInfo == null ? null : mInfo.getServiceInfo().getComponentName())) { // If the service component name corresponds to cred component name, then it means // no autofill provider is selected by the user. Cred Autofill Service should only // be active if there is a credman request. return 0; } if (mClients == null) { mClients = new RemoteCallbackList<>(); } Loading @@ -307,6 +320,7 @@ final class AutofillManagerServiceImpl && isWhitelistedForAugmentedAutofillLocked(componentName)) { return FLAG_ADD_CLIENT_ENABLED_FOR_AUGMENTED_AUTOFILL_ONLY; } } // No flags / disabled return 0; Loading Loading @@ -1486,6 +1500,22 @@ final class AutofillManagerServiceImpl return true; } @Nullable private ComponentName getCredentialAutofillService(Context context) { ComponentName componentName = null; String credentialManagerAutofillCompName = context.getResources().getString( R.string.config_defaultCredentialManagerAutofillService); if (credentialManagerAutofillCompName != null && !credentialManagerAutofillCompName.isEmpty()) { componentName = ComponentName.unflattenFromString( credentialManagerAutofillCompName); } if (componentName == null) { Slog.w(TAG, "Invalid CredentialAutofillService"); } return componentName; } @GuardedBy("mLock") private int getAugmentedAutofillServiceUidLocked() { if (mRemoteAugmentedAutofillServiceInfo == null) { Loading