diff options
author | Jeff Sharkey <jsharkey@android.com> | 2012-02-29 12:26:36 -0800 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2012-02-29 12:26:36 -0800 |
commit | 6bff62c2fd1733832a81f613495f4ead14045b81 (patch) | |
tree | 891758769c77dd8abe0363712b4a5cb627743f53 /core/java/android/app/ActivityThread.java | |
parent | e7bb71d26943fbb053139e1e34203df4c2afaa9b (diff) | |
download | frameworks_base-6bff62c2fd1733832a81f613495f4ead14045b81.zip frameworks_base-6bff62c2fd1733832a81f613495f4ead14045b81.tar.gz frameworks_base-6bff62c2fd1733832a81f613495f4ead14045b81.tar.bz2 |
Wrap StrictMode changes in try/finally.
Bug: 6091030
Change-Id: I2614f8bb30203e00953b1978bbcaf24d84d0397b
Diffstat (limited to 'core/java/android/app/ActivityThread.java')
-rw-r--r-- | core/java/android/app/ActivityThread.java | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index d4b9a36..1230c81 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -3986,40 +3986,40 @@ public final class ActivityThread { dalvik.system.VMRuntime.getRuntime().clearGrowthLimit(); } - // allow disk access during application and provider setup. this could + // 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. restore not guarded with - // finally block, since exceptions here will take down the application. + // probably end up doing the same disk access. final StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskWrites(); - - // 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); - mInitialApplication = app; - - // don't bring up providers in restricted mode; they may depend on the - // app's custom Application class - if (!data.restrictedBackupMode) { - List<ProviderInfo> providers = data.providers; - if (providers != null) { - installContentProviders(app, providers); - // For process that contains content providers, we want to - // ensure that the JIT is enabled "at some point". - mH.sendEmptyMessageDelayed(H.ENABLE_JIT, 10*1000); + 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); + mInitialApplication = app; + + // don't bring up providers in restricted mode; they may depend on the + // app's custom Application class + if (!data.restrictedBackupMode) { + List<ProviderInfo> providers = data.providers; + if (providers != null) { + installContentProviders(app, providers); + // For process that contains content providers, we want to + // ensure that the JIT is enabled "at some point". + mH.sendEmptyMessageDelayed(H.ENABLE_JIT, 10*1000); + } } - } - try { - mInstrumentation.callApplicationOnCreate(app); - } catch (Exception e) { - if (!mInstrumentation.onException(app, e)) { - throw new RuntimeException( - "Unable to create application " + app.getClass().getName() - + ": " + e.toString(), e); + try { + mInstrumentation.callApplicationOnCreate(app); + } catch (Exception e) { + if (!mInstrumentation.onException(app, e)) { + throw new RuntimeException( + "Unable to create application " + app.getClass().getName() + + ": " + e.toString(), e); + } } + } finally { + StrictMode.setThreadPolicy(savedPolicy); } - - StrictMode.setThreadPolicy(savedPolicy); } /*package*/ final void finishInstrumentation(int resultCode, Bundle results) { |