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

Commit a26db29c authored by Umashankar Godachi's avatar Umashankar Godachi Committed by Gerrit - the friendly Code Review server
Browse files

Fix to display the proper operator name on carkit.

Currently the operator name returned in BluetoothPhoneService
is incorrect with the existing API used.
Get the network operator name correctly in BluetoothPhoneService
using telephony manager API.

Change-Id: I1244ba72a1ea5c12edea2370e32a993d336ac07f
CRs-Fixed: 767030.
parent 96960c7a
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -32,13 +32,16 @@ import android.os.Message;
import android.os.RemoteException;
import android.telecom.CallState;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.PhoneCapabilities;
import android.telephony.PhoneNumberUtils;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;

import com.android.server.telecom.CallsManager.CallsManagerListener;

import java.lang.NumberFormatException;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -291,7 +294,20 @@ public final class BluetoothPhoneService extends Service {
                    try {
                        PhoneAccount account = getBestPhoneAccount();
                        if (account != null) {
                            label = account.getLabel().toString();
                            PhoneAccountHandle ph = account.getAccountHandle();
                            if (ph != null) {
                                String subId = ph.getId();
                                Long sub = SubscriptionManager.getDefaultVoiceSubId();
                                try {
                                    sub = Long.parseLong(subId);
                                } catch (NumberFormatException e){
                                    Log.w(this, " NumberFormatException " + e);
                                }
                                label = TelephonyManager.from(BluetoothPhoneService.this)
                                         .getNetworkOperatorName(sub);
                            } else {
                                Log.w(this, "Phone Account Handle is NULL");
                            }
                        } else {
                            // Finally, just get the network name from telephony.
                            label = TelephonyManager.from(BluetoothPhoneService.this)