Merge "Add flag for switch to managed profile dialog" into udc-dev am: cd8470103f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21508430

Change-Id: I5e81c7a638512431d70fa029de221e61acf55849
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Ayush Sharma
2023-03-09 13:56:13 +00:00
committed by Automerger Merge Worker

View File

@@ -31,6 +31,7 @@ import android.os.RemoteException;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.os.UserHandle; import android.os.UserHandle;
import android.os.UserManager; import android.os.UserManager;
import android.provider.DeviceConfig;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
import android.telephony.TelephonyFrameworkInitializer; import android.telephony.TelephonyFrameworkInitializer;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
@@ -258,6 +259,9 @@ public final class TelephonyUtils {
*/ */
public static void showErrorIfSubscriptionAssociatedWithManagedProfile(Context context, public static void showErrorIfSubscriptionAssociatedWithManagedProfile(Context context,
int subId) { int subId) {
if (!isSwitchToManagedProfileDialogFlagEnabled()) {
return;
}
final long token = Binder.clearCallingIdentity(); final long token = Binder.clearCallingIdentity();
try { try {
SubscriptionManager subscriptionManager = context.getSystemService( 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. * Check if the process with given uid is foreground.
* *