From f8658270774a27601edda9377ea6736c3b7062c6 Mon Sep 17 00:00:00 2001 From: Ayush Sharma Date: Mon, 13 Feb 2023 14:47:35 +0000 Subject: [PATCH] Add flag for switch to managed profile dialog Bug: 258629881 Test: Manual Change-Id: Ic8c5552409dff213b941510d457058fe398e862d --- .../android/internal/telephony/util/TelephonyUtils.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java b/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java index cbac34f50a961..0325ba648af61 100644 --- a/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java +++ b/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java @@ -31,6 +31,7 @@ import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; +import android.provider.DeviceConfig; import android.telephony.SubscriptionManager; import android.telephony.TelephonyFrameworkInitializer; import android.telephony.TelephonyManager; @@ -258,6 +259,9 @@ public final class TelephonyUtils { */ public static void showErrorIfSubscriptionAssociatedWithManagedProfile(Context context, int subId) { + if (!isSwitchToManagedProfileDialogFlagEnabled()) { + return; + } final long token = Binder.clearCallingIdentity(); try { SubscriptionManager subscriptionManager = context.getSystemService( @@ -286,6 +290,11 @@ public final class TelephonyUtils { } } + public static boolean isSwitchToManagedProfileDialogFlagEnabled() { + return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER, + "enable_switch_to_managed_profile_dialog", false); + } + /** * Check if the process with given uid is foreground. *