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

Commit 42946b56 authored by terrycrhuang's avatar terrycrhuang Committed by Automerger Merge Worker
Browse files

Fix phone crash by NullPointerException am: 2b82c304 am: 3d2f5bcc

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1927023

Change-Id: I6d1ba1f078f2ef6ac069e346aa3db5d46e8c4add
parents 18e74c61 3d2f5bcc
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -57,7 +57,8 @@ public class RadioConfig extends Handler {
    private static final boolean VDBG = false; //STOPSHIP if true
    private static final Object sLock = new Object();

    static final int EVENT_SERVICE_DEAD = 1;
    static final int EVENT_HIDL_SERVICE_DEAD = 1;
    static final int EVENT_AIDL_SERVICE_DEAD = 2;
    static final HalVersion RADIO_CONFIG_HAL_VERSION_UNKNOWN = new HalVersion(-1, -1);
    static final HalVersion RADIO_CONFIG_HAL_VERSION_1_0 = new HalVersion(1, 0);
    static final HalVersion RADIO_CONFIG_HAL_VERSION_1_1 = new HalVersion(1, 1);
@@ -137,12 +138,16 @@ public class RadioConfig extends Handler {

    @Override
    public void handleMessage(Message message) {
        if (message.what == EVENT_SERVICE_DEAD) {
            logd("handleMessage: EVENT_SERVICE_DEAD cookie = " + message.obj
        if (message.what == EVENT_HIDL_SERVICE_DEAD) {
            logd("handleMessage: EVENT_HIDL_SERVICE_DEAD cookie = " + message.obj
                    + " mRadioConfigProxyCookie = " + mRadioConfigProxyCookie.get());
            if ((long) message.obj == mRadioConfigProxyCookie.get()) {
                resetProxyAndRequestList("EVENT_SERVICE_DEAD", null);
                resetProxyAndRequestList("EVENT_HIDL_SERVICE_DEAD", null);
            }
        } else if (message.what == EVENT_AIDL_SERVICE_DEAD) {
            logd("handleMessage: EVENT_AIDL_SERVICE_DEAD mRadioConfigProxyCookie = "
                    + mRadioConfigProxyCookie.get());
            resetProxyAndRequestList("EVENT_AIDL_SERVICE_DEAD", null);
        }
    }

@@ -259,7 +264,7 @@ public class RadioConfig extends Handler {
                serviceBound = false;
            }

            if (serviceBound) resetProxyAndRequestList("EVENT_SERVICE_DEAD", null);
            if (serviceBound) resetProxyAndRequestList("EVENT_HIDL_SERVICE_DEAD", null);
        }

        if ((serviceName == null) || (!serviceBound)) {
+3 −2
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ public class RadioConfigProxy {
            // Deal with service going away
            Rlog.e(TAG, "serviceDied");
            mRadioConfig.sendMessage(
                    mRadioConfig.obtainMessage(RadioConfig.EVENT_SERVICE_DEAD, cookie));
                    mRadioConfig.obtainMessage(RadioConfig.EVENT_HIDL_SERVICE_DEAD, cookie));
        }
    }

@@ -329,7 +329,8 @@ public class RadioConfigProxy {
        public void binderDied() {
            Rlog.e(TAG, "service died.");
            unlinkToDeath();
            mRadioConfig.sendMessage(mRadioConfig.obtainMessage(RadioConfig.EVENT_SERVICE_DEAD));
            mRadioConfig.sendMessage(
                    mRadioConfig.obtainMessage(RadioConfig.EVENT_AIDL_SERVICE_DEAD));
        }
    }
}