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

Commit 78dc720a authored by sqian's avatar sqian Committed by Shuo Qian
Browse files

Fix Emergency Sms permission check

Pii user's destination number for text by the way.

Test: Manual
Bug: 130781005
Bug: 133452462
Change-Id: If1c4448bb8d5001ffa57b1afccd75bc0996cbc71
parent 4e451042
Loading
Loading
Loading
Loading
+27 −20
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.internal.telephony;

import android.content.Context;
import android.os.Binder;
import android.os.PersistableBundle;
import android.os.RemoteException;
import android.provider.Telephony.Sms.Intents;
@@ -258,9 +259,12 @@ public class ImsSmsDispatcher extends SMSDispatcher {
        PersistableBundle b;
        boolean eSmsCarrierSupport = false;
        if (!PhoneNumberUtils.isLocalEmergencyNumber(mContext, mPhone.getSubId(), destAddr)) {
            Rlog.e(TAG, "Emergency Sms is not supported for: " + destAddr);
            Rlog.e(TAG, "Emergency Sms is not supported for: " + Rlog.pii(TAG, destAddr));
            return false;
        }

        final long identity = Binder.clearCallingIdentity();
        try {
            CarrierConfigManager configManager = (CarrierConfigManager) mPhone.getContext()
                    .getSystemService(Context.CARRIER_CONFIG_SERVICE);
            if (configManager == null) {
@@ -272,16 +276,19 @@ public class ImsSmsDispatcher extends SMSDispatcher {
                Rlog.e(TAG, "PersistableBundle is null");
                return false;
            }
        eSmsCarrierSupport = b.getBoolean(CarrierConfigManager.
                                                      KEY_SUPPORT_EMERGENCY_SMS_OVER_IMS_BOOL);
            eSmsCarrierSupport = b.getBoolean(
                    CarrierConfigManager.KEY_SUPPORT_EMERGENCY_SMS_OVER_IMS_BOOL);
            boolean lteOrLimitedLte = isEmergencySmsPossible();
            Rlog.i(TAG, "isEmergencySmsSupport emergencySmsCarrierSupport: "
               + eSmsCarrierSupport + " destAddr: " + destAddr + " mIsImsServiceUp: "
               + mIsImsServiceUp + " lteOrLimitedLte: " + lteOrLimitedLte);
                    + eSmsCarrierSupport + " destAddr: " + Rlog.pii(TAG, destAddr)
                    + " mIsImsServiceUp: " + mIsImsServiceUp + " lteOrLimitedLte: "
                    + lteOrLimitedLte);

            return eSmsCarrierSupport && mIsImsServiceUp && lteOrLimitedLte;
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
    }


    public boolean isAvailable() {
        synchronized (mLock) {