diff options
| author | Joey Hewitt <joey@joeyhewitt.com> | 2017-08-31 18:28:27 -0700 |
|---|---|---|
| committer | Joey Hewitt <joey@joeyhewitt.com> | 2017-09-01 20:33:16 -0700 |
| commit | e67ecb23324622550fb24c38ba8a68eaa191eee6 (patch) | |
| tree | 99694078a9f592594047f37d1a822aae9fcb6142 | |
| parent | 32e50f36641e74bd19aab167ea2cb29137aadfaa (diff) | |
| download | frameworks_opt_telephony_ril_ofono-e67ecb23324622550fb24c38ba8a68eaa191eee6.tar.gz frameworks_opt_telephony_ril_ofono-e67ecb23324622550fb24c38ba8a68eaa191eee6.tar.bz2 frameworks_opt_telephony_ril_ofono-e67ecb23324622550fb24c38ba8a68eaa191eee6.zip | |
switch oFono to Gobi driver!
Basic network info, and SMS seem to be working. No calls or USSD, as
they are not supported by the oFono mainline.
* update init.rc patches
* fix some assumptions I made (ConnManager was sometimes not available
in the QMI version, causing crash; and incoming SMSs seem to have no SMSC)
* change hardcoded (in one place) dbus path to the modem
| -rw-r--r-- | patches/system_core.patch | 33 | ||||
| -rwxr-xr-x | push | 2 | ||||
| -rw-r--r-- | src/java/net/scintill/ril_ofono/DataConnModule.java | 9 | ||||
| -rw-r--r-- | src/java/net/scintill/ril_ofono/RilOfono.java | 2 | ||||
| -rw-r--r-- | src/java/net/scintill/ril_ofono/SmsModule.java | 24 | ||||
| -rw-r--r-- | src/java/net/scintill/ril_ofono/Tests.java | 4 | ||||
| -rwxr-xr-x | start | 4 | ||||
| -rwxr-xr-x | stop | 6 |
8 files changed, 59 insertions, 25 deletions
diff --git a/patches/system_core.patch b/patches/system_core.patch index 5de2cae..cea648d 100644 --- a/patches/system_core.patch +++ b/patches/system_core.patch @@ -1,34 +1,31 @@ diff --git a/rootdir/init.rc b/rootdir/init.rc -index 001ab13..6029d3c 100644 +index 001ab13..659b9a4 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc -@@ -561,6 +561,30 @@ service ril-daemon /system/bin/rild +@@ -561,6 +561,27 @@ service ril-daemon /system/bin/rild user root group radio cache inet misc audio sdcard_rw qcom_diag log +service dbus /system/bin/dbus-daemon --system --nofork ++ disabled + class main + socket dbus stream 0660 root radio + user radio + group radio + -+service ofonod /system/bin/ofonod --nodetach -+ disabled -+ class main -+ user radio -+ group radio -+ setenv OFONO_RIL_DEVICE ril -+ setenv OFONO_RIL_RAT_LTE 1 ++service qmiserial2qmuxd /system/bin/qmiserial2qmuxd ++ disabled ++ class main ++ user radio ++ group radio + -+service ofonod-debug /system/bin/ofonod --nodetach --debug -+ disabled -+ class main -+ user radio -+ group radio -+ setenv OFONO_RIL_DEVICE ril -+ setenv OFONO_RIL_RAT_LTE 1 -+ setenv OFONO_RIL_TRACE 1 -+ setenv OFONO_RIL_HEX_TRACE 1 ++service ofonod /system/bin/ofonod --nodetach --debug ++ disabled ++ class main ++ user radio ++ group radio ++ setenv OFONO_GOBI_DEVICE /data/misc/radio/qmiserial ++ setenv OFONO_QMI_DEBUG 1 + service surfaceflinger /system/bin/surfaceflinger class core @@ -1,2 +1,2 @@ #!/bin/bash -adb push {$ANDROID_PRODUCT_OUT,}/system/app/RilOfono +adb push {$ANDROID_PRODUCT_OUT,}/system/app/RilOfono/RilOfono.apk diff --git a/src/java/net/scintill/ril_ofono/DataConnModule.java b/src/java/net/scintill/ril_ofono/DataConnModule.java index 956710b..d9a5885 100644 --- a/src/java/net/scintill/ril_ofono/DataConnModule.java +++ b/src/java/net/scintill/ril_ofono/DataConnModule.java @@ -211,8 +211,13 @@ import static net.scintill.ril_ofono.RilOfono.runOnMainThreadDebounced; * this value to off detaches the modem from the * Packet Domain network. */ - mConnMan.SetProperty("Powered", new Variant<>(allowed)); - respondOk("setDataAllowed", result, null); + try { + mConnMan.SetProperty("Powered", new Variant<>(allowed)); + respondOk("setDataAllowed", result, null); + } catch (Throwable t) { + Rlog.e(TAG, "Exception setting ConnMan.Powered to "+allowed, t); + respondExc("setDataAllowed", result, GENERIC_FAILURE, null); + } } @RilMethod diff --git a/src/java/net/scintill/ril_ofono/RilOfono.java b/src/java/net/scintill/ril_ofono/RilOfono.java index dfcb131..fa33276 100644 --- a/src/java/net/scintill/ril_ofono/RilOfono.java +++ b/src/java/net/scintill/ril_ofono/RilOfono.java @@ -978,7 +978,7 @@ public class RilOfono extends BaseCommands implements CommandsInterface { // iccTransmitApduBasicChannel(), getAtr(), setLocalCallHold() private static final String OFONO_BUS_NAME = "org.ofono"; - private static final String MODEM_PATH = "/ril_0"; + private static final String MODEM_PATH = "/gobi_0"; // TODO make this dynamically use the "first" modem we see (because we only expect one) /*package*/ <T extends DBusInterface> T getOfonoInterface(Class<T> tClass) { return getOfonoInterface(tClass, MODEM_PATH); diff --git a/src/java/net/scintill/ril_ofono/SmsModule.java b/src/java/net/scintill/ril_ofono/SmsModule.java index ebb881d..6992de4 100644 --- a/src/java/net/scintill/ril_ofono/SmsModule.java +++ b/src/java/net/scintill/ril_ofono/SmsModule.java @@ -114,14 +114,34 @@ import static net.scintill.ril_ofono.RilOfono.runOnMainThread; @Override public void run() { try { - mSmsRegistrants.notifyResult(SmsMessage.createFromPdu(s.pdu, SmsConstants.FORMAT_3GPP)); + SmsMessage msg = SmsMessage.createFromPdu(normalizePdu(s.pdu, s.tpdu_len), SmsConstants.FORMAT_3GPP); + try { + // someone decided to swallow exceptions and return null as the wrapped object, so check it + if (msg != null) msg.getTimestampMillis(); + } catch (NullPointerException e) { + // SmsMessage probably logged more information about the cause, but I want to know what the PDU was + Rlog.e(TAG, "Null returned from parsing incoming PDU "+privStr(IccUtils.bytesToHexString(s.pdu)+" tpdu_len="+s.tpdu_len)); + } + mSmsRegistrants.notifyResult(msg); } catch (Throwable t) { - Rlog.e(TAG, "Error parsing incoming PDU "+privStr(IccUtils.bytesToHexString(s.pdu)), t); + Rlog.e(TAG, "Error handling incoming PDU "+privStr(IccUtils.bytesToHexString(s.pdu)+" tpdu_len="+s.tpdu_len)); } } }); } + private static byte[] normalizePdu(byte[] pdu, int tpdu_len) { + // pdu might have smsc prefixed. Android PDU parser assumes it's always there + if (tpdu_len == pdu.length) { + byte[] npdu = new byte[pdu.length + 1]; + npdu[0] = 0; + System.arraycopy(pdu, 0, npdu, 1, pdu.length); + return npdu; + } else { + return pdu; + } + } + public void handle(org.ofono.Message.PropertyChanged s) { if (s.name.equals("State")) { String value = (String) s.value.getValue(); diff --git a/src/java/net/scintill/ril_ofono/Tests.java b/src/java/net/scintill/ril_ofono/Tests.java index 682a713..f7758dd 100644 --- a/src/java/net/scintill/ril_ofono/Tests.java +++ b/src/java/net/scintill/ril_ofono/Tests.java @@ -57,6 +57,10 @@ public class Tests implements Runnable { private void injectReceivedMessage(String sender, String text, Date date, boolean immediate) throws Throwable { byte[] pdu = createReceivedMessage(sender, text, date, immediate); + injectReceivedMessage(pdu); + } + + private void injectReceivedMessage(byte[] pdu) throws Throwable { MessageManager.IncomingPdu s = new MessageManager.IncomingPdu("/", pdu, (byte)((pdu.length-1) & 0xff)); mSmsModule.handle(s); } @@ -1,3 +1,7 @@ #!/bin/bash ./push +adb shell su root stop ril-daemon +adb shell su root start dbus +adb shell su root start qmiserial2qmuxd +adb shell su root start ofonod adb shell setprop debug.scintill.ril_class net.scintill.ril_ofono/.RilOfono \; killall com.android.phone @@ -1,2 +1,6 @@ #!/bin/bash -adb shell setprop debug.scintill.ril_class '' \; killall com.android.phone +adb shell su root stop ofonod +adb shell su root stop qmiserial2qmuxd +adb shell su root stop dbus +adb shell su root start ril-daemon +adb shell setprop debug.scintill.ril_class '""' \; killall com.android.phone |
