Fix OwnersTest when run with -e package
It was because UserManager.get() returns a static cached instance but we should always be using the mock instance that's created for each test. Bug 24378326 Change-Id: Id4663e7676d2d0130622055a97fbde0884714349
This commit is contained in:
@@ -101,7 +101,7 @@ class Owners {
|
||||
|
||||
public Owners(Context context) {
|
||||
mContext = context;
|
||||
mUserManager = UserManager.get(mContext);
|
||||
mUserManager = context.getSystemService(UserManager.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -218,6 +218,11 @@ public class DpmMockContext extends MockContext {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSystemServiceName(Class<?> serviceClass) {
|
||||
return realTestContext.getSystemServiceName(serviceClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackageManager getPackageManager() {
|
||||
return packageManager;
|
||||
|
||||
Reference in New Issue
Block a user