From 42e5f5150aba8f1c937330ab5d6c4ce3d5b904f3 Mon Sep 17 00:00:00 2001 From: Kazurin Nanako <71819243+Kazurin-775@users.noreply.github.com> Date: Sun, 13 Mar 2022 17:30:00 +0800 Subject: [PATCH] Fix "double install" caused by config changes Configuration changes in FlashFragment may cause the installation process to be triggered twice. The simplest way to reproduce this behavior is to choose a module ZIP file in landscape mode (which is the default on some tablets). This commit fixes the problem by ensuring `savedInstanceState == null` before starting installation. --- .../main/java/com/topjohnwu/magisk/ui/flash/FlashFragment.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashFragment.kt b/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashFragment.kt index f6e57822f..bf423a048 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashFragment.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashFragment.kt @@ -51,7 +51,9 @@ class FlashFragment : BaseFragment() { defaultOrientation = activity?.requestedOrientation ?: -1 activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR - viewModel.startFlashing() + if (savedInstanceState == null) { + viewModel.startFlashing() + } } @SuppressLint("WrongConstant")