Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a72877c authored by ot_hemant.yadav's avatar ot_hemant.yadav Committed by Ramneek Kalra
Browse files

Crash happens if back button is pressed during "Format as Portable"

SD card format as internal, during migrate process press back key or  During "Format as Portable", 
press back key crash happened.

Fix:
Hide the bottom navigation from that particular activity so that user can not accidentally 
press back key.
/packages/apps/Settings/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
/packages/apps/Settings/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java

Bug: 238596768
Test:
1. Insert sdcard or generate virtual disk using command : adb shell "sm set-virtual-disk true"
2. Go to Settings -> Storage -> SD Card -> Format as Internal -> move later
3. After step 1, back to storage
4. Again enter in Storage -> SD Card -> to do migrate data
5. during migrate process press back key
6. Storage -> SD Card -> Format as Portable
7. During "Format as Portable", press back key

Change-Id: I1f393ffb872bb90d7dfeb4e1c86648b3413645a1
parent e27d1790
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.settings.R;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import android.view.WindowManager;

public class StorageWizardFormatProgress extends StorageWizardBase {
    private static final String TAG = "StorageWizardFormatProgress";
@@ -54,6 +55,16 @@ public class StorageWizardFormatProgress extends StorageWizardBase {
            return;
        }
        setContentView(R.layout.storage_wizard_progress);

        // hide the navigation bar for this activity only. So that user can not press back button accidentally.
        View decorView = getWindow().getDecorView();
        int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        decorView.setSystemUiVisibility(uiOptions);

        //disable touch in activity so user can not make the hidden navigation bar visible.
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
                     WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);

        setKeepScreenOn(true);

        mFormatPrivate = getIntent().getBooleanExtra(EXTRA_FORMAT_PRIVATE, false);
+11 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ import android.widget.Toast;

import com.android.settings.R;

import android.view.WindowManager;

public class StorageWizardMigrateProgress extends StorageWizardBase {
    private static final String TAG = "StorageWizardMigrateProgress";

@@ -47,6 +49,15 @@ public class StorageWizardMigrateProgress extends StorageWizardBase {
        }
        setContentView(R.layout.storage_wizard_progress);
        
        // hide the navigation bar for this activity only. So that user can not press back button accidentally.
        View decorView = getWindow().getDecorView();    
        int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        decorView.setSystemUiVisibility(uiOptions);

        //disable touch in activity so user can not make the hidden navigation bar visible.
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
                     WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);         
      
        mMoveId = getIntent().getIntExtra(EXTRA_MOVE_ID, -1);

        setIcon(R.drawable.ic_swap_horiz);