Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78faa2ae authored by Reema Bajwa's avatar Reema Bajwa Committed by Automerger Merge Worker
Browse files

Merge "Address TODOs for Credential Manager" into udc-dev am: bf9648a7

parents cb4cf7fe bf9648a7
Loading
Loading
Loading
Loading
+17 −6
Original line number Diff line number Diff line
@@ -196,25 +196,36 @@ public final class CredentialManagerService
            return;
        }

        CredentialManagerServiceImpl serviceToBeRemoved = null;
        List<CredentialManagerServiceImpl> servicesToBeRemoved = new ArrayList<>();
        for (CredentialManagerServiceImpl service : services) {
            if (service != null) {
                CredentialProviderInfo credentialProviderInfo = service.getCredentialProviderInfo();
                ComponentName componentName =
                        credentialProviderInfo.getServiceInfo().getComponentName();
                if (packageName.equals(componentName.getPackageName())) {
                    serviceToBeRemoved = service;
                    removeServiceFromMultiModeSettings(componentName.flattenToString(), userId);
                    break;
                    servicesToBeRemoved.add(service);
                }
            }
        }
        if (serviceToBeRemoved != null) {

        // Iterate over all the services to be removed, and remove them from the user configurable
        // services cache, the system services cache as well as the setting key-value pair.
        for (CredentialManagerServiceImpl serviceToBeRemoved : servicesToBeRemoved) {
            removeServiceFromCache(serviceToBeRemoved, userId);
            removeServiceFromSystemServicesCache(serviceToBeRemoved, userId);
            removeServiceFromMultiModeSettings(serviceToBeRemoved.getComponentName()
                    .flattenToString(), userId);
            CredentialDescriptionRegistry.forUser(userId)
                    .evictProviderWithPackageName(serviceToBeRemoved.getServicePackageName());
        }
        // TODO("Iterate over system services and remove if needed")
    }

    @GuardedBy("mLock")
    private void removeServiceFromSystemServicesCache(
            CredentialManagerServiceImpl serviceToBeRemoved, int userId) {
        if (mSystemServicesCacheList.get(userId) != null) {
            mSystemServicesCacheList.get(userId).remove(serviceToBeRemoved);
        }
    }

    @GuardedBy("mLock")
+0 −2
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ public final class CredentialManagerServiceImpl extends
        AbstractPerUserSystemService<CredentialManagerServiceImpl, CredentialManagerService> {
    private static final String TAG = "CredManSysServiceImpl";

    // TODO(b/210531) : Make final when update flow is fixed
    @GuardedBy("mLock")
    @NonNull
    private CredentialProviderInfo mInfo;
@@ -72,7 +71,6 @@ public final class CredentialManagerServiceImpl extends
    @GuardedBy("mLock")
    protected ServiceInfo newServiceInfoLocked(@NonNull ComponentName serviceComponent)
            throws PackageManager.NameNotFoundException {
        // TODO : Test update flows with multiple providers
        if (mInfo != null) {
            Slog.i(TAG, "newServiceInfoLocked, mInfo not null : "
                    + mInfo.getServiceInfo().getComponentName().flattenToString() + " , "
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ public class CredentialManagerUi {
    private final CredentialManagerUiCallback mCallbacks;
    @NonNull
    private final Context mContext;
    // TODO : Use for starting the activity for this user

    private final int mUserId;

    private UiStatus mStatus;
+1 −2
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ public final class ProviderClearSession extends ProviderSession<ClearCredentialS
            android.credentials.ClearCredentialStateRequest clientRequest,
            CallingAppInfo callingAppInfo
    ) {
        // TODO: Determine if provider needs to declare clear capability in manifest
        return new ClearCredentialStateRequest(
                callingAppInfo,
                clientRequest.getData());
@@ -95,7 +94,7 @@ public final class ProviderClearSession extends ProviderSession<ClearCredentialS
            mProviderSessionMetric.collectCandidateFrameworkException(mProviderException.getType());
        }
        mProviderSessionMetric.collectCandidateExceptionStatus(/*hasException=*/true);
        updateStatusAndInvokeCallback(toStatus(errorCode),
        updateStatusAndInvokeCallback(Status.CANCELED,
                /*source=*/ CredentialsSource.REMOTE_PROVIDER);
    }

+1 −1
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ public final class ProviderCreateSession extends ProviderSession<
            mProviderSessionMetric.collectCandidateFrameworkException(mProviderException.getType());
        }
        mProviderSessionMetric.collectCandidateExceptionStatus(/*hasException=*/true);
        updateStatusAndInvokeCallback(toStatus(errorCode),
        updateStatusAndInvokeCallback(Status.CANCELED,
                /*source=*/ CredentialsSource.REMOTE_PROVIDER);
    }

Loading