Allow SYSTEM user in Automotive instead of main user.
There are devices where main user is not defined, such as Automotive, and no uid could pass enforceUid(). Allow SYSTEM user for such cases. Bug: 285758762 Test: atest com.google.android.gts.persistentdata.PersistentDataHostTest Change-Id: Ieef580962e12f70ef429ebc2532312a5008167a2
This commit is contained in:
@@ -159,9 +159,10 @@ public class PersistentDataBlockService extends SystemService {
|
||||
|
||||
private int getAllowedUid() {
|
||||
final UserManagerInternal umInternal = LocalServices.getService(UserManagerInternal.class);
|
||||
final int mainUserId = umInternal.getMainUserId();
|
||||
int mainUserId = umInternal.getMainUserId();
|
||||
if (mainUserId < 0) {
|
||||
return -1;
|
||||
// If main user is not defined. Use the SYSTEM user instead.
|
||||
mainUserId = UserHandle.USER_SYSTEM;
|
||||
}
|
||||
String allowedPackage = mContext.getResources()
|
||||
.getString(R.string.config_persistentDataPackageName);
|
||||
|
||||
Reference in New Issue
Block a user