Merge "Gracefully failing Exceptions during logging" into udc-dev am: 6789d00256
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21894823 Change-Id: I42875eca99c6e55c3636381bf5db56f2d8dfe360 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -90,33 +90,37 @@ public class MetricUtilities {
|
|||||||
protected static void logApiCalled(ApiName apiName, ApiStatus apiStatus,
|
protected static void logApiCalled(ApiName apiName, ApiStatus apiStatus,
|
||||||
Map<String, ProviderSession> providers, int callingUid,
|
Map<String, ProviderSession> providers, int callingUid,
|
||||||
ChosenProviderMetric chosenProviderMetric) {
|
ChosenProviderMetric chosenProviderMetric) {
|
||||||
var providerSessions = providers.values();
|
try {
|
||||||
int providerSize = providerSessions.size();
|
var providerSessions = providers.values();
|
||||||
int[] candidateUidList = new int[providerSize];
|
int providerSize = providerSessions.size();
|
||||||
int[] candidateQueryRoundTripTimeList = new int[providerSize];
|
int[] candidateUidList = new int[providerSize];
|
||||||
int[] candidateStatusList = new int[providerSize];
|
int[] candidateQueryRoundTripTimeList = new int[providerSize];
|
||||||
int index = 0;
|
int[] candidateStatusList = new int[providerSize];
|
||||||
for (var session : providerSessions) {
|
int index = 0;
|
||||||
CandidateProviderMetric metric = session.mCandidateProviderMetric;
|
for (var session : providerSessions) {
|
||||||
candidateUidList[index] = metric.getCandidateUid();
|
CandidateProviderMetric metric = session.mCandidateProviderMetric;
|
||||||
candidateQueryRoundTripTimeList[index] = metric.getQueryLatencyMicroseconds();
|
candidateUidList[index] = metric.getCandidateUid();
|
||||||
candidateStatusList[index] = metric.getProviderQueryStatus();
|
candidateQueryRoundTripTimeList[index] = metric.getQueryLatencyMicroseconds();
|
||||||
index++;
|
candidateStatusList[index] = metric.getProviderQueryStatus();
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
FrameworkStatsLog.write(FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED,
|
||||||
|
/* api_name */apiName.getMetricCode(),
|
||||||
|
/* caller_uid */ callingUid,
|
||||||
|
/* api_status */ apiStatus.getMetricCode(),
|
||||||
|
/* repeated_candidate_provider_uid */ candidateUidList,
|
||||||
|
/* repeated_candidate_provider_round_trip_time_query_microseconds */
|
||||||
|
candidateQueryRoundTripTimeList,
|
||||||
|
/* repeated_candidate_provider_status */ candidateStatusList,
|
||||||
|
/* chosen_provider_uid */ chosenProviderMetric.getChosenUid(),
|
||||||
|
/* chosen_provider_round_trip_time_overall_microseconds */
|
||||||
|
chosenProviderMetric.getEntireProviderLatencyMicroseconds(),
|
||||||
|
/* chosen_provider_final_phase_microseconds (backwards compat only) */
|
||||||
|
DEFAULT_INT_32,
|
||||||
|
/* chosen_provider_status */ chosenProviderMetric.getChosenProviderStatus());
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.w(TAG, "Unexpected error during metric logging: " + e);
|
||||||
}
|
}
|
||||||
FrameworkStatsLog.write(FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED,
|
|
||||||
/* api_name */apiName.getMetricCode(),
|
|
||||||
/* caller_uid */ callingUid,
|
|
||||||
/* api_status */ apiStatus.getMetricCode(),
|
|
||||||
/* repeated_candidate_provider_uid */ candidateUidList,
|
|
||||||
/* repeated_candidate_provider_round_trip_time_query_microseconds */
|
|
||||||
candidateQueryRoundTripTimeList,
|
|
||||||
/* repeated_candidate_provider_status */ candidateStatusList,
|
|
||||||
/* chosen_provider_uid */ chosenProviderMetric.getChosenUid(),
|
|
||||||
/* chosen_provider_round_trip_time_overall_microseconds */
|
|
||||||
chosenProviderMetric.getEntireProviderLatencyMicroseconds(),
|
|
||||||
/* chosen_provider_final_phase_microseconds (backwards compat only) */
|
|
||||||
DEFAULT_INT_32,
|
|
||||||
/* chosen_provider_status */ chosenProviderMetric.getChosenProviderStatus());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -131,20 +135,24 @@ public class MetricUtilities {
|
|||||||
*/
|
*/
|
||||||
protected static void logApiCalled(ApiName apiName, ApiStatus apiStatus,
|
protected static void logApiCalled(ApiName apiName, ApiStatus apiStatus,
|
||||||
int callingUid) {
|
int callingUid) {
|
||||||
FrameworkStatsLog.write(FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED,
|
try {
|
||||||
/* api_name */apiName.getMetricCode(),
|
FrameworkStatsLog.write(FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED,
|
||||||
/* caller_uid */ callingUid,
|
/* api_name */apiName.getMetricCode(),
|
||||||
/* api_status */ apiStatus.getMetricCode(),
|
/* caller_uid */ callingUid,
|
||||||
/* repeated_candidate_provider_uid */ DEFAULT_REPEATED_INT_32,
|
/* api_status */ apiStatus.getMetricCode(),
|
||||||
/* repeated_candidate_provider_round_trip_time_query_microseconds */
|
/* repeated_candidate_provider_uid */ DEFAULT_REPEATED_INT_32,
|
||||||
DEFAULT_REPEATED_INT_32,
|
/* repeated_candidate_provider_round_trip_time_query_microseconds */
|
||||||
/* repeated_candidate_provider_status */ DEFAULT_REPEATED_INT_32,
|
DEFAULT_REPEATED_INT_32,
|
||||||
/* chosen_provider_uid */ DEFAULT_INT_32,
|
/* repeated_candidate_provider_status */ DEFAULT_REPEATED_INT_32,
|
||||||
/* chosen_provider_round_trip_time_overall_microseconds */
|
/* chosen_provider_uid */ DEFAULT_INT_32,
|
||||||
DEFAULT_INT_32,
|
/* chosen_provider_round_trip_time_overall_microseconds */
|
||||||
/* chosen_provider_final_phase_microseconds */
|
DEFAULT_INT_32,
|
||||||
DEFAULT_INT_32,
|
/* chosen_provider_final_phase_microseconds */
|
||||||
/* chosen_provider_status */ DEFAULT_INT_32);
|
DEFAULT_INT_32,
|
||||||
|
/* chosen_provider_status */ DEFAULT_INT_32);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.w(TAG, "Unexpected error during metric logging: " + e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user