Skip to content

Commit

Permalink
Restore 'mStubQueue' after application unexpectedly restart, fix #520
Browse files Browse the repository at this point in the history
  • Loading branch information
galenlin committed Sep 20, 2017
1 parent 851395e commit eb7b11e
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public class ApkBundleLauncher extends SoBundleLauncher {
private static final String TAG = "ApkBundleLauncher";
private static final String FD_STORAGE = "storage";
private static final String FILE_DEX = "bundle.dex";
private static final String STUB_QUEUE_RESTORE_KEY = "small.stubQueue";

private static class LoadedApk {
public String packageName;
Expand Down Expand Up @@ -320,6 +321,22 @@ public void callActivityOnCreate(Activity activity, android.os.Bundle icicle) {
sHostInstrumentation.callActivityOnCreate(activity, icicle);
}

@Override
public void callActivityOnSaveInstanceState(Activity activity, android.os.Bundle outState) {
sHostInstrumentation.callActivityOnSaveInstanceState(activity, outState);
if (mStubQueue != null) {
outState.putCharSequenceArray(STUB_QUEUE_RESTORE_KEY, mStubQueue);
}
}

@Override
public void callActivityOnRestoreInstanceState(Activity activity, android.os.Bundle savedInstanceState) {
sHostInstrumentation.callActivityOnRestoreInstanceState(activity, savedInstanceState);
if (mStubQueue == null) {
mStubQueue = savedInstanceState.getStringArray(STUB_QUEUE_RESTORE_KEY);
}
}

@Override
public void callActivityOnStop(Activity activity) {
sHostInstrumentation.callActivityOnStop(activity);
Expand Down

0 comments on commit eb7b11e

Please sign in to comment.