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

Commit d617ef1e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Clear calling identity in SmsNumberUtils.needToConvert()" into oc-dr1-dev

parents 47c1a77d e1346966
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;
    }