diff --git a/controller/app/src/main/java/org/iiab/controller/redesign/SetupLibraryActivity.java b/controller/app/src/main/java/org/iiab/controller/redesign/SetupLibraryActivity.java index 09210518..42ed26d7 100644 --- a/controller/app/src/main/java/org/iiab/controller/redesign/SetupLibraryActivity.java +++ b/controller/app/src/main/java/org/iiab/controller/redesign/SetupLibraryActivity.java @@ -218,6 +218,11 @@ public void backToGetMoreHubZim() { * the install is companion=false (OS/tier only; maps ships in the image), replacing the old * Step 2 "Download library" trigger. */ public void startWizardInstall() { + // ADFA-4982: the real install is starting — mark setup complete NOW (it is no longer set at the + // wizard's "download" choice, so bailing before this resumes the wizard). This also lets the + // install LibraryActivity below show progress instead of redirecting back to the wizard. + getSharedPreferences(getString(R.string.pref_file_internal), MODE_PRIVATE) + .edit().putBoolean(getString(R.string.pref_key_setup_complete), true).apply(); Intent i = new Intent(this, InstallService.class); i.setAction(InstallService.ACTION_START); i.putExtra(InstallService.EXTRA_TIER, getSelectedTier().name()); diff --git a/controller/app/src/main/java/org/iiab/controller/redesign/Step1SystemFragment.java b/controller/app/src/main/java/org/iiab/controller/redesign/Step1SystemFragment.java index 3a8c8af2..67c7bcb9 100644 --- a/controller/app/src/main/java/org/iiab/controller/redesign/Step1SystemFragment.java +++ b/controller/app/src/main/java/org/iiab/controller/redesign/Step1SystemFragment.java @@ -86,9 +86,9 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c }); root.findViewById(R.id.k2go_step1_back).setOnClickListener(v -> { - // Setup was already marked complete when the wizard launched this; route to the - // library (reusing it if it is under us) instead of a bare finish() that would - // drop the user to the Android home screen. + // ADFA-4982: setup is NOT complete until the install actually starts, so routing to + // LibraryActivity here (which sees !complete) sends the user back to the wizard's setup + // choice — resuming where they were, instead of a bare finish() to the Android home screen. android.content.Intent i = new android.content.Intent(requireContext(), LibraryActivity.class); i.addFlags(android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP | android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(i); diff --git a/controller/app/src/main/java/org/iiab/controller/redesign/WizardActivity.java b/controller/app/src/main/java/org/iiab/controller/redesign/WizardActivity.java index 001f5509..35392f80 100644 --- a/controller/app/src/main/java/org/iiab/controller/redesign/WizardActivity.java +++ b/controller/app/src/main/java/org/iiab/controller/redesign/WizardActivity.java @@ -61,6 +61,10 @@ protected void onCreate(Bundle b) { // applied language, so we don't flash back to the welcome step. langTag = AppLocaleController.currentTag(); if (b != null) step = b.getInt("step", 0); + // ADFA-4982: a fresh launch that isn't complete yet but already has permissions means the user + // passed language + permissions and only bailed from the setup choice / edition selection — + // resume at the setup choice (step 3), not welcome/language/permissions all over again. + else if (!prefs().getBoolean(getString(R.string.pref_key_setup_complete), false) && allPermsGranted()) step = 3; title = findViewById(R.id.wiz_title); subtitle = findViewById(R.id.wiz_subtitle); primary = findViewById(R.id.wiz_primary); @@ -88,7 +92,9 @@ protected void onCreate(Bundle b) { // set-up-library choices findViewById(R.id.setup_download).setOnClickListener(v -> { - markComplete(); + // ADFA-4982: do NOT mark setup complete here — only a real install does (startWizardInstall). + // If the user bails during edition/size selection, the next launch resumes at this setup + // choice (see onCreate) instead of stranding them on an empty Home. startActivity(new Intent(this, SetupLibraryActivity.class)); finish(); });