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

Commit e61dc6f2 authored by t's avatar t Committed by Alexander Grund
Browse files

Disable factory reset in DSU mode

Bug: 302317901
Bug: 316578327
Test: build
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:60f387581dfa546a7ec4860a0efcf8472a63e105)
Merged-In: I485eb6ac7beec0893d91ca5fe8ad88ecd96a5cbe
Change-Id: I485eb6ac7beec0893d91ca5fe8ad88ecd96a5cbe
parent 42161038
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -11417,6 +11417,16 @@
    <string name="work_policy_privacy_settings">Your work policy info</string>
    <!-- Summary for Enterprise Privacy settings, explaining what the user can expect to find under it [CHAR LIMIT=NONE]-->
    <string name="work_policy_privacy_settings_summary">Settings managed by your IT admin</string>
    <!-- DSU Loader. Do not translate. -->
    <string name="dsu_loader_title" translatable="false">DSU Loader</string>
    <!-- DSU Loader Description. Do not translate. -->
    <string name="dsu_loader_description" translatable="false">Load a Dynamic System Update Image</string>
    <!-- DSU Loader Loading. Do not translate. -->
    <string name="dsu_loader_loading" translatable="false">Loading...</string>
    <!-- DSU Loader. Do not translate. -->
    <string name="dsu_is_running" translatable="false">DSU is running</string>
    <!-- Title for RTT setting. [CHAR LIMIT=NONE] -->
    <string name="rtt_settings_title"></string>
    <!-- Subtext for showing the option of RTT setting. [CHAR LIMIT=NONE] -->
+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;
@@ -255,6 +258,19 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
                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;
            }