Clear calling identity before call to UserManagerService
UserManagerService requires calling uid to have query or create users permission to fetch user info. When a volume is ejected from DocumentsUI, ejectRoot call is triggered to ExternalStorageProvider which further calls into StorageManagerService unmount. StorageManagerService checks for permission "android.permission.MOUNT_UNMOUNT_FILESYSTEMS" which ExternalStorageProvider has. For further call into UserManagerService, ExternalStorageProvider's identity is used, which fails as ExternalStorageProvider does not CREATE_USERS or QUERY_USERS permission. Call from StorageManagerService should be made with its own identity in this case given unmount() does not require caller to hold QUERY/CREATE user permission. Bug: 209931583 Bug: 267955224 Change-Id: I9d00c7892b75345e1c4e83f1ec819fd9f4c36922 Test: locally
Loading
Please register or sign in to comment