Multiuser perfetto metric: Settings tracepoints

Add tracepoints in Settings for user switches and creation, for the
primary purpose of performance metrics in trace_processor.

Bug: 192001071
Test: manual
Change-Id: I1ecaccdaba3b14c42a45fefeb9b5568f7c7d6bf6
This commit is contained in:
Adam Bookatz
2021-11-08 17:11:52 -08:00
parent e4e252aa95
commit c2efde5fb0
2 changed files with 12 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ import android.content.Context;
import android.content.pm.UserInfo;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.Trace;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;
@@ -344,6 +345,7 @@ public class UserDetailsSettings extends SettingsPreferenceFragment
@VisibleForTesting
void switchUser() {
Trace.beginSection("UserDetailSettings.switchUser");
try {
if (mUserInfo.isGuest()) {
mMetricsFeatureProvider.action(getActivity(), SettingsEnums.ACTION_SWITCH_TO_GUEST);
@@ -352,6 +354,7 @@ public class UserDetailsSettings extends SettingsPreferenceFragment
} catch (RemoteException re) {
Log.e(TAG, "Error while switching to other user.");
} finally {
Trace.endSection();
finishFragment();
}
}