Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72a3a0c7 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

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
parent cf2bb175
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ class Owners {

    public Owners(Context context) {
        mContext = context;
        mUserManager = UserManager.get(mContext);
        mUserManager = context.getSystemService(UserManager.class);
    }

    /**
+5 −0
Original line number Diff line number Diff line
@@ -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;