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

Commit 67a70ece authored by Jeremy Meyer's avatar Jeremy Meyer Committed by Android (Google) Code Review
Browse files

Merge "make Context.setResources() null safe" into main

parents daa95c70 339189dc
Loading
Loading
Loading
Loading
+18 −16
Original line number Diff line number Diff line
@@ -3481,6 +3481,7 @@ class ContextImpl extends Context {
        }
        mResources = r;

        if (r != null) {
            // only do this if the user already has more than one preferred locale
            if (android.content.res.Flags.defaultLocale()
                    && r.getConfiguration().getLocales().size() > 1) {
@@ -3488,9 +3489,9 @@ class ContextImpl extends Context {
                if (getUserId() < 0) {
                    lc = LocaleConfig.fromContextIgnoringOverride(this);
                } else {
                // This is needed because the app might have locale config overrides that need to
                // be read from disk in order for resources to correctly choose which values to
                // load.
                    // This is needed because the app might have locale config overrides that need
                    // to be read from disk in order for resources to correctly choose which values
                    // to load.
                    StrictMode.ThreadPolicy policy = StrictMode.allowThreadDiskReads();
                    try {
                        lc = new LocaleConfig(this);
@@ -3501,6 +3502,7 @@ class ContextImpl extends Context {
                mResourcesManager.setLocaleConfig(lc);
            }
        }
    }

    void installSystemApplicationInfo(ApplicationInfo info, ClassLoader classLoader) {
        mPackageInfo.installSystemApplicationInfo(info, classLoader);