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

Commit 5e154365 authored by Kurt Nelson's avatar Kurt Nelson
Browse files

Don't clobber application's strict mode

Applications often configure strict mode in Application.onCreate. A
regression was added in I2614f8bb30203e00953b1978bbcaf24d84d0397b that
applied a strict mode override for a longer period of time than needed.

Test: Launched a few applications
Bug: 36951662
Change-Id: I30b3eafa4a833fc42d0a938da9446007ade80480
parent f02beb06
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -5692,11 +5692,12 @@ public final class ActivityThread {
        // Allow disk access during application and provider setup. This could
        // block processing ordered broadcasts, but later processing would
        // probably end up doing the same disk access.
        Application app;
        final StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskWrites();
        try {
            // If the app is being launched for full backup or restore, bring it up in
            // a restricted environment with the base application class.
            Application app = data.info.makeApplication(data.restrictedBackupMode, null);
            app = data.info.makeApplication(data.restrictedBackupMode, null);
            mInitialApplication = app;

            // don't bring up providers in restricted mode; they may depend on the
@@ -5720,6 +5721,9 @@ public final class ActivityThread {
                    "Exception thrown in onCreate() of "
                    + data.instrumentationName + ": " + e.toString(), e);
            }
        } finally {
            StrictMode.setThreadPolicy(savedPolicy);
        }

        try {
            mInstrumentation.callApplicationOnCreate(app);
@@ -5730,9 +5734,6 @@ public final class ActivityThread {
                    + ": " + e.toString(), e);
            }
        }
        } finally {
            StrictMode.setThreadPolicy(savedPolicy);
        }

        // Preload fonts resources
        FontsContract.setApplicationContextForResources(appContext);