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

Commit 111845f9 authored by Amit Mahajan's avatar Amit Mahajan Committed by android-build-merger
Browse files

Merge "Clear calling identity in SmsNumberUtils.needToConvert()"

am: 98c0c5cc

Change-Id: Ie3b10e151cfaf6339f30651ec1ae339f4e7f3d32
parents 88fb6c2c 98c0c5cc
Loading
Loading
Loading
Loading
+22 −14
Original line number Diff line number Diff line
@@ -16,23 +16,24 @@

package com.android.internal.telephony;

import java.util.ArrayList;
import java.util.HashMap;

import android.content.Context;
import android.os.Build;
import android.os.PersistableBundle;
import android.text.TextUtils;
import android.database.Cursor;
import android.database.SQLException;
import android.os.Binder;
import android.os.Build;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.telephony.Rlog;
import android.telephony.TelephonyManager;
import android.text.TextUtils;

import com.android.internal.telephony.HbpcdLookup.MccIdd;
import com.android.internal.telephony.HbpcdLookup.MccLookup;

import java.util.ArrayList;
import java.util.HashMap;


 /**
 * This class implements handle the MO SMS target address before sending.
@@ -601,15 +602,22 @@ public class SmsNumberUtils {
    }

    private static boolean needToConvert(Phone phone) {
        // Calling package may not have READ_PHONE_STATE which is required for getConfig().
        // Clear the calling identity so that it is called as self.
        final long identity = Binder.clearCallingIdentity();
        try {
            CarrierConfigManager configManager = (CarrierConfigManager)
                    phone.getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
            if (configManager != null) {
                PersistableBundle bundle = configManager.getConfig();
                if (bundle != null) {
                return bundle.getBoolean(
                        CarrierConfigManager.KEY_SMS_REQUIRES_DESTINATION_NUMBER_CONVERSION_BOOL);
                    return bundle.getBoolean(CarrierConfigManager
                            .KEY_SMS_REQUIRES_DESTINATION_NUMBER_CONVERSION_BOOL);
                }
            }
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
        // by default this value is false
        return false;
    }