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

Commit 663c05e5 authored by Howard Chen's avatar Howard Chen Committed by Automerger Merge Worker
Browse files

Merge "Disable factory reset in DSU mode" into main am: 8136e6d3 am: 8524cc8a am: 9a7e7e0e

parents 57ee1f29 9a7e7e0e
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -26,11 +26,13 @@ import android.accounts.AccountManager;
import android.accounts.AuthenticatorDescription;
import android.app.ActionBar;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.admin.DevicePolicyManager;
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;
@@ -43,6 +45,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.telephony.euicc.EuiccManager;
import android.text.TextUtils;
@@ -266,6 +269,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;
            }