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

Commit 69298012 authored by zhaoyouyi's avatar zhaoyouyi Committed by Michael Bestas
Browse files

Telephony: Fix out of boundary for non telephony device.



Test: boot a wifi only device and check com.android.phone do not crash
Bug: 141396302
Change-Id: I4315f538a8a03a4b31b8ee77e16cc276ab712088
Signed-off-by: default avatarzhaoyouyi <zhaoyouyi@allwinnertech.com>
parent 16a0a3ec
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -222,6 +222,11 @@ public class PhoneSubInfoController extends IPhoneSubInfo.Stub {
        if (!SubscriptionManager.isValidPhoneId(phoneId)) {
            phoneId = 0;
        }
        if (phoneId < 0 || phoneId >= mPhone.length) {
            log("getPhone, phoneId: " + phoneId +
                ", mPhone.length: " + mPhone.length + ", should never here!");
            return null;
        }
        return mPhone[phoneId];
    }

@@ -467,6 +472,11 @@ public class PhoneSubInfoController extends IPhoneSubInfo.Stub {
        if (!SubscriptionManager.isValidPhoneId(phoneId)) {
            phoneId = 0;
        }
        if (phoneId < 0 || phoneId >= mPhone.length) {
            log("callPhoneMethodForPhoneIdWithReadDeviceIdentifiersCheck, phoneId: " + phoneId +
                ", mPhone.length: " + mPhone.length + ", should never here!");
            return null;
        }
        final Phone phone = mPhone[phoneId];
        if (phone == null) {
            return null;
+10 −0
Original line number Diff line number Diff line
@@ -874,6 +874,11 @@ public class PhoneSwitcher extends Handler {
    }

    private void switchPhone(int phoneId, boolean active) {
        if (phoneId < 0 || phoneId >= mNumPhones) {
            log("switchPhone, phoneId: " + phoneId +
                ", mNumPhones: " + mNumPhones + ", should never here!");
            return;
        }
        PhoneState state = mPhoneStates[phoneId];
        if (state.active == active) return;
        state.active = active;
@@ -1089,6 +1094,11 @@ public class PhoneSwitcher extends Handler {

    @VisibleForTesting
    protected boolean isPhoneActive(int phoneId) {
        if (phoneId < 0 || phoneId >= mNumPhones) {
            log("isPhoneActive, phoneId: " + phoneId +
                ", mNumPhones: " + mNumPhones + ", should never here!");
            return false;
        }
        return mPhoneStates[phoneId].active;
    }