Skip to content

Commit

Permalink
Merge branch 'issue-227' into dev-x0b
Browse files Browse the repository at this point in the history
  • Loading branch information
x0b committed Aug 5, 2019
2 parents 7092256 + c6216ed commit c198985
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Parcel;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
Expand Down Expand Up @@ -365,6 +366,17 @@ public void onSaveInstanceState(@NonNull Bundle outState) {
if (syncRemotePath != null) {
outState.putString(SAVED_SYNC_REMOTE_PATH, syncRemotePath);
}
if (calculateBundleSize(outState) > 500 * 1024) {
outState.remove(SAVED_CONTENT);
}
}

private int calculateBundleSize(@NonNull Bundle bundle) {
Parcel parcel = Parcel.obtain();
parcel.writeBundle(bundle);
int size = parcel.dataSize();
parcel.recycle();
return size;
}

@Override
Expand Down

0 comments on commit c198985

Please sign in to comment.