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

Commit 4d6194f4 authored by Brian Isganitis's avatar Brian Isganitis
Browse files

Allow specifying base for SandboxModelContext.

Flag: TEST_ONLY
Bug: 230027385
Test: go/testedequals
Change-Id: I2d6c90eda30cb80fd7124d35bab62b1af1b10902
parent bae6a107
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import static org.mockito.Mockito.spy;

import android.content.ContentProvider;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.PackageInstaller;
import android.content.pm.PackageInstaller.SessionParams;
import android.content.pm.PackageManager;
@@ -250,15 +251,16 @@ public class LauncherModelHelper {
        private final File mDbDir;

        public SandboxModelContext() {
            super(ApplicationProvider.getApplicationContext());
            this(ApplicationProvider.getApplicationContext());
        }

        public SandboxModelContext(Context context) {
            super(context);

            // System settings cache content provider. Ensure that they are statically initialized
            Settings.Secure.getString(
                    ApplicationProvider.getApplicationContext().getContentResolver(), "test");
            Settings.System.getString(
                    ApplicationProvider.getApplicationContext().getContentResolver(), "test");
            Settings.Global.getString(
                    ApplicationProvider.getApplicationContext().getContentResolver(), "test");
            Settings.Secure.getString(context.getContentResolver(), "test");
            Settings.System.getString(context.getContentResolver(), "test");
            Settings.Global.getString(context.getContentResolver(), "test");

            mPm = spy(getBaseContext().getPackageManager());
            mDbDir = new File(getCacheDir(), UUID.randomUUID().toString());