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

Commit 51cec878 authored by sqian's avatar sqian Committed by android-build-merger
Browse files

Fix Emergency Sms permission check am: 78dc720a

am: ebe93288

Change-Id: I2814054ceceb01e4a01e92cbaeecb021330dc553
parents 15d66761 ebe93288
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;
@@ -262,9 +263,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) {
@@ -276,16 +280,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) {