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

Commit 281d7378 authored by Ayush Sharma's avatar Ayush Sharma
Browse files

[API] Don't show error for non sms app

Show "Switch to managed profile" dialog only in case of when message is
initiated from an SMS app in personal profile(and SIM user is associated
with managed profile).
We should not show this dialog in non SMS app case, as it may give
strange experience as seen in attached bug.

Bug: 268211439
Test: NA
Change-Id: I619c4884669c0ffea0a86fd3eebcd1dee9248d56
parent 09abd70f
Loading
Loading
Loading
Loading
+12 −18
Original line number Diff line number Diff line
@@ -164,9 +164,8 @@ public class SmsController extends ISmsImplBase {
        // Check if user is associated with the subscription
        if (!TelephonyPermissions.checkSubscriptionAssociatedWithUser(mContext, subId,
                Binder.getCallingUserHandle())) {
            if (TelephonyUtils.isUidForeground(mContext, Binder.getCallingUid())) {
                TelephonyUtils.showErrorIfSubscriptionAssociatedWithManagedProfile(mContext, subId);
            }
            TelephonyUtils.showSwitchToManagedProfileDialogIfAppropriate(mContext, subId,
                    Binder.getCallingUid(), callingPackage);
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_USER_NOT_ALLOWED);
            return;
        }
@@ -263,9 +262,8 @@ public class SmsController extends ISmsImplBase {
        // Check if user is associated with the subscription
        if (!TelephonyPermissions.checkSubscriptionAssociatedWithUser(mContext, subId,
                Binder.getCallingUserHandle())) {
            if (TelephonyUtils.isUidForeground(mContext, Binder.getCallingUid())) {
                TelephonyUtils.showErrorIfSubscriptionAssociatedWithManagedProfile(mContext, subId);
            }
            TelephonyUtils.showSwitchToManagedProfileDialogIfAppropriate(mContext, subId,
                    Binder.getCallingUid(), callingPackage);
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_USER_NOT_ALLOWED);
            return;
        }
@@ -348,9 +346,8 @@ public class SmsController extends ISmsImplBase {
        // Check if user is associated with the subscription
        if (!TelephonyPermissions.checkSubscriptionAssociatedWithUser(mContext, subId,
                Binder.getCallingUserHandle())) {
            if (TelephonyUtils.isUidForeground(mContext, Binder.getCallingUid())) {
                TelephonyUtils.showErrorIfSubscriptionAssociatedWithManagedProfile(mContext, subId);
            }
            TelephonyUtils.showSwitchToManagedProfileDialogIfAppropriate(mContext, subId,
                    Binder.getCallingUid(), callingPackage);
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_USER_NOT_ALLOWED);
            return;
        }
@@ -388,9 +385,8 @@ public class SmsController extends ISmsImplBase {
        // Check if user is associated with the subscription
        if (!TelephonyPermissions.checkSubscriptionAssociatedWithUser(mContext, subId,
                Binder.getCallingUserHandle())) {
            if (TelephonyUtils.isUidForeground(mContext, Binder.getCallingUid())) {
                TelephonyUtils.showErrorIfSubscriptionAssociatedWithManagedProfile(mContext, subId);
            }
            TelephonyUtils.showSwitchToManagedProfileDialogIfAppropriate(mContext, subId,
                    Binder.getCallingUid(), callingPackage);
            sendErrorInPendingIntents(sentIntents, SmsManager.RESULT_USER_NOT_ALLOWED);
            return;
        }
@@ -426,9 +422,8 @@ public class SmsController extends ISmsImplBase {
        // Check if user is associated with the subscription
        if (!TelephonyPermissions.checkSubscriptionAssociatedWithUser(mContext, subId,
                Binder.getCallingUserHandle())) {
            if (TelephonyUtils.isUidForeground(mContext, Binder.getCallingUid())) {
                TelephonyUtils.showErrorIfSubscriptionAssociatedWithManagedProfile(mContext, subId);
            }
            TelephonyUtils.showSwitchToManagedProfileDialogIfAppropriate(mContext, subId,
                    Binder.getCallingUid(), callingPackage);
            sendErrorInPendingIntents(sentIntents, SmsManager.RESULT_USER_NOT_ALLOWED);
            return;
        }
@@ -934,9 +929,8 @@ public class SmsController extends ISmsImplBase {
        // Check if user is associated with the subscription
        if (!TelephonyPermissions.checkSubscriptionAssociatedWithUser(mContext, subId,
                Binder.getCallingUserHandle())) {
            if (TelephonyUtils.isUidForeground(mContext, Binder.getCallingUid())) {
                TelephonyUtils.showErrorIfSubscriptionAssociatedWithManagedProfile(mContext, subId);
            }
            TelephonyUtils.showSwitchToManagedProfileDialogIfAppropriate(mContext, subId,
                    Binder.getCallingUid(), callingPackage);
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_USER_NOT_ALLOWED);
            return;
        }