From 9a4da64c3f7b535ab518d81cd6b3a25c4b46a61c Mon Sep 17 00:00:00 2001 From: "[CSarp Misoglu" Date: Fri, 30 Dec 2022 10:45:43 +0000 Subject: 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 --- .../src/com/android/server/testing/shadows/ShadowUserManager.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'services/robotests/src') 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 profileGroup = new HashSet<>(); -- cgit v1.2.3-59-g8ed1b