From fcaca1c71bab6e96db0d95e98c5ed22110f6d8ba Mon Sep 17 00:00:00 2001 From: shivytyahoo <335833302+shivytyahoo@users.noreply.github.com> Date: Fri, 6 Nov 2026 17:09:02 +0530 Subject: [PATCH] fix(setup-encryption): keep passphrase when setup screen is recreated The setup activity showed a fresh dialog on every recreation, so the passphrase changed while the user was copying it somewhere else. Only show the dialog the first time; Android restores the existing one with its saved passphrase after rotation or when the app comes back. Fixes #11571 Signed-off-by: shivytyahoo <335833302+shivytyahoo@users.noreply.github.com> --- .../android/ui/activity/SetupEncryptionActivity.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/owncloud/android/ui/activity/SetupEncryptionActivity.kt b/app/src/main/java/com/owncloud/android/ui/activity/SetupEncryptionActivity.kt index d219e56e1a73..f0150f6c5b9c 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/SetupEncryptionActivity.kt +++ b/app/src/main/java/com/owncloud/android/ui/activity/SetupEncryptionActivity.kt @@ -45,7 +45,13 @@ class SetupEncryptionActivity : AppCompatActivity() { } finish() } - setupEncryptionDialogFragment.show(supportFragmentManager, "setup_encryption") + + // Only show a new dialog the first time: on recreation the FragmentManager + // restores the existing dialog with its saved passphrase. Showing a fresh + // one here would generate a new passphrase and lose the one being copied. + if (savedInstanceState == null) { + setupEncryptionDialogFragment.show(supportFragmentManager, "setup_encryption") + } } private fun buildResultIntentFromBundle(result: Bundle): Intent = Intent().apply {