@@ -712,9 +712,8 @@ public void handleOnBackPressed() {
712712 updatePostLoadingAndDialogState (PostLoadingState .fromInt (
713713 savedInstanceState .getInt (STATE_KEY_POST_LOADING_STATE , 0 )));
714714
715- SavedInstanceDatabase db = SavedInstanceDatabase .Companion .getDatabase (WordPress .getContext ());
716- if (db != null ) {
717- mRevision = db .getParcel (STATE_KEY_REVISION , Revision .CREATOR );
715+ if (getDB () != null ) {
716+ mRevision = getDB ().getParcel (STATE_KEY_REVISION , Revision .CREATOR );
718717 }
719718
720719 mPostEditorAnalyticsSession = PostEditorAnalyticsSession
@@ -1158,6 +1157,8 @@ private void removePostOpenInEditorStickyEvent() {
11581157
11591158 @ Override
11601159 protected void onSaveInstanceState (Bundle outState ) {
1160+ outState .remove ("android:viewHierarchyState" );
1161+ outState .remove ("androidx.lifecycle.BundlableSavedStateRegistry.key" );
11611162 super .onSaveInstanceState (outState );
11621163 // Saves both post objects so we can restore them in onCreate()
11631164 updateAndSavePostAsync ();
@@ -1173,9 +1174,8 @@ protected void onSaveInstanceState(Bundle outState) {
11731174 outState .putBoolean (STATE_KEY_REDO , mMenuHasRedo );
11741175 outState .putSerializable (WordPress .SITE , mSite );
11751176
1176- SavedInstanceDatabase db = SavedInstanceDatabase .Companion .getDatabase (WordPress .getContext ());
1177- if (db != null ) {
1178- db .addParcel (STATE_KEY_REVISION , mRevision );
1177+ if (getDB () != null ) {
1178+ getDB ().addParcel (STATE_KEY_REVISION , mRevision );
11791179 }
11801180
11811181 outState .putSerializable (STATE_KEY_EDITOR_SESSION_DATA , mPostEditorAnalyticsSession );
@@ -2886,10 +2886,10 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
28862886 }
28872887 break ;
28882888 case RequestCodes .HISTORY_DETAIL :
2889- if (data . hasExtra (KEY_REVISION )) {
2889+ if (getDB () != null && getDB (). hasParcel (KEY_REVISION )) {
28902890 mViewPager .setCurrentItem (PAGE_CONTENT );
28912891
2892- mRevision = data . getParcelableExtra (KEY_REVISION );
2892+ mRevision = getDB (). getParcel (KEY_REVISION , Revision . CREATOR );
28932893 new Handler ().postDelayed (this ::loadRevision ,
28942894 getResources ().getInteger (R .integer .full_screen_dialog_animation_duration ));
28952895 }
@@ -3958,4 +3958,8 @@ public void showJetpackSettings() {
39583958 public LiveData <DialogVisibility > getSavingInProgressDialogVisibility () {
39593959 return mViewModel .getSavingInProgressDialogVisibility ();
39603960 }
3961+
3962+ @ Nullable private SavedInstanceDatabase getDB () {
3963+ return SavedInstanceDatabase .Companion .getDatabase (WordPress .getContext ());
3964+ }
39613965}
0 commit comments