summaryrefslogtreecommitdiff
path: root/services/robotests/src
diff options
context:
space:
mode:
author [CSarp Misoglu <sarpm@google.com> 2022-12-30 10:45:43 +0000
committer [CSarp Misoglu <sarpm@google.com> 2022-12-30 10:45:43 +0000
commit9a4da64c3f7b535ab518d81cd6b3a25c4b46a61c (patch)
tree6b4ecdbd6ead1261feba2b1d7c685c621ea89642 /services/robotests/src
parent5f6c2712ff643ea8ad5cf65160177e208e19bdf8 (diff)
Implement shadow for UserManager#getMainUser
Not having the implementation causes B&R robolectric tests fail with a NPE. Bug: 263981306 Test: atest BackupFrameworksServicesRoboTests Change-Id: I47bf7ba42cf3bd23e472f8c9a21e4e657053ad42
Diffstat (limited to 'services/robotests/src')
-rw-r--r--services/robotests/src/com/android/server/testing/shadows/ShadowUserManager.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/services/robotests/src/com/android/server/testing/shadows/ShadowUserManager.java b/services/robotests/src/com/android/server/testing/shadows/ShadowUserManager.java
index a9e4ee521f90..16ba21067a62 100644
--- a/services/robotests/src/com/android/server/testing/shadows/ShadowUserManager.java
+++ b/services/robotests/src/com/android/server/testing/shadows/ShadowUserManager.java
@@ -18,6 +18,7 @@ package com.android.server.testing.shadows;
import android.annotation.NonNull;
import android.annotation.UserIdInt;
+import android.os.UserHandle;
import android.os.UserManager;
import org.robolectric.annotation.Implementation;
@@ -50,6 +51,12 @@ public class ShadowUserManager extends org.robolectric.shadows.ShadowUserManager
return profileIds.get(userId).stream().mapToInt(Number::intValue).toArray();
}
+ /** @see UserManager#getMainUser() */
+ @Implementation
+ public UserHandle getMainUser() {
+ return null;
+ }
+
/** Add a collection of profile IDs, all within the same profile group. */
public void addProfileIds(@UserIdInt int... userIds) {
final Set<Integer> profileGroup = new HashSet<>();