Optimizing Log Messages

This aims to remove redundant messages, and converts logs to Slogs.
It considers the go/greenlog message.

Bug: 278591970
Bug: 270568738
Test: Build Test (Log statements only)
Change-Id: I4a175501cb2cb85891c31c9f31b31cbd17bcd870
This commit is contained in:
Arpan Kaphle
2023-04-25 20:30:51 +00:00
parent 79492ead51
commit b5ce61c19f
22 changed files with 96 additions and 122 deletions

View File

@@ -67,7 +67,7 @@ public final class ClearRequestSession extends RequestSession<ClearCredentialSta
.createNewSession(mContext, mUserId, providerInfo,
this, remoteCredentialService);
if (providerClearSession != null) {
Slog.d(TAG, "In startProviderSession - provider session created "
Slog.i(TAG, "Provider session created "
+ "and being added for: " + providerInfo.getComponentName());
mProviders.put(providerClearSession.getComponentName().flattenToString(),
providerClearSession);
@@ -78,12 +78,12 @@ public final class ClearRequestSession extends RequestSession<ClearCredentialSta
@Override // from provider session
public void onProviderStatusChanged(ProviderSession.Status status,
ComponentName componentName, ProviderSession.CredentialsSource source) {
Slog.d(TAG, "in onStatusChanged with status: " + status + ", and source: " + source);
Slog.i(TAG, "Provider changed with status: " + status + ", and source: " + source);
if (ProviderSession.isTerminatingStatus(status)) {
Slog.d(TAG, "in onProviderStatusChanged terminating status");
Slog.i(TAG, "Provider terminating status");
onProviderTerminated(componentName);
} else if (ProviderSession.isCompletionStatus(status)) {
Slog.d(TAG, "in onProviderStatusChanged isCompletionStatus status");
Slog.i(TAG, "Provider has completion status");
onProviderResponseComplete(componentName);
}
}

View File

@@ -79,7 +79,7 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR
.createNewSession(mContext, mUserId, providerInfo,
this, remoteCredentialService);
if (providerCreateSession != null) {
Slog.d(TAG, "In initiateProviderSession - provider session created and "
Slog.i(TAG, "Provider session created and "
+ "being added for: " + providerInfo.getComponentName());
mProviders.put(providerCreateSession.getComponentName().flattenToString(),
providerCreateSession);
@@ -127,7 +127,7 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR
@Override
public void onFinalResponseReceived(ComponentName componentName,
@Nullable CreateCredentialResponse response) {
Slog.d(TAG, "onFinalCredentialReceived from: " + componentName.flattenToString());
Slog.i(TAG, "Final credential received from: " + componentName.flattenToString());
mRequestSessionMetric.collectUiResponseData(/*uiReturned=*/ true, System.nanoTime());
mRequestSessionMetric.collectChosenMetricViaCandidateTransfer(mProviders.get(
componentName.flattenToString()).mProviderSessionMetric
@@ -170,13 +170,13 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR
@Override
public void onProviderStatusChanged(ProviderSession.Status status,
ComponentName componentName, ProviderSession.CredentialsSource source) {
Slog.d(TAG, "in onStatusChanged with status: " + status + ", and source: " + source);
Slog.i(TAG, "Provider status changed: " + status + ", and source: " + source);
// If all provider responses have been received, we can either need the UI,
// or we need to respond with error. The only other case is the entry being
// selected after the UI has been invoked which has a separate code path.
if (!isAnyProviderPending()) {
if (isUiInvocationNeeded()) {
Slog.d(TAG, "in onProviderStatusChanged - isUiInvocationNeeded");
Slog.i(TAG, "Provider status changed - ui invocation is needed");
getProviderDataAndInitiateUi();
} else {
respondToClientWithErrorAndFinish(CreateCredentialException.TYPE_NO_CREATE_OPTIONS,

View File

@@ -436,7 +436,7 @@ public final class CredentialManagerService
IGetCredentialCallback callback,
final String callingPackage) {
final long timestampBegan = System.nanoTime();
Slog.d(TAG, "starting executeGetCredential with callingPackage: "
Slog.i(TAG, "starting executeGetCredential with callingPackage: "
+ callingPackage);
ICancellationSignal cancelTransport = CancellationSignal.createTransport();
@@ -471,7 +471,7 @@ public final class CredentialManagerService
GetCredentialException.TYPE_NO_CREDENTIAL,
"No credentials available on this device.");
} catch (RemoteException e) {
Slog.i(
Slog.e(
TAG,
"Issue invoking onError on IGetCredentialCallback "
+ "callback: "
@@ -527,7 +527,7 @@ public final class CredentialManagerService
false, null,
false, false, null));
} catch (RemoteException e) {
Slog.i(
Slog.e(
TAG,
"Issue invoking onError on IGetCredentialCallback "
+ "callback: "
@@ -606,7 +606,7 @@ public final class CredentialManagerService
ICreateCredentialCallback callback,
String callingPackage) {
final long timestampBegan = System.nanoTime();
Slog.d(TAG, "starting executeCreateCredential with callingPackage: "
Slog.i(TAG, "starting executeCreateCredential with callingPackage: "
+ callingPackage);
ICancellationSignal cancelTransport = CancellationSignal.createTransport();
@@ -672,7 +672,7 @@ public final class CredentialManagerService
MetricUtilities.logApiCalledInitialPhase(initMetric,
session.mRequestSessionMetric.returnIncrementSequence());
} catch (Exception e) {
Slog.w(TAG, "Unexpected error during metric logging: ", e);
Slog.i(TAG, "Unexpected error during metric logging: ", e);
}
}
@@ -732,7 +732,7 @@ public final class CredentialManagerService
@Override
public boolean isEnabledCredentialProviderService(
ComponentName componentName, String callingPackage) {
Slog.d(TAG, "isEnabledCredentialProviderService with componentName: "
Slog.i(TAG, "isEnabledCredentialProviderService with componentName: "
+ componentName.flattenToString());
// TODO(253157366): Check additional set of services.
@@ -828,7 +828,7 @@ public final class CredentialManagerService
IClearCredentialStateCallback callback,
String callingPackage) {
final long timestampBegan = System.nanoTime();
Slog.d(TAG, "starting clearCredentialState with callingPackage: "
Slog.i(TAG, "starting clearCredentialState with callingPackage: "
+ callingPackage);
final int userId = UserHandle.getCallingUserId();
int callingUid = Binder.getCallingUid();
@@ -881,7 +881,7 @@ public final class CredentialManagerService
public void registerCredentialDescription(
RegisterCredentialDescriptionRequest request, String callingPackage)
throws IllegalArgumentException, NonCredentialProviderCallerException {
Slog.d(TAG, "registerCredentialDescription with callingPackage: " + callingPackage);
Slog.i(TAG, "registerCredentialDescription with callingPackage: " + callingPackage);
if (!isCredentialDescriptionApiEnabled()) {
throw new UnsupportedOperationException();
@@ -899,7 +899,7 @@ public final class CredentialManagerService
public void unregisterCredentialDescription(
UnregisterCredentialDescriptionRequest request, String callingPackage)
throws IllegalArgumentException {
Slog.d(TAG, "unregisterCredentialDescription with callingPackage: "
Slog.i(TAG, "unregisterCredentialDescription with callingPackage: "
+ callingPackage);
@@ -961,7 +961,6 @@ public final class CredentialManagerService
@Override
@GuardedBy("mLock")
public void onFinishRequestSession(@UserIdInt int userId, IBinder token) {
Slog.i(TAG, "In onFinishRequestSession");
if (mRequestSessions.get(userId) != null) {
mRequestSessions.get(userId).remove(token);
}

View File

@@ -48,7 +48,7 @@ public final class CredentialManagerServiceImpl extends
@NonNull Object lock, int userId, String serviceName)
throws PackageManager.NameNotFoundException {
super(master, lock, userId);
Slog.d(TAG, "CredentialManagerServiceImpl constructed for: " + serviceName);
Slog.i(TAG, "CredentialManagerServiceImpl constructed for: " + serviceName);
synchronized (mLock) {
newServiceInfoLocked(ComponentName.unflattenFromString(serviceName));
}
@@ -63,7 +63,7 @@ public final class CredentialManagerServiceImpl extends
@NonNull CredentialManagerService master,
@NonNull Object lock, int userId, CredentialProviderInfo providerInfo) {
super(master, lock, userId);
Slog.d(TAG, "CredentialManagerServiceImpl constructed for: "
Slog.i(TAG, "CredentialManagerServiceImpl constructed for: "
+ providerInfo.getServiceInfo().getComponentName().flattenToString());
mInfo = providerInfo;
}
@@ -74,11 +74,11 @@ public final class CredentialManagerServiceImpl extends
throws PackageManager.NameNotFoundException {
// TODO : Test update flows with multiple providers
if (mInfo != null) {
Slog.d(TAG, "newServiceInfoLocked, mInfo not null : "
Slog.i(TAG, "newServiceInfoLocked, mInfo not null : "
+ mInfo.getServiceInfo().getComponentName().flattenToString() + " , "
+ serviceComponent.flattenToString());
} else {
Slog.d(TAG, "newServiceInfoLocked, mInfo null, "
Slog.i(TAG, "newServiceInfoLocked, mInfo null, "
+ serviceComponent.flattenToString());
}
mInfo = CredentialProviderInfoFactory.create(
@@ -95,11 +95,11 @@ public final class CredentialManagerServiceImpl extends
public ProviderSession initiateProviderSessionForRequestLocked(
RequestSession requestSession, List<String> requestOptions) {
if (!requestOptions.isEmpty() && !isServiceCapableLocked(requestOptions)) {
Slog.d(TAG, "Service does not have the required capabilities");
Slog.i(TAG, "Service does not have the required capabilities");
return null;
}
if (mInfo == null) {
Slog.w(TAG, "in initiateProviderSessionForRequest in CredManServiceImpl, "
Slog.w(TAG, "Initiating provider session for request "
+ "but mInfo is null. This shouldn't happen");
return null;
}

View File

@@ -72,7 +72,7 @@ public class GetRequestSession extends RequestSession<GetCredentialRequest,
.createNewSession(mContext, mUserId, providerInfo,
this, remoteCredentialService);
if (providerGetSession != null) {
Slog.d(TAG, "In startProviderSession - provider session created and "
Slog.i(TAG, "Provider session created and "
+ "being added for: " + providerInfo.getComponentName());
mProviders.put(providerGetSession.getComponentName().flattenToString(),
providerGetSession);
@@ -114,7 +114,7 @@ public class GetRequestSession extends RequestSession<GetCredentialRequest,
@Override
public void onFinalResponseReceived(ComponentName componentName,
@Nullable GetCredentialResponse response) {
Slog.d(TAG, "onFinalResponseReceived from: " + componentName.flattenToString());
Slog.i(TAG, "onFinalResponseReceived from: " + componentName.flattenToString());
mRequestSessionMetric.collectUiResponseData(/*uiReturned=*/ true, System.nanoTime());
mRequestSessionMetric.collectChosenMetricViaCandidateTransfer(
mProviders.get(componentName.flattenToString())
@@ -158,7 +158,7 @@ public class GetRequestSession extends RequestSession<GetCredentialRequest,
@Override
public void onProviderStatusChanged(ProviderSession.Status status,
ComponentName componentName, ProviderSession.CredentialsSource source) {
Slog.d(TAG, "in onStatusChanged for: " + componentName + ", with status: "
Slog.i(TAG, "Status changed for: " + componentName + ", with status: "
+ status + ", and source: " + source);
// Auth entry was selected, and it did not have any underlying credentials
@@ -172,7 +172,7 @@ public class GetRequestSession extends RequestSession<GetCredentialRequest,
// or we need to respond with error. The only other case is the entry being
// selected after the UI has been invoked which has a separate code path.
if (isUiInvocationNeeded()) {
Slog.d(TAG, "in onProviderStatusChanged - isUiInvocationNeeded");
Slog.i(TAG, "Provider status changed - ui invocation is needed");
getProviderDataAndInitiateUi();
} else {
respondToClientWithErrorAndFinish(GetCredentialException.TYPE_NO_CREDENTIAL,

View File

@@ -169,7 +169,7 @@ public class MetricUtilities {
DEFAULT_STRING
);
} catch (Exception e) {
Slog.w(TAG, "Unexpected error during metric logging: " + e);
Slog.w(TAG, "Unexpected error during final provider uid emit: " + e);
}
}
@@ -269,7 +269,7 @@ public class MetricUtilities {
initialPhaseMetric.getUniqueRequestCounts()
);
} catch (Exception e) {
Slog.w(TAG, "Unexpected error during metric logging: " + e);
Slog.w(TAG, "Unexpected error during candidate provider uid metric emit: " + e);
}
}
@@ -338,7 +338,7 @@ public class MetricUtilities {
initialPhaseMetric.isOriginSpecified()
);
} catch (Exception e) {
Slog.w(TAG, "Unexpected error during metric logging: " + e);
Slog.w(TAG, "Unexpected error during initial metric emit: " + e);
}
}
}

View File

@@ -66,7 +66,7 @@ public class PrepareGetRequestSession extends GetRequestSession {
@Override
public void onProviderStatusChanged(ProviderSession.Status status, ComponentName componentName,
ProviderSession.CredentialsSource source) {
Slog.d(TAG, "in onProviderStatusChanged with status: " + status + ", and "
Slog.i(TAG, "Provider Status changed with status: " + status + ", and "
+ "source: " + source);
switch (source) {

View File

@@ -80,7 +80,7 @@ public final class ProviderClearSession extends ProviderSession<ClearCredentialS
@Override
public void onProviderResponseSuccess(@Nullable Void response) {
Slog.d(TAG, "Remote provider responded with a valid response: " + mComponentName);
Slog.i(TAG, "Remote provider responded with a valid response: " + mComponentName);
mProviderResponseSet = true;
updateStatusAndInvokeCallback(Status.COMPLETE,
/*source=*/ CredentialsSource.REMOTE_PROVIDER);

View File

@@ -93,7 +93,7 @@ public final class ProviderCreateSession extends ProviderSession<
createRequestSession.mHybridService
);
}
Slog.d(TAG, "Unable to create provider session for: "
Slog.i(TAG, "Unable to create provider session for: "
+ providerInfo.getComponentName());
return null;
}
@@ -153,7 +153,7 @@ public final class ProviderCreateSession extends ProviderSession<
@Override
public void onProviderResponseSuccess(
@Nullable BeginCreateCredentialResponse response) {
Slog.d(TAG, "Remote provider responded with a valid response: " + mComponentName);
Slog.i(TAG, "Remote provider responded with a valid response: " + mComponentName);
onSetInitialRemoteResponse(response);
}
@@ -208,7 +208,7 @@ public final class ProviderCreateSession extends ProviderSession<
protected CreateCredentialProviderData prepareUiData()
throws IllegalArgumentException {
if (!ProviderSession.isUiInvokingStatus(getStatus())) {
Slog.d(TAG, "No data for UI from: " + mComponentName.flattenToString());
Slog.i(TAG, "No data for UI from: " + mComponentName.flattenToString());
return null;
}
@@ -224,7 +224,7 @@ public final class ProviderCreateSession extends ProviderSession<
switch (entryType) {
case SAVE_ENTRY_KEY:
if (mProviderResponseDataHandler.getCreateEntry(entryKey) == null) {
Slog.w(TAG, "Unexpected save entry key");
Slog.i(TAG, "Unexpected save entry key");
invokeCallbackOnInternalInvalidState();
return;
}
@@ -232,14 +232,14 @@ public final class ProviderCreateSession extends ProviderSession<
break;
case REMOTE_ENTRY_KEY:
if (mProviderResponseDataHandler.getRemoteEntry(entryKey) == null) {
Slog.w(TAG, "Unexpected remote entry key");
Slog.i(TAG, "Unexpected remote entry key");
invokeCallbackOnInternalInvalidState();
return;
}
onRemoteEntrySelected(providerPendingIntentResponse);
break;
default:
Slog.w(TAG, "Unsupported entry type selected");
Slog.i(TAG, "Unsupported entry type selected");
invokeCallbackOnInternalInvalidState();
}
}
@@ -274,7 +274,7 @@ public final class ProviderCreateSession extends ProviderSession<
if (credentialResponse != null) {
mCallbacks.onFinalResponseReceived(mComponentName, credentialResponse);
} else {
Slog.w(TAG, "onSaveEntrySelected - no response or error found in pending "
Slog.i(TAG, "onSaveEntrySelected - no response or error found in pending "
+ "intent response");
invokeCallbackOnInternalInvalidState();
}
@@ -290,14 +290,14 @@ public final class ProviderCreateSession extends ProviderSession<
private CreateCredentialException maybeGetPendingIntentException(
ProviderPendingIntentResponse pendingIntentResponse) {
if (pendingIntentResponse == null) {
Slog.w(TAG, "pendingIntentResponse is null");
Slog.i(TAG, "pendingIntentResponse is null");
return new CreateCredentialException(CreateCredentialException.TYPE_NO_CREATE_OPTIONS);
}
if (PendingIntentResultHandler.isValidResponse(pendingIntentResponse)) {
CreateCredentialException exception = PendingIntentResultHandler
.extractCreateCredentialException(pendingIntentResponse.getResultData());
if (exception != null) {
Slog.d(TAG, "Pending intent contains provider exception");
Slog.i(TAG, "Pending intent contains provider exception");
return exception;
}
} else if (PendingIntentResultHandler.isCancelledResponse(pendingIntentResponse)) {

View File

@@ -114,7 +114,7 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential
getRequestSession.mHybridService
);
}
Slog.d(TAG, "Unable to create provider session for: "
Slog.i(TAG, "Unable to create provider session for: "
+ providerInfo.getComponentName());
return null;
}
@@ -146,13 +146,13 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential
android.credentials.GetCredentialRequest clientRequest,
CredentialProviderInfo info
) {
Slog.d(TAG, "Filtering request options for: " + info.getComponentName());
Slog.i(TAG, "Filtering request options for: " + info.getComponentName());
List<CredentialOption> filteredOptions = new ArrayList<>();
for (CredentialOption option : clientRequest.getCredentialOptions()) {
if (providerCapabilities.contains(option.getType())
&& isProviderAllowed(option, info.getComponentName())
&& checkSystemProviderRequirement(option, info.isSystemProvider())) {
Slog.d(TAG, "Option of type: " + option.getType() + " meets all filtering"
Slog.i(TAG, "Option of type: " + option.getType() + " meets all filtering"
+ "conditions");
filteredOptions.add(option);
}
@@ -163,14 +163,14 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential
.setCredentialOptions(
filteredOptions).build();
}
Slog.d(TAG, "No options filtered");
Slog.i(TAG, "No options filtered");
return null;
}
private static boolean isProviderAllowed(CredentialOption option, ComponentName componentName) {
if (!option.getAllowedProviders().isEmpty() && !option.getAllowedProviders().contains(
componentName)) {
Slog.d(TAG, "Provider allow list specified but does not contain this provider");
Slog.i(TAG, "Provider allow list specified but does not contain this provider");
return false;
}
return true;
@@ -179,7 +179,7 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential
private static boolean checkSystemProviderRequirement(CredentialOption option,
boolean isSystemProvider) {
if (option.isSystemProviderRequired() && !isSystemProvider) {
Slog.d(TAG, "System provider required, but this service is not a system provider");
Slog.i(TAG, "System provider required, but this service is not a system provider");
return false;
}
return true;
@@ -207,7 +207,7 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential
/** Called when the provider response has been updated by an external source. */
@Override // Callback from the remote provider
public void onProviderResponseSuccess(@Nullable BeginGetCredentialResponse response) {
Slog.d(TAG, "Remote provider responded with a valid response: " + mComponentName);
Slog.i(TAG, "Remote provider responded with a valid response: " + mComponentName);
onSetInitialRemoteResponse(response);
}
@@ -244,14 +244,14 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential
@Override // Selection call from the request provider
protected void onUiEntrySelected(String entryType, String entryKey,
ProviderPendingIntentResponse providerPendingIntentResponse) {
Slog.d(TAG, "onUiEntrySelected with entryType: " + entryType + ", and entryKey: "
Slog.i(TAG, "onUiEntrySelected with entryType: " + entryType + ", and entryKey: "
+ entryKey);
switch (entryType) {
case CREDENTIAL_ENTRY_KEY:
CredentialEntry credentialEntry = mProviderResponseDataHandler
.getCredentialEntry(entryKey);
if (credentialEntry == null) {
Slog.w(TAG, "Unexpected credential entry key");
Slog.i(TAG, "Unexpected credential entry key");
invokeCallbackOnInternalInvalidState();
return;
}
@@ -260,7 +260,7 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential
case ACTION_ENTRY_KEY:
Action actionEntry = mProviderResponseDataHandler.getActionEntry(entryKey);
if (actionEntry == null) {
Slog.w(TAG, "Unexpected action entry key");
Slog.i(TAG, "Unexpected action entry key");
invokeCallbackOnInternalInvalidState();
return;
}
@@ -270,21 +270,21 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential
Action authenticationEntry = mProviderResponseDataHandler
.getAuthenticationAction(entryKey);
if (authenticationEntry == null) {
Slog.w(TAG, "Unexpected authenticationEntry key");
Slog.i(TAG, "Unexpected authenticationEntry key");
invokeCallbackOnInternalInvalidState();
return;
}
boolean additionalContentReceived =
onAuthenticationEntrySelected(providerPendingIntentResponse);
if (additionalContentReceived) {
Slog.d(TAG, "Additional content received - removing authentication entry");
Slog.i(TAG, "Additional content received - removing authentication entry");
mProviderResponseDataHandler.removeAuthenticationAction(entryKey);
if (!mProviderResponseDataHandler.isEmptyResponse()) {
updateStatusAndInvokeCallback(Status.CREDENTIALS_RECEIVED,
/*source=*/ CredentialsSource.AUTH_ENTRY);
}
} else {
Slog.d(TAG, "Additional content not received from authentication entry");
Slog.i(TAG, "Additional content not received from authentication entry");
mProviderResponseDataHandler
.updateAuthEntryWithNoCredentialsReceived(entryKey);
updateStatusAndInvokeCallback(Status.NO_CREDENTIALS_FROM_AUTH_ENTRY,
@@ -295,12 +295,12 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential
if (mProviderResponseDataHandler.getRemoteEntry(entryKey) != null) {
onRemoteEntrySelected(providerPendingIntentResponse);
} else {
Slog.d(TAG, "Unexpected remote entry key");
Slog.i(TAG, "Unexpected remote entry key");
invokeCallbackOnInternalInvalidState();
}
break;
default:
Slog.w(TAG, "Unsupported entry type selected");
Slog.i(TAG, "Unsupported entry type selected");
invokeCallbackOnInternalInvalidState();
}
}
@@ -322,13 +322,12 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential
@Nullable
protected GetCredentialProviderData prepareUiData() throws IllegalArgumentException {
if (!ProviderSession.isUiInvokingStatus(getStatus())) {
Slog.d(TAG, "No data for UI from: " + mComponentName.flattenToString());
Slog.i(TAG, "No data for UI from: " + mComponentName.flattenToString());
return null;
}
if (mProviderResponse != null && !mProviderResponseDataHandler.isEmptyResponse()) {
return mProviderResponseDataHandler.toGetCredentialProviderData();
}
Slog.d(TAG, "In prepareUiData response null");
return null;
}
@@ -381,7 +380,7 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential
getCredentialResponse);
return;
}
Slog.d(TAG, "Pending intent response contains no credential, or error "
Slog.i(TAG, "Pending intent response contains no credential, or error "
+ "for a credential entry");
invokeCallbackOnInternalInvalidState();
}
@@ -459,7 +458,7 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential
/** Returns true if either an exception or a response is found. */
private void onActionEntrySelected(ProviderPendingIntentResponse
providerPendingIntentResponse) {
Slog.d(TAG, "onActionEntrySelected");
Slog.i(TAG, "onActionEntrySelected");
onCredentialEntrySelected(providerPendingIntentResponse);
}

View File

@@ -171,11 +171,11 @@ public class ProviderRegistryGetSession extends ProviderSession<CredentialOption
@Override
protected ProviderData prepareUiData() {
if (!ProviderSession.isUiInvokingStatus(getStatus())) {
Slog.d(TAG, "No date for UI coming from: " + mComponentName.flattenToString());
Slog.i(TAG, "No date for UI coming from: " + mComponentName.flattenToString());
return null;
}
if (mProviderResponse == null) {
Slog.w(TAG, "In prepareUiData but response is null. This is strange.");
Slog.w(TAG, "response is null when preparing ui data. This is strange.");
return null;
}
return new GetCredentialProviderData.Builder(
@@ -196,13 +196,13 @@ public class ProviderRegistryGetSession extends ProviderSession<CredentialOption
case CREDENTIAL_ENTRY_KEY:
CredentialEntry credentialEntry = mUiCredentialEntries.get(entryKey);
if (credentialEntry == null) {
Slog.w(TAG, "Unexpected credential entry key");
Slog.i(TAG, "Unexpected credential entry key");
return;
}
onCredentialEntrySelected(credentialEntry, providerPendingIntentResponse);
break;
default:
Slog.w(TAG, "Unsupported entry type selected");
Slog.i(TAG, "Unsupported entry type selected");
}
}
@@ -279,7 +279,7 @@ public class ProviderRegistryGetSession extends ProviderSession<CredentialOption
GetCredentialException exception = PendingIntentResultHandler
.extractGetCredentialException(pendingIntentResponse.getResultData());
if (exception != null) {
Slog.d(TAG, "Pending intent contains provider exception");
Slog.i(TAG, "Pending intent contains provider exception");
return exception;
}
} else if (PendingIntentResultHandler.isCancelledResponse(pendingIntentResponse)) {

View File

@@ -292,13 +292,13 @@ public class RemoteCredentialService extends ServiceConnector.Impl<ICredentialPr
callback.onProviderResponseSuccess(result);
} else {
if (error instanceof TimeoutException) {
Slog.d(TAG, "Remote provider response timed tuo for: " + mComponentName);
Slog.i(TAG, "Remote provider response timed tuo for: " + mComponentName);
dispatchCancellationSignal(cancellationSink.get());
callback.onProviderResponseFailure(
CredentialProviderErrors.ERROR_TIMEOUT,
null);
} else if (error instanceof CancellationException) {
Slog.d(TAG, "Cancellation exception for remote provider: " + mComponentName);
Slog.i(TAG, "Cancellation exception for remote provider: " + mComponentName);
dispatchCancellationSignal(cancellationSink.get());
callback.onProviderResponseFailure(
CredentialProviderErrors.ERROR_TASK_CANCELED,

View File

@@ -201,7 +201,7 @@ abstract class RequestSession<T, U, V> implements CredentialManagerUi.Credential
}
protected void finishSession(boolean propagateCancellation) {
Slog.d(TAG, "finishing session with propagateCancellation " + propagateCancellation);
Slog.i(TAG, "finishing session with propagateCancellation " + propagateCancellation);
if (propagateCancellation) {
mProviders.values().forEach(ProviderSession::cancelProviderRemoteSession);
}
@@ -265,7 +265,7 @@ abstract class RequestSession<T, U, V> implements CredentialManagerUi.Credential
@NonNull
protected ArrayList<ProviderData> getProviderDataForUi() {
Slog.d(TAG, "In getProviderDataAndInitiateUi providers size: " + mProviders.size());
Slog.i(TAG, "For ui, provider data size: " + mProviders.size());
ArrayList<ProviderData> providerDataList = new ArrayList<>();
mRequestSessionMetric.logCandidatePhaseMetrics(mProviders);

View File

@@ -27,7 +27,7 @@ import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_INI
import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_UNKNOWN;
import android.credentials.ui.RequestInfo;
import android.util.Log;
import android.util.Slog;
import java.util.AbstractMap;
import java.util.Map;
@@ -79,7 +79,7 @@ CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_IS_ENABLED_CREDENT
*/
public static int getMetricCodeFromRequestInfo(String stringKey) {
if (!sRequestInfoToMetric.containsKey(stringKey)) {
Log.w(TAG, "Attempted to use an unsupported string key request info");
Slog.i(TAG, "Attempted to use an unsupported string key request info");
return UNKNOWN.mInnerMetricCode;
}
return sRequestInfoToMetric.get(stringKey);

View File

@@ -27,8 +27,6 @@ package com.android.server.credentials.metrics;
* though collection will begin in the candidate phase when the user begins browsing options.
*/
public class CandidateBrowsingPhaseMetric {
private static final String TAG = "CandidateBrowsingPhaseMetric";
// The session id associated with the API Call this candidate provider is a part of, default -1
private int mSessionId = -1;
// The EntryEnum that was pressed, defaults to -1

View File

@@ -16,7 +16,7 @@
package com.android.server.credentials.metrics;
import android.util.Log;
import android.util.Slog;
import com.android.server.credentials.MetricUtilities;
import com.android.server.credentials.metrics.shared.ResponseCollective;
@@ -112,7 +112,7 @@ public class CandidatePhaseMetric {
*/
public int getTimestampFromReferenceStartMicroseconds(long specificTimestamp) {
if (specificTimestamp < mServiceBeganTimeNanoseconds) {
Log.i(TAG, "The timestamp is before service started, falling back to default int");
Slog.i(TAG, "The timestamp is before service started, falling back to default int");
return MetricUtilities.DEFAULT_INT_32;
}
return (int) ((specificTimestamp

View File

@@ -16,7 +16,7 @@
package com.android.server.credentials.metrics;
import android.util.Log;
import android.util.Slog;
import com.android.server.credentials.MetricUtilities;
import com.android.server.credentials.metrics.shared.ResponseCollective;
@@ -216,7 +216,7 @@ public class ChosenProviderFinalPhaseMetric {
*/
public int getTimestampFromReferenceStartMicroseconds(long specificTimestamp) {
if (specificTimestamp < mServiceBeganTimeNanoseconds) {
Log.i(TAG, "The timestamp is before service started, falling back to default int");
Slog.i(TAG, "The timestamp is before service started, falling back to default int");
return MetricUtilities.DEFAULT_INT_32;
}
return (int) ((specificTimestamp

View File

@@ -26,7 +26,7 @@ import static com.android.server.credentials.ProviderGetSession.AUTHENTICATION_A
import static com.android.server.credentials.ProviderGetSession.CREDENTIAL_ENTRY_KEY;
import static com.android.server.credentials.ProviderGetSession.REMOTE_ENTRY_KEY;
import android.util.Log;
import android.util.Slog;
import java.util.AbstractMap;
import java.util.Map;
@@ -77,7 +77,7 @@ public enum EntryEnum {
*/
public static int getMetricCodeFromString(String stringKey) {
if (!sKeyToEntryCode.containsKey(stringKey)) {
Log.w(TAG, "Attempted to use an unsupported string key entry type");
Slog.i(TAG, "Attempted to use an unsupported string key entry type");
return UNKNOWN.mInnerMetricCode;
}
return sKeyToEntryCode.get(stringKey);

View File

@@ -16,8 +16,6 @@
package com.android.server.credentials.metrics;
import android.util.Log;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -142,9 +140,6 @@ public class InitialPhaseMetric {
* @return a string array for deduped classtypes
*/
public String[] getUniqueRequestStrings() {
if (mRequestCounts.isEmpty()) {
Log.w(TAG, "There are no unique string request types collected");
}
String[] result = new String[mRequestCounts.keySet().size()];
mRequestCounts.keySet().toArray(result);
return result;
@@ -155,9 +150,6 @@ public class InitialPhaseMetric {
* @return a string array for deduped classtype counts
*/
public int[] getUniqueRequestCounts() {
if (mRequestCounts.isEmpty()) {
Log.w(TAG, "There are no unique string request type counts collected");
}
return mRequestCounts.values().stream().mapToInt(Integer::intValue).toArray();
}
}

View File

@@ -72,7 +72,7 @@ public class ProviderSessionMetric {
try {
mCandidatePhasePerProviderMetric.setFrameworkException(exceptionType);
} catch (Exception e) {
Slog.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error during candidate exception metric logging: " + e);
}
}
@@ -101,7 +101,7 @@ public class ProviderSessionMetric {
.getMetricCode());
}
} catch (Exception e) {
Slog.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error during candidate update metric logging: " + e);
}
}
@@ -122,7 +122,7 @@ public class ProviderSessionMetric {
initMetric.getCredentialServiceStartedTimeNanoseconds());
mCandidatePhasePerProviderMetric.setStartQueryTimeNanoseconds(System.nanoTime());
} catch (Exception e) {
Slog.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error during candidate setup metric logging: " + e);
}
}
@@ -144,9 +144,8 @@ public class ProviderSessionMetric {
} else {
Slog.i(TAG, "Your response type is unsupported for metric logging");
}
} catch (Exception e) {
Slog.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error during candidate entry metric logging: " + e);
}
}

View File

@@ -24,7 +24,7 @@ import static com.android.server.credentials.MetricUtilities.logApiCalledFinalPh
import android.credentials.GetCredentialRequest;
import android.credentials.ui.UserSelectionDialogResult;
import android.os.IBinder;
import android.util.Log;
import android.util.Slog;
import com.android.server.credentials.ProviderSession;
@@ -90,7 +90,7 @@ public class RequestSessionMetric {
mInitialPhaseMetric.setCallerUid(mCallingUid);
mInitialPhaseMetric.setApiName(metricCode);
} catch (Exception e) {
Log.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error collecting initial metrics: " + e);
}
}
@@ -103,7 +103,7 @@ public class RequestSessionMetric {
try {
mChosenProviderFinalPhaseMetric.setUiReturned(uiReturned);
} catch (Exception e) {
Log.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error collecting ui end time metric: " + e);
}
}
@@ -116,7 +116,7 @@ public class RequestSessionMetric {
try {
mChosenProviderFinalPhaseMetric.setUiCallStartTimeNanoseconds(uiCallStartTime);
} catch (Exception e) {
Log.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error collecting ui start metric: " + e);
}
}
@@ -132,7 +132,7 @@ public class RequestSessionMetric {
mChosenProviderFinalPhaseMetric.setUiReturned(uiReturned);
mChosenProviderFinalPhaseMetric.setUiCallEndTimeNanoseconds(uiEndTimestamp);
} catch (Exception e) {
Log.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error collecting ui response metric: " + e);
}
}
@@ -146,7 +146,7 @@ public class RequestSessionMetric {
try {
mChosenProviderFinalPhaseMetric.setChosenProviderStatus(status);
} catch (Exception e) {
Log.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error setting chosen provider status metric: " + e);
}
}
@@ -159,7 +159,7 @@ public class RequestSessionMetric {
try {
mInitialPhaseMetric.setOriginSpecified(origin);
} catch (Exception e) {
Log.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error collecting create flow metric: " + e);
}
}
@@ -175,7 +175,7 @@ public class RequestSessionMetric {
uniqueRequestCounts.put(optionKey, uniqueRequestCounts.get(optionKey) + 1);
});
} catch (Exception e) {
Log.w(TAG, "Unexpected error during get request metric logging: " + e);
Slog.i(TAG, "Unexpected error during get request metric logging: " + e);
}
return uniqueRequestCounts;
}
@@ -190,7 +190,7 @@ public class RequestSessionMetric {
mInitialPhaseMetric.setOriginSpecified(request.getOrigin() != null);
mInitialPhaseMetric.setRequestCounts(getRequestCountMap(request));
} catch (Exception e) {
Log.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error collecting get flow metric: " + e);
}
}
@@ -213,7 +213,7 @@ public class RequestSessionMetric {
browsingPhaseMetric.setProviderUid(selectedProviderPhaseMetric.getCandidateUid());
mCandidateBrowsingPhaseMetric.add(browsingPhaseMetric);
} catch (Exception e) {
Log.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error collecting browsing metric: " + e);
}
}
@@ -226,7 +226,7 @@ public class RequestSessionMetric {
try {
mChosenProviderFinalPhaseMetric.setHasException(exceptionBitFinalPhase);
} catch (Exception e) {
Log.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error setting final exception metric: " + e);
}
}
@@ -244,7 +244,7 @@ public class RequestSessionMetric {
mChosenProviderFinalPhaseMetric.setChosenProviderStatus(
finalStatus.getMetricCode());
} catch (Exception e) {
Log.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error during metric logging: " + e);
}
}
@@ -276,7 +276,7 @@ public class RequestSessionMetric {
candidatePhaseMetric.getResponseCollective());
mChosenProviderFinalPhaseMetric.setFinalFinishTimeNanoseconds(System.nanoTime());
} catch (Exception e) {
Log.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error during metric candidate to final transfer: " + e);
}
}
@@ -299,7 +299,7 @@ public class RequestSessionMetric {
/* apiStatus */ ApiStatus.FAILURE.getMetricCode());
}
} catch (Exception e) {
Log.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error during final metric failure emit: " + e);
}
}
@@ -313,7 +313,7 @@ public class RequestSessionMetric {
try {
logApiCalledCandidatePhase(providers, ++mSequenceCounter, mInitialPhaseMetric);
} catch (Exception e) {
Log.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error during candidate metric emit: " + e);
}
}
@@ -328,7 +328,7 @@ public class RequestSessionMetric {
apiStatus,
++mSequenceCounter);
} catch (Exception e) {
Log.w(TAG, "Unexpected error during metric logging: " + e);
Slog.i(TAG, "Unexpected error during final metric emit: " + e);
}
}

View File

@@ -17,7 +17,6 @@
package com.android.server.credentials.metrics.shared;
import android.annotation.NonNull;
import android.util.Slog;
import com.android.server.credentials.metrics.EntryEnum;
@@ -65,9 +64,6 @@ public class ResponseCollective {
* @return a string array for deduped classtypes
*/
public String[] getUniqueResponseStrings() {
if (mResponseCounts.isEmpty()) {
Slog.w(TAG, "There are no unique string response types collected");
}
String[] result = new String[mResponseCounts.keySet().size()];
mResponseCounts.keySet().toArray(result);
return result;
@@ -79,9 +75,6 @@ public class ResponseCollective {
* @return a string array for deduped classtype counts
*/
public int[] getUniqueResponseCounts() {
if (mResponseCounts.isEmpty()) {
Slog.w(TAG, "There are no unique string response type counts collected");
}
return mResponseCounts.values().stream().mapToInt(Integer::intValue).toArray();
}
@@ -90,9 +83,6 @@ public class ResponseCollective {
* @return an int array for deduped entries
*/
public int[] getUniqueEntries() {
if (mEntryCounts.isEmpty()) {
Slog.w(TAG, "There are no unique entry response types collected");
}
return mEntryCounts.keySet().stream().mapToInt(Enum::ordinal).toArray();
}
@@ -102,9 +92,6 @@ public class ResponseCollective {
* @return a string array for deduped classtype counts
*/
public int[] getUniqueEntryCounts() {
if (mEntryCounts.isEmpty()) {
Slog.w(TAG, "There are no unique entry response type counts collected");
}
return mEntryCounts.values().stream().mapToInt(Integer::intValue).toArray();
}