confirm SIM deletion should be disabled when the guest mode is enabled.

Bug: 228451314
Change-Id: I83337980fe4bcfa6771de290fd0e44217ea51dec
Test: manual
diff --git a/src/com/android/settings/security/ConfirmSimDeletionPreferenceController.java b/src/com/android/settings/security/ConfirmSimDeletionPreferenceController.java
index a7185e3..3bf1563 100644
--- a/src/com/android/settings/security/ConfirmSimDeletionPreferenceController.java
+++ b/src/com/android/settings/security/ConfirmSimDeletionPreferenceController.java
@@ -19,6 +19,7 @@
 import android.app.KeyguardManager;
 import android.app.settings.SettingsEnums;
 import android.content.Context;
+import android.os.UserManager;
 import android.provider.Settings;
 
 import androidx.preference.Preference;
@@ -39,6 +40,8 @@
             ConfirmationSimDeletionPredicate.KEY_CONFIRM_SIM_DELETION;
     private boolean mConfirmationDefaultOn;
     private MetricsFeatureProvider mMetricsFeatureProvider;
+    private UserManager mUserManager;
+    private KeyguardManager mKeyguardManager;
 
     public ConfirmSimDeletionPreferenceController(Context context, String key) {
         super(context, key);
@@ -46,6 +49,9 @@
                 context.getResources()
                         .getBoolean(R.bool.config_sim_deletion_confirmation_default_on);
         mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
+
+        mUserManager = context.getSystemService(UserManager.class);
+        mKeyguardManager = mContext.getSystemService(KeyguardManager.class);
     }
 
     @Override
@@ -99,8 +105,7 @@
 
     @Override
     public void updateState(Preference preference) {
-        final KeyguardManager keyguardManager = mContext.getSystemService(KeyguardManager.class);
-        if (!keyguardManager.isKeyguardSecure()) {
+        if (!mKeyguardManager.isKeyguardSecure() && mUserManager.isGuestUser()) {
             preference.setEnabled(false);
             if (preference instanceof TwoStatePreference) {
                 ((TwoStatePreference) preference).setChecked(false);