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

Skip to content
Commit 2542a844 authored by John Stultz's avatar John Stultz
Browse files

PhoneSwitcher: Fix ArrayIndexOutOfBoundsException in isPhoneActive()



On HiKey960 (and likely also on other devboards w/o a modem),
we are seeing a lot of the following crashes since commit
f544a5ec ("Remove unecessary member variables of
PhoneSwitcher."):

 FATAL EXCEPTION: main
 Process: com.android.phone, PID: 11848
 java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
        at com.android.internal.telephony.PhoneSwitcher.isPhoneActive(PhoneSwitcher.java:1113)
        at com.android.internal.telephony.PhoneSwitcher.shouldApplyNetworkRequest(PhoneSwitcher.java:1096)
        at com.android.internal.telephony.dataconnection.TelephonyNetworkFactory.onNeedNetworkFor(TelephonyNetworkFactory.java:290)
...

While I suspect there is a more optimal fix, adding a test
to ensure the phoneId isn't greater or equal to the
mActiveModemCount seems to avoid the problem

Fixes: f544a5ec ("Remove unecessary member variables of PhoneSwitcher.")
Change-Id: I586f56e3571de173939f5a87ecfaf44339e8d591
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
parent d3d8cd2f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment