Merge "Add sessions to requestsession" into udc-dev
This commit is contained in:
@@ -221,12 +221,12 @@ public class CredentialDescriptionRegistry {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean checkForMatch(Set<String> registeredUnflattenedStrings,
|
||||
static boolean checkForMatch(Set<String> registeredUnflattenedStrings,
|
||||
Set<String> requestedUnflattenedString) {
|
||||
return registeredUnflattenedStrings.containsAll(requestedUnflattenedString);
|
||||
}
|
||||
|
||||
private static Set<String> flatStringToSet(String flatString) {
|
||||
static Set<String> flatStringToSet(String flatString) {
|
||||
return new HashSet<>(Arrays
|
||||
.asList(flatString.split(FLAT_STRING_SPLIT_REGEX)));
|
||||
}
|
||||
|
||||
@@ -291,14 +291,15 @@ public final class CredentialManagerService
|
||||
List<ProviderSession> providerSessions = new ArrayList<>();
|
||||
for (Pair<CredentialOption, CredentialDescriptionRegistry.FilterResult> result :
|
||||
activeCredentialContainers) {
|
||||
providerSessions.add(
|
||||
ProviderRegistryGetSession.createNewSession(
|
||||
mContext,
|
||||
UserHandle.getCallingUserId(),
|
||||
session,
|
||||
session.mClientAppInfo,
|
||||
result.second.mPackageName,
|
||||
result.first));
|
||||
ProviderSession providerSession = ProviderRegistryGetSession.createNewSession(
|
||||
mContext,
|
||||
UserHandle.getCallingUserId(),
|
||||
session,
|
||||
session.mClientAppInfo,
|
||||
result.second.mPackageName,
|
||||
result.first);
|
||||
providerSessions.add(providerSession);
|
||||
session.addProviderSession(providerSession.getComponentName(), providerSession);
|
||||
}
|
||||
return providerSessions;
|
||||
}
|
||||
@@ -328,10 +329,15 @@ public final class CredentialManagerService
|
||||
new HashSet<>();
|
||||
|
||||
for (CredentialDescriptionRegistry.FilterResult filterResult : filterResults) {
|
||||
Set<String> registeredUnflattenedStrings = CredentialDescriptionRegistry
|
||||
.flatStringToSet(filterResult.mFlattenedRequest);
|
||||
for (CredentialOption credentialOption : options) {
|
||||
if (filterResult.mFlattenedRequest.equals(credentialOption
|
||||
.getCredentialRetrievalData()
|
||||
.getString(CredentialOption.FLATTENED_REQUEST))) {
|
||||
Set<String> requestedUnflattenedStrings = CredentialDescriptionRegistry
|
||||
.flatStringToSet(credentialOption
|
||||
.getCredentialRetrievalData()
|
||||
.getString(CredentialOption.FLATTENED_REQUEST));
|
||||
if (CredentialDescriptionRegistry.checkForMatch(registeredUnflattenedStrings,
|
||||
requestedUnflattenedStrings)) {
|
||||
result.add(new Pair<>(credentialOption, filterResult));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,10 @@ abstract class RequestSession<T, U> implements CredentialManagerUi.CredentialMan
|
||||
this.mInitialPhaseMetric.setCountRequestClassType(requestClassType);
|
||||
}
|
||||
|
||||
public void addProviderSession(ComponentName componentName, ProviderSession providerSession) {
|
||||
mProviders.put(componentName.flattenToString(), providerSession);
|
||||
}
|
||||
|
||||
// UI callbacks
|
||||
|
||||
@Override // from CredentialManagerUiCallbacks
|
||||
|
||||
Reference in New Issue
Block a user