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

Commit b6371bea authored by Malcolm Chen's avatar Malcolm Chen Committed by Xiangyu/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
Change-Id: Ibced4799cfa4d721e17ce69aa87f884613a5dc26
parent eda1b1b8
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2856,6 +2856,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)
@@ -3081,7 +3084,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.