Update PermissionManagerService to handle pre-created users
Pre-created users are not being returned by the call to UserManagerService.getUserIds(). This is causing PermissionManager to ignore recording pre-grants when a new pre-created user is created. This CL fixes the issue by using a user ID set that contians pre-created users. Presumably the call to getUserIds() was previously done for performance reasons. I have added some system tracing to see if performance is a bottle neck here with the new API call. I ran the test 5 times on an automotive emulator: [1] Start system trace [2] adb shell pm -create-user --pre-create-only [3] Stop system trace Average time to getUsers() before changes: .389ms Average time to getUsers() after changes: 1.82ms Given that this is an infrequent operation and less than 5ms change, performance hit looks negligible. Bug: b/160901158 Test: Manually. Run `adb shell pm -create-user --pre-create-only`. Create a new user and check to see that Assistant has pre-granted permissions via `adb shell dumpsys package com.google.android.carassistant` Change-Id: I52caeb3a71e560d09fcbc167b46becebf779fc3a (cherry picked from commit 432a0377250246632927252c9d2b92411717be52)
Loading
Please register or sign in to comment