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

Commit bd772363 authored by Naveen Kalla's avatar Naveen Kalla Committed by Wink Saville
Browse files

Invoke shutdownMobileRadios Telephony APIs from ShutdownThread

shutdownMobileRadios API shuts down multiple Radios on MSIM devices and
also gracefully shuts down Radios and SIM cards on single SIM and
MSIM devices. Use this API instead of the old setRadio APIs.

Add RIL_REQUEST_SHUTDOWN to RILConstants. Message is sent to notify
RIL that the device is shutting down.

Bug: 9773278
Change-Id: I6afa9e810cefc7855f7ae42e51f39cc51fa2aa6e
parent 2df7d1ef
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -430,10 +430,10 @@ public final class ShutdownThread extends Thread {
                }
                }


                try {
                try {
                    radioOff = phone == null || !phone.isRadioOn();
                    radioOff = phone == null || !phone.needMobileRadioShutdown();
                    if (!radioOff) {
                    if (!radioOff) {
                        Log.w(TAG, "Turning off radio...");
                        Log.w(TAG, "Turning off cellular radios...");
                        phone.setRadio(false);
                        phone.shutdownMobileRadios();
                    }
                    }
                } catch (RemoteException ex) {
                } catch (RemoteException ex) {
                    Log.e(TAG, "RemoteException during radio shutdown", ex);
                    Log.e(TAG, "RemoteException during radio shutdown", ex);
@@ -456,7 +456,7 @@ public final class ShutdownThread extends Thread {
                    }
                    }
                    if (!radioOff) {
                    if (!radioOff) {
                        try {
                        try {
                            radioOff = !phone.isRadioOn();
                            radioOff = !phone.needMobileRadioShutdown();
                        } catch (RemoteException ex) {
                        } catch (RemoteException ex) {
                            Log.e(TAG, "RemoteException during radio shutdown", ex);
                            Log.e(TAG, "RemoteException during radio shutdown", ex);
                            radioOff = true;
                            radioOff = true;
@@ -472,7 +472,7 @@ public final class ShutdownThread extends Thread {
                            Log.e(TAG, "RemoteException during NFC shutdown", ex);
                            Log.e(TAG, "RemoteException during NFC shutdown", ex);
                            nfcOff = true;
                            nfcOff = true;
                        }
                        }
                        if (radioOff) {
                        if (nfcOff) {
                            Log.i(TAG, "NFC turned off.");
                            Log.i(TAG, "NFC turned off.");
                        }
                        }
                    }
                    }
+12 −1
Original line number Original line Diff line number Diff line
@@ -793,5 +793,16 @@ interface ITelephony {
     *         positive value success, data length of response
     *         positive value success, data length of response
     */
     */
    int invokeOemRilRequestRaw(in byte[] oemReq, out byte[] oemResp);
    int invokeOemRilRequestRaw(in byte[] oemReq, out byte[] oemResp);
}


    /**
     * Check if any mobile Radios need to be shutdown.
     *
     * @return true is any mobile radio needs to be shutdown
     */
    boolean needMobileRadioShutdown();

    /**
     * Shutdown Mobile Radios
     */
    void shutdownMobileRadios();
}
+3 −0
Original line number Original line Diff line number Diff line
@@ -287,7 +287,10 @@ cat include/telephony/ril.h | \
    int RIL_REQUEST_ALLOW_DATA = 123;
    int RIL_REQUEST_ALLOW_DATA = 123;
    int RIL_REQUEST_GET_HARDWARE_CONFIG = 124;
    int RIL_REQUEST_GET_HARDWARE_CONFIG = 124;
    int RIL_REQUEST_SIM_AUTHENTICATION = 125;
    int RIL_REQUEST_SIM_AUTHENTICATION = 125;
    int RIL_REQUEST_GET_DC_RT_INFO = 126;
    int RIL_REQUEST_SET_DC_RT_INFO_RATE = 127;
    int RIL_REQUEST_SET_DATA_PROFILE = 128;
    int RIL_REQUEST_SET_DATA_PROFILE = 128;
    int RIL_REQUEST_SHUTDOWN = 129;


    int RIL_UNSOL_RESPONSE_BASE = 1000;
    int RIL_UNSOL_RESPONSE_BASE = 1000;
    int RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED = 1000;
    int RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED = 1000;