aboutsummaryrefslogtreecommitdiff
path: root/service/src/com/android
diff options
context:
space:
mode:
authorYing Zheng <yizheng@google.com>2018-06-13 12:42:31 -0700
committerYing Zheng <yizheng@google.com>2018-06-14 09:50:35 -0700
commit8f90edb2966e2a01c84221d3efced2057fa30948 (patch)
treeb83bf06f56b220d2883844468b76b6fab64d8bb0 /service/src/com/android
parent5b9840513954394c79f9479ad99df005a2d80935 (diff)
downloadCar-8f90edb2966e2a01c84221d3efced2057fa30948.tar.gz
Disable add accounts for user 0.
Bug: 79535560 Test: Unit test Change-Id: Ib0f04ee28829c60e46fbc378b04917a04a52c5ae
Diffstat (limited to 'service/src/com/android')
-rw-r--r--service/src/com/android/car/user/CarUserService.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/service/src/com/android/car/user/CarUserService.java b/service/src/com/android/car/user/CarUserService.java
index b80d2d3182..a66621085b 100644
--- a/service/src/com/android/car/user/CarUserService.java
+++ b/service/src/com/android/car/user/CarUserService.java
@@ -23,6 +23,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.UserInfo;
+import android.os.UserManager;
import android.util.Log;
import com.android.car.CarServiceBase;
@@ -88,6 +89,10 @@ public class CarUserService extends BroadcastReceiver implements CarServiceBase
if (intent.getAction() == Intent.ACTION_LOCKED_BOOT_COMPLETED) {
if (mCarUserManagerHelper.getAllUsers().size() == 0) {
+ // Disable adding accounts for user 0.
+ mCarUserManagerHelper.setUserRestriction(mCarUserManagerHelper.getSystemUserInfo(),
+ UserManager.DISALLOW_MODIFY_ACCOUNTS, true);
+ // On very first boot, create an admin user and switch to that user.
UserInfo admin = mCarUserManagerHelper.createNewAdminUser(OWNER_NAME);
mCarUserManagerHelper.switchToUser(admin);
} else {