Improved user callbacks on SystemService:
* Renamed:
onStartUser() -> onUserStarting()
onStopUser() -> onUserStopping()
onSwitchUser() -> onUserSwitching()
onUnlockUser() -> onUserUnlocking()
onCleanupUser() -> onUserStopped()
isSupportedUser() -> isUserSupported()
* Added:
onUserUnlocked()
Tested on automotive, which uses the callbacks to dump user metrics:
$ adb shell dumpsys car_service --user-metrics
adb shell dumpsys car_service --user-metrics
* User Metrics *
no users starting
no users stopping
Last 10 started users
2020-02-21T19:44:47.101 - user=0 start=2020-02-21 19:44:45.357 unlocking=+885ms unlocked=+1s122ms
2020-02-21T19:44:56.376 - user=10 start=2020-02-21 19:44:47.380 switch=+209ms unlocking=+8s262ms unlocked=+8s994ms
2020-02-21T20:00:08.792 - user=11 start=2020-02-21 20:00:04.634 switch(from 10)=+351ms unlocking=+4s44ms unlocked=+4s156ms
Last 10 stopped users
2020-02-21T20:00:48.323 - user=10 stop=2020-02-21 20:00:16.741 shutdown=+31s581ms
Test: m update-api
Test: atest BackupManagerServiceTest
Test: manual verification (see above)
Fixes: 150001654
Change-Id: I8774c57620030b9aa8e7ec039a6a758ad56db368
diff --git a/services/api/current.txt b/services/api/current.txt
index 26a65f2..c9587a2 100644
--- a/services/api/current.txt
+++ b/services/api/current.txt
@@ -49,14 +49,15 @@
public abstract class SystemService {
ctor public SystemService(@NonNull android.content.Context);
method @NonNull public final android.content.Context getContext();
- method public boolean isSupportedUser(@NonNull com.android.server.SystemService.TargetUser);
+ method public boolean isUserSupported(@NonNull com.android.server.SystemService.TargetUser);
method public void onBootPhase(int);
- method public void onCleanupUser(@NonNull com.android.server.SystemService.TargetUser);
method public abstract void onStart();
- method public void onStartUser(@NonNull com.android.server.SystemService.TargetUser);
- method public void onStopUser(@NonNull com.android.server.SystemService.TargetUser);
- method public void onSwitchUser(@Nullable com.android.server.SystemService.TargetUser, @NonNull com.android.server.SystemService.TargetUser);
- method public void onUnlockUser(@NonNull com.android.server.SystemService.TargetUser);
+ method public void onUserStarting(@NonNull com.android.server.SystemService.TargetUser);
+ method public void onUserStopped(@NonNull com.android.server.SystemService.TargetUser);
+ method public void onUserStopping(@NonNull com.android.server.SystemService.TargetUser);
+ method public void onUserSwitching(@Nullable com.android.server.SystemService.TargetUser, @NonNull com.android.server.SystemService.TargetUser);
+ method public void onUserUnlocked(@NonNull com.android.server.SystemService.TargetUser);
+ method public void onUserUnlocking(@NonNull com.android.server.SystemService.TargetUser);
method protected final void publishBinderService(@NonNull String, @NonNull android.os.IBinder);
method protected final void publishBinderService(@NonNull String, @NonNull android.os.IBinder, boolean);
field public static final int PHASE_ACTIVITY_MANAGER_READY = 550; // 0x226