summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Hugh <ahugh@google.com>2019-03-18 15:21:04 -0700
committerKeun young Park <keunyoung@google.com>2019-04-18 12:13:39 -0700
commit6be63fae4d98cc3a0b8428aed5671fe05cce8de5 (patch)
tree53b66adb963361f967a08480dbaa329381ccbf45
parent8d58390e464f4e8beec00f417794d815da8ffc6f (diff)
downloadservices-6be63fae4d98cc3a0b8428aed5671fe05cce8de5.tar.gz
Remove references to defaultguest build
defaultguest is no longer needed. This CL cleans the code out of the source tree. This reverts commit 2807273cee6b14c236dd76560b02284e65630f7e. BUG: 128860529 Test: m -j Change-Id: Ia3f0966ebd77586d537c120977c6390753b4b191
-rw-r--r--src/com/android/internal/car/CarServiceHelperService.java37
-rw-r--r--tests/src/com/android/internal/car/CarHelperServiceTest.java36
2 files changed, 10 insertions, 63 deletions
diff --git a/src/com/android/internal/car/CarServiceHelperService.java b/src/com/android/internal/car/CarServiceHelperService.java
index ff3747c..0fd60dd 100644
--- a/src/com/android/internal/car/CarServiceHelperService.java
+++ b/src/com/android/internal/car/CarServiceHelperService.java
@@ -29,7 +29,6 @@ import android.os.Binder;
import android.os.IBinder;
import android.os.Parcel;
import android.os.RemoteException;
-import android.os.SystemProperties;
import android.os.Trace;
import android.os.UserHandle;
import android.util.Slog;
@@ -183,36 +182,20 @@ public class CarServiceHelperService extends SystemService {
// used in AMS / PMS ended up stopping the world with lots of lock contention.
// To run these in background, there should be some improvements there.
int targetUserId = UserHandle.USER_SYSTEM;
- if (SystemProperties.getBoolean("android.car.systemuser.defaultguest", false)) {
- Slog.i(TAG, "Start guest user mode");
- // Ensure there is an admin user on the device
- if (mCarUserManagerHelper.getAllAdminUsers().isEmpty()) {
- Slog.i(TAG, "Create new admin user");
- UserInfo admin = mCarUserManagerHelper.createNewAdminUser();
- }
- // Ensure we switch to the guest user by default
- // TODO(b/122852856): Localize this string
- UserInfo guest = mCarUserManagerHelper.createNewOrFindExistingGuest("Guest");
- if (guest == null) {
- Slog.e(TAG, "cannot create or find guest user");
+ if (mCarUserManagerHelper.getAllUsers().size() == 0) {
+ Slog.i(TAG, "Create new admin user and switch");
+ // On very first boot, create an admin user and switch to that user.
+ UserInfo admin = mCarUserManagerHelper.createNewAdminUser();
+ if (admin == null) {
+ Slog.e(TAG, "cannot create admin user");
return;
}
- targetUserId = guest.id;
+ targetUserId = admin.id;
} else {
- if (mCarUserManagerHelper.getAllUsers().size() == 0) {
- Slog.i(TAG, "Create new admin user and switch");
- // On very first boot, create an admin user and switch to that user.
- UserInfo admin = mCarUserManagerHelper.createNewAdminUser();
- if (admin == null) {
- Slog.e(TAG, "cannot create admin user");
- return;
- }
- targetUserId = admin.id;
- } else {
- Slog.i(TAG, "Switch to default user");
- targetUserId = mCarUserManagerHelper.getInitialUser();
- }
+ Slog.i(TAG, "Switch to default user");
+ targetUserId = mCarUserManagerHelper.getInitialUser();
}
+
// If system user is the only user to unlock, handle it when system completes the boot.
if (targetUserId == UserHandle.USER_SYSTEM) {
return;
diff --git a/tests/src/com/android/internal/car/CarHelperServiceTest.java b/tests/src/com/android/internal/car/CarHelperServiceTest.java
index 39a3a17..3f95366 100644
--- a/tests/src/com/android/internal/car/CarHelperServiceTest.java
+++ b/tests/src/com/android/internal/car/CarHelperServiceTest.java
@@ -25,13 +25,11 @@ import android.content.pm.UserInfo;
import androidx.test.runner.AndroidJUnit4;
-import android.os.SystemProperties;
import com.android.server.SystemService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -68,8 +66,6 @@ public class CarHelperServiceTest {
MockitoAnnotations.initMocks(this);
doReturn(mApplicationContext).when(mMockContext).getApplicationContext();
- setDefaultGuestFlag(false);
-
mCarServiceHelperService = new CarServiceHelperService(mMockContext, mCarUserManagerHelper);
}
@@ -127,41 +123,9 @@ public class CarHelperServiceTest {
verify(mCarUserManagerHelper).switchToUserId(secUserId);
}
- /**
- * Test that the {@link CarServiceHelperService} starts into a Guest user when the
- * SystemProperty "android.car.systemuser.defaultguest" is set.
- */
- @Test
- public void testDefaultGuestFlag() {
- setDefaultGuestFlag(true);
-
- mCarServiceHelperService.onBootPhase(SystemService.PHASE_THIRD_PARTY_APPS_CAN_START);
-
- verify(mCarUserManagerHelper).startGuestSession(Matchers.anyString());
- }
-
- /**
- * Test that the {@link CarServiceHelperService} creates an admin when the SystemProperty
- * "android.car.systemuser.defaultguest" is set.
- */
- @Test
- public void testDefaultGuestFlagHasAdmin() {
- List<UserInfo> emptyUserList = new ArrayList<>();
- doReturn(emptyUserList).when(mCarUserManagerHelper).getAllAdminUsers();
- setDefaultGuestFlag(true);
-
- mCarServiceHelperService.onBootPhase(SystemService.PHASE_THIRD_PARTY_APPS_CAN_START);
-
- verify(mCarUserManagerHelper).createNewAdminUser();
- }
-
private UserInfo mockAdminWithDefaultName(int adminId) {
UserInfo admin = new UserInfo(adminId, DEFAULT_NAME, UserInfo.FLAG_ADMIN);
doReturn(admin).when(mCarUserManagerHelper).createNewAdminUser();
return admin;
}
-
- private void setDefaultGuestFlag(boolean enabled) {
- SystemProperties.set("android.car.systemuser.defaultguest", Boolean.toString(enabled));
- }
}