Fix restore page back navigation
Issue: calyxos#2284
Change-Id: I72249924d4b0c56b6bcceea1c5a4adbfa5c54fb2
diff --git a/src/org/lineageos/setupwizard/backup/RestoreIntroActivity.java b/src/org/lineageos/setupwizard/backup/RestoreIntroActivity.java
index f7abe31..b43798b 100644
--- a/src/org/lineageos/setupwizard/backup/RestoreIntroActivity.java
+++ b/src/org/lineageos/setupwizard/backup/RestoreIntroActivity.java
@@ -6,8 +6,12 @@
package org.lineageos.setupwizard.backup;
+import static com.google.android.setupcompat.util.ResultCodes.RESULT_ACTIVITY_NOT_FOUND;
+
import static org.lineageos.setupwizard.SetupWizardApp.ACTION_RESTORE_FROM_BACKUP;
+import androidx.activity.result.ActivityResult;
+
import android.content.Intent;
import android.os.Bundle;
@@ -24,6 +28,19 @@
}
@Override
+ protected void onActivityResult(ActivityResult activityResult) {
+ int resultCode = activityResult.getResultCode();
+ Intent data = activityResult.getData();
+ if (resultCode != RESULT_CANCELED) {
+ nextAction(resultCode, data);
+ } else if (mIsSubactivityNotFound) {
+ finishAction(RESULT_ACTIVITY_NOT_FOUND);
+ } else if (data != null && data.getBooleanExtra("onBackPressed", false)) {
+ onStartSubactivity();
+ }
+ }
+
+ @Override
protected void onStartSubactivity() {
setNextAllowed(true);
}