From 61e565b733e5f40a54cf5e497c8e8be3be66876c Mon Sep 17 00:00:00 2001 From: Dante Russo Date: Tue, 25 Feb 2020 12:17:22 +0800 Subject: Use sub specific telephony for emergency supl In multi-sim cases, we need to get the sub specific telephony service in order to get the correct value from functions getNetworkType and getServiceState for the active sub instead of the default sub. Bug: 150115901 Change-Id: Icb2e50500fe567fa1fee14eaaf04f0b308bc6cc6 CRs-fixed: 2616763 --- .../android/server/location/GnssNetworkConnectivityHandler.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/core/java/com/android/server/location/GnssNetworkConnectivityHandler.java b/services/core/java/com/android/server/location/GnssNetworkConnectivityHandler.java index 93227bd78a81..9ee9dcba9a81 100644 --- a/services/core/java/com/android/server/location/GnssNetworkConnectivityHandler.java +++ b/services/core/java/com/android/server/location/GnssNetworkConnectivityHandler.java @@ -598,6 +598,15 @@ class GnssNetworkConnectivityHandler { } TelephonyManager phone = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); + // During an emergency call with an active sub id, get the Telephony Manager specific + // to the active sub to get the correct value from getServiceState and getNetworkType + if (mNiHandler.getInEmergency() && mActiveSubId >= 0) { + TelephonyManager subIdTelManager = + phone.createForSubscriptionId(mActiveSubId); + if (subIdTelManager != null) { + phone = subIdTelManager; + } + } ServiceState serviceState = phone.getServiceState(); String projection = null; String selection = null; -- cgit v1.2.3-59-g8ed1b