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

Commit c201b490 authored by Taesu Lee's avatar Taesu Lee Committed by Amit Mahajan
Browse files

Require READ_PHONE_STATE for getSmsCapacityOnIcc() instead



Check whether the caller can read phone state for getSmsCapacityOnIcc().

Bug: 154878196
Test: Manual

Signed-off-by: default avatarTaesu Lee <taesu82.lee@samsung.com>
Change-Id: If403a4ba557e4322b25607c478b109e58a0e3ae9
(cherry picked from commit e7020143685ffb8de2fa33e582e4361c2d7f89ea)
parent 982e14d9
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1365,10 +1365,12 @@ public class IccSmsInterfaceManager {
                0L /* messageId */);
    }

    public int getSmsCapacityOnIcc() {
        mContext.enforceCallingOrSelfPermission(
                android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
                "getSmsCapacityOnIcc");
    public int getSmsCapacityOnIcc(String callingPackage, String callingFeatureId) {
        if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
                mContext, mPhone.getSubId(), callingPackage, callingFeatureId,
                "getSmsCapacityOnIcc")) {
            return 0;
        }

        int numberOnIcc = 0;
        if (mPhone.getIccRecordsLoaded()) {
+1 −1
Original line number Diff line number Diff line
@@ -816,7 +816,7 @@ public class SmsController extends ISmsImplBase {
        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);

        if (iccSmsIntMgr != null ) {
            return iccSmsIntMgr.getSmsCapacityOnIcc();
            return iccSmsIntMgr.getSmsCapacityOnIcc(getCallingPackage(), null);
        } else {
            Rlog.e(LOG_TAG, "iccSmsIntMgr is null for " + " subId: " + subId);
            return 0;