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

Commit 4296cc19 authored by t's avatar t Committed by Howard Chen
Browse files

Disable factory reset in DSU mode

Bug: 302317901
Bug: 316578327
Test: build

Merged-In: I485eb6ac7beec0893d91ca5fe8ad88ecd96a5cbe
Change-Id: I485eb6ac7beec0893d91ca5fe8ad88ecd96a5cbe
parent 59cdc3e2
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -23,10 +23,12 @@ import android.accounts.AccountManager;
import android.accounts.AuthenticatorDescription;
import android.app.ActionBar;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.settings.SettingsEnums;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
@@ -39,6 +41,7 @@ import android.os.Environment;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.image.DynamicSystemManager;
import android.provider.Settings;
import android.sysprop.VoldProperties;
import android.telephony.euicc.EuiccManager;
@@ -262,6 +265,19 @@ public class MainClear extends InstrumentedFragment implements OnGlobalLayoutLis
                return;
            }

            final DynamicSystemManager dsuManager = (DynamicSystemManager)
                    getActivity().getSystemService(Context.DYNAMIC_SYSTEM_SERVICE);
            if (dsuManager.isInUse()) {
                AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
                builder.setTitle(R.string.dsu_is_running);
                builder.setPositiveButton(R.string.okay, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {}
                });
                AlertDialog dsuAlertdialog = builder.create();
                dsuAlertdialog.show();
                return;
            }

            if (runKeyguardConfirmation(KEYGUARD_REQUEST)) {
                return;
            }