From f0026eebfc2849c51232793707721338a2e06883 Mon Sep 17 00:00:00 2001 From: Iris Chang Date: Wed, 13 Mar 2019 15:40:43 +0800 Subject: [PATCH] Should return the number of supported SIM cards When multiple SIM is enabled, getSimCount() in TelephonyManager.java just returns 2 and it is not consistent with getPhoneCount(). For devices which support more than 2 SIMs, it will cause ArrayIndexOutOfBoundsException in the getInstance() function of CatService.java when thress SIMs are present. To fix this issue, we need to return the phone count in getSimCount() to synchronize both APIs. Bug: 126292874 Test: check if JE is fixed on a device which supports 3 SIMs Change-Id: I227f7d05349c1d0cf4c8bfa46c4e3b5f9bd42be9 --- telephony/java/android/telephony/TelephonyManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 3e7b7e12249c3..8bfc206d64e78 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -5978,7 +5978,7 @@ public class TelephonyManager { // FIXME Need to get it from Telephony Dev Controller when that gets implemented! // and then this method shouldn't be used at all! if(isMultiSimEnabled()) { - return 2; + return getPhoneCount(); } else { return 1; }