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

Commit 6148ebbd authored by Malcolm Chen's avatar Malcolm Chen
Browse files

Remove UID packageName check in checkCarrierPrivilegeOnSubList.

When groupUuid is updated through carrier config update, it calls
checkCarrierPrivilegeOnSubList but not through a Binder call. So
UID and packageName check will fail. In this case, the check is not
needed as we get packageName through binding carrier service so it's
already a trusted source.
Here we are:
1) removing the check in the checkCarrierPrivilegeOnSubList.
2) make sure all external calls checks UID / packageName before calling
checkCarrierPrivilegeOnSubList.

Bug: 132968722
Test: manual
Merged-In: Ibced4799cfa4d721e17ce69aa87f884613a5dc26
Change-Id: Ibced4799cfa4d721e17ce69aa87f884613a5dc26
(cherry picked from commit b6371bea)
parent c738117c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2846,6 +2846,9 @@ public class SubscriptionController extends ISub.Stub {
        if (subIdList == null || subIdList.length == 0) {
            throw new IllegalArgumentException("Invalid subIdList " + subIdList);
        }

        // Makes sure calling package matches caller UID.
        mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
        // If it doesn't have modify phone state permission, or carrier privilege permission,
        // a SecurityException will be thrown.
        if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
@@ -3071,7 +3074,6 @@ public class SubscriptionController extends ISub.Stub {
     *  @return true if checking passes on all subId, false otherwise.
     */
    private boolean checkCarrierPrivilegeOnSubList(int[] subIdList, String callingPackage) {
        mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
        // Check carrier privilege permission on active subscriptions first.
        // If it fails, they could be inactive. So keep them in a HashSet and later check
        // access rules in our database.