Commit graph

132 commits

Author SHA1 Message Date
Gohulan Balachandran
2280949246
libril: Replace strncpy with strlcpy.
Use strlcpy instead of strncpy when copying strings to make sure
the copy is always null-terminated.

Change-Id: I12d4883c22a180e2136dc8c85bc0394ddcdcb706
2018-10-24 03:49:38 +02:00
terrycrhuang
86d49f7680
libril: Change rild initial sequence to
guarantee non-null function pointer before rild register its hidl service

Test: Build and local test
Bug: 78886552
Change-Id: I1137cc0f4f09f0304662a2227b84c2b5b228d45d
2018-10-24 03:49:13 +02:00
Steven Moreland
c0b88c91d3
libril: Add DISABLE_RILD_OEM_HOOK.
OEM hook is deprecated, so adding a way to disable it to
this radio implementation.

Bug: 75322118
Test: boot device w/ DISABLE_RILD_OEM_HOOK works, lshal
Change-Id: Ie7ade48476d2c330df608e9cc8dab805f84dd81d
2018-10-24 03:49:12 +02:00
Amit Mahajan
afe706fbb0
libril: Store the system time when NITZ is
received.

If cached value for NITZ is used, the time at which it was
received needs to be cached too.

Test: Basic telephony sanity
Bug: 72283604
Change-Id: I8f443171c4583e3eab9be7973d7714ae6c7ab6af
2018-10-24 03:49:11 +02:00
Gohulan Balachandran
60a4e9d295
libril: Fix double freeing of memory in SAP
service and add null-checks.

The payload of a SAP request could be freed twice in certain scenarios.
Also, add null-checks to prevent dereferencing of null pointers.

Bug: 64729356
Test: Manually run the fuzz tests and ensure that there is no crash in
      rild

Change-Id: Ib7ae269fa5297d6acea267337b220b8858c82bae
2018-10-24 03:49:09 +02:00
Pengquan Meng
4d60c2dbcf
libril: Remove unused code
Bug: 62249769
Test: manually

Change-Id: Ibeae8537ee87dc9c3481538df0fcdb4f3d50f50c
2018-10-24 03:49:08 +02:00
Nathan Harold
ea60787858
libril: Fix Const-Correctness for
RIL_RadioFunctions

Re-add constant for function pointer table to
RIL_RadioFunctions. Const was accidentally removed
during a warnings cleanup.

Bug: 64231560
Test: compilation
Change-Id: I93675980c51d9162f624495d12fe3c97f1da8031
2018-10-24 03:49:07 +02:00
Lennart Wieboldt
7d58fd493b
libril: Remove LOCAL_CLANG
clang is the default compiler since Android nougat

Change-Id: I0555fa8067352fd43b47aabe80be1224597da17e
Signed-off-by: Lennart Wieboldt <lennart.1997@gmx.de>
2018-10-24 03:49:05 +02:00
Ruthwar Kumar Ambeer
9c58ea3fc0
Sending empty strings instead of NULL for some RIL requests
Some vendor RILs expect empty string instead of NULL pointer
for certain RIL requets. For RIL_REQUEST_ENTER_SIM_PIN,
RIL_REQUEST_ENTER_SIM_PUK, RIL_REQUEST_ENTER_SIM_PIN2,
RIL_REQUEST_ENTER_SIM_PUK2, RIL_REQUEST_CHANGE_SIM_PIN,
RIL_REQUEST_CHANGE_SIM_PIN2,
RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION
RIL_REQUEST_SETUP_DATA_CALL,
RIL_REQUEST_SET_INITIAL_ATTACH_APN, RIL_REQUEST_SET_DATA_PROFILE,
RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION,
RIL_REQUEST_SET_FACILITY_LOCK,
RIL_REQUEST_CHANGE_BARRING_PASSWORD, sending empty string instead
of NULL.

Test: Manual
Bug: 37782683, 65653485
Change-Id: I6627c8a12e096b9ac8ebe08e734782cfa951c488
2018-10-24 03:49:05 +02:00
Stricted
a57421ca2b
libsecril-client: remove unused variables/functions
Change-Id: Ie0d982b85bd114e3d70a45e10db9896cc9cce4d9
2018-10-24 03:49:03 +02:00
Stricted
7641809909
libsecril-client-sap: remove unused variables
Change-Id: I6670ccdf7386730cd672a9dede92417542754732
2018-10-24 03:49:02 +02:00
Stricted
3dbd37f355
libril: remove unused variables/functions
Change-Id: I63230b917614bcfa2aa09f3d894804252d963caa
2018-10-24 03:48:58 +02:00
Stricted
f055a056c9
libril: add missing return statement
Change-Id: Icfdc5fae064f66bfcaf061bff0d0d1e5554f126d
2018-09-08 20:38:54 +02:00
Paul Keith
7240949c54 libril: Fix freeing of strings for roaming protocol flag
Change-Id: Id6150885203a64733bffeb7ce6dc4e91fab305df
2018-07-01 16:08:04 +02:00
Paul Keith
63d0da85d7 ril: service: Fix RIL_UNSOL_NITZ_TIME_RECEIVED Parcel
* Sometimes, the modem is sending 1-2 extra fields with
  the country mcc, which confuses ServiceStateTracker
* Drop the extra data here, instead of in our RIL class

[haggertk]: Forward port to ril-caf on lineage-15.

Change-Id: Ifbec67bb0dac271226bd8b5471deaf6a2ef33f2b
2018-06-23 11:55:58 +02:00
Paul Keith
8cc0417cf2 ril: service: Add workaround for "ring of death" bug
[javelinanddart]: Forward port to ril-caf on lineage-15.1

Change-Id: Ifeeee11ee83deddb8eff565847641c45a105378f
2018-06-23 11:55:50 +02:00
Paul Keith
96ff312382 ril: service: Get off my back
* Checking numInts and numStrings for strict equality when
  we're not looping is dumb, because Samsung is notorious
  for sending extra information in their RIL
* Check if there's *enough* data rather than the *exact amount*
  to fix a bunch of invalid response errors

Change-Id: I14bc37240e5760b4629fcb74b64f25ad95d4fdfc
2018-03-06 19:25:04 +00:00
Christopher N. Hesse
d26f4c920f ril: service: Fix breakage introduced by f7c75aa4e0
Before:
    if (response == NULL || numStrings != 3) {
After:
    if (response == NULL || numStrings != mqanelements - 2) {

This patch fixes the logic so we don't change the value check.

"mqanelements" is not related to getOperatorResponse, so get get rid of
the affected code.

Change-Id: I86c6ae7b7492a5d04fbc8dc415c4f615e7d05bab
2018-03-06 19:20:50 +00:00
Christopher N. Hesse
7f2c1bf988 ril: Add support for imsType parcel member
This is needed for Samsung devices like the Galaxy A5 2017.

Change-Id: I3b89cf8ac232fef5629b439dbf5d2f21bdb264a2
2018-02-22 21:02:29 +00:00
Christopher N. Hesse
ffe632e356 ril: Add support for roamingProtocol parcel member
This is needed for Samsung devices like the Galaxy A5 2017.

Change-Id: I549130b838377d8a8668ac59b51c314fe9e7f5ab
2018-02-22 21:02:04 +00:00
Sean hoyt
7ef59cea50 libsec-ril: Include liblog
Change-Id: I87df49446a2729f19a5d5611a88a4a80faf0350b
2018-01-21 13:29:29 +01:00
Martin Bouchet
f7c75aa4e0 libril: fix network operator search
The number of mQANElements should be defined in the system
prop ro.ril.telephony.mqanelements

Change-Id: Ie5bb8ba80c5ac93b7502da3b1bb3d2b4404ecd5e
2018-01-21 13:29:20 +01:00
Martin Bouchet
d912396454 libril: fix in call presentation
Change-Id: Ifd4a20c0bcd34f380716cc96cdd4c99b4b909266
2018-01-21 13:29:07 +01:00
Martin Bouchet
d53206c5bd libril: handle Samsung proprietary commands
Change-Id: Ief8402c8e75c677c7f2e32794f13867b924b209f
2018-01-21 13:28:25 +01:00
Martin Bouchet
0063444a40 libril: port Samsung responseDataCallList to O libril
Change-Id: I1a1980e25b2ae1c496420fe3bfb0e8999e62f864
2018-01-21 13:28:18 +01:00
Martin Bouchet
db968d4efd libril: port samsung changes to signalStrength
Change-Id: I39c1f5dcb44bcd0cf265243276d7649a9c2fdc8c
2018-01-21 13:27:52 +01:00
Martin Bouchet
c3c6ceeaad libril: add Samsung flags to makefile
Change-Id: I5deb1f7582b207acf908691a7ac69a9ebbc62505
2018-01-21 13:27:48 +01:00
Martin Bouchet
6e9a4971ec libril: bring back signalStrength v5 and v6
Change-Id: Ie0513986e9cabe9b363198e0192b18a0a8fe97de
2018-01-21 13:26:45 +01:00
Martin Bouchet
0d4bbaf7f1 ril: import Oreo AOSP libril
Change-Id: I00750bad812dc263e9c74a504b48512a892376c8
2018-01-21 13:26:31 +01:00
Christopher N. Hesse
8f9268e598 libril: Fix multisim flags
Change-Id: Idb2ea518c115c1dbfbbbbb79094938ce006f40d8
(cherry picked from commit c98cc605c67e950bf14aa9f0d14966382ec45a0c)
2018-01-20 22:29:43 +00:00
Basil Gello
2a40024127 secril-client: close fds on I/O errors
if a kernel device returns an I/O error, it is better not to chew
the CPU resources retrying I/O operation on a not ready device.

Fixes periodical 100%-core load in audioserver after a voice call
completion.

Change-Id: I2b66ffd18c85823a11e50598a6b4e3c0245a0083
2017-08-03 21:03:38 +00:00
Basil Gello
72aac79216 secril-client: Fix RIL client token management in SendOemRequestHookRaw()
On some devices, like SM-T805 (Galaxy Tab S 10.5 LTE), the RIL client
code produces errors "SendOemRequestHookRaw: No token" due to large
amount of tokens allocated by OEM messages requiring no response from
RIL daemon (like set call audio path, set call volume, set mite etc).

The indicator of an OEM message with no response expected is:

     RegisterRequestCompleteHandler(client, REQ_XXX, NULL);

inside the RIL client message method. To prevent the token pool from
overflows, the proposed patch de-registers the token and frees its call
history if the handler for this message req_id is set to NULL.

Change-Id: Id414263bf471115797cae1a9ed628249734b9347
2017-07-17 22:15:16 +00:00
Basil Gello
338942b188 secril-client: return exact error code from blockingWrite()
Change-Id: Ibb6d3636648480c53a2fd19044eefe5b97f1eceb
2017-07-13 19:19:56 +00:00
Christopher N. Hesse
5eda55f20a libsecril-client: Expose MSIM functions by default
Recent devices (zero, noble, others) link audio-ril
against this.

Change-Id: If774ff378f519b221594e8b793a95831cacd4ae4
2017-02-22 11:01:04 +00:00
Simon Shields
a9d8bf6af4 libril: use responseInts for LAST_CALL_FAIL_CAUSE on Exynos4
Exynos4 devices send two ints as a response to this request,
causing responseFailCause to think the result is a LastCallFailCause struct,
which it then tries to treat as a Java UTF-8 encoded string, causing a
crash.

Work around this by forcing responseInts (the original behaviour)
on Exynos4 devices.

Change-Id: Ied14948db3049066ffc760b6d3df09b4cefa2df0
2017-02-19 13:39:36 +00:00
Andreas Schneider
e0058816e9 libsecril-client: Rename SOUND_AUDIO_PATH_HANDSET to EARPIECE
This still keeps SOUND_AUDIO_PATH_HANDSET in the _AudioPath enum to not
break the API.

Change-Id: If82520ff630ceb099c570e299685caef03b0d01b
2017-02-15 10:38:30 +01:00
Simon Shields
5b75c5763c libril: fix parceling of DataCallListV6 on xmm626x
Change-Id: I32fee851e65f8f5af3d57fc4fc588139ff6ded35
2017-02-13 10:26:17 +11:00
Christopher N. Hesse
caece2d972 ril: Fix unsol response array mapping
* Instead of messing around with indices, look up
   the requestNumber in the array.
 * This has a cost of O(N) instead of O(1) with the
   previous implementation, but we don't receive unsol
   response codes frequently enough to be worried about
   this.
 * This was needed because a few vendor reponses, aka
   RIL_UNSOL_SNDMGR_WB_AMR_REPORT at index 33 and
   RIL_UNSOL_SNDMGR_CLOCK_CTRL at index 34
   could not be addressed by their array indices anymore
   because we cannot calculate their index by the unsol
   response code we receive from the modem.

Change-Id: I27319e621c777fe19ae8908d7e0c4a46d6dd6d3b
2017-02-12 12:12:17 +00:00
Christopher N. Hesse
650848675d ril: Align to AOSP libril
* Adjusted whitespace to minimize diffs
 * Plugged memory leaks
 * Fix use-after-free
 * Use calloc instead of alloca
 * Reworked the Samsung request/response code to be
   more readable

Change-Id: Ifd07b525fc84e8a3fca584d4d412785974ca3482
2017-02-09 11:12:02 +00:00
Andreas Schneider
928ddca2ec libsecril-client: Fix logging
Change-Id: I370e70ebfb8fca3d610cdf58c8ac793844d23cb8
2017-02-08 18:46:29 +01:00
Andreas Schneider
a366011f60 libsecril-client: Turn off logging by default
Change-Id: I4fabfafbf593c9a08e33698adbe488998c610610
2017-02-06 18:23:50 +01:00
Andreas Schneider
560e37ac0a libsecril-client: Use RLOG
The radio log prints use-Rlog/RLOG-RILClient as the prefix, so we should
use RLOG and not ALOG.

Change-Id: I5c217cca9510948871b4157f69361c869dea2a01
2017-02-06 18:21:05 +01:00
Andreas Schneider
0130b88891 libril: Use RLOG
Change-Id: I6b7ed9fc11b03669c3cb4405c25509c6b00401e3
2017-02-06 18:18:49 +01:00
Kyle Repinski
5a2cc4eed5 Fix RIL_CardStatus_v5 Parceling.
The difference between a v5 and v6 CardStatus response is the addition
of ims_subscription_app_index. In previous releases libril added a -1
to the Parcel in its place for transparent handling of GET_SIM_STATUS
everywhere else regardless of v5 or v6 responses, but it was erroneously
removed in change I4e53c6125995064b8ac0cdfc9376ef2cefe69ec8

Change-Id: I078b61d2f6dc28f738e8eb87f51193fa0bd94c7d
2016-10-24 01:44:16 -07:00
Sukanya Rajkhowa
70ecc09feb Add support for cdma dynamic address length.
Get the address,sub address,Bearer with dynamic length in the data parcel,
to avoid the OutOfBoundsException with the MAX macro.

BUG=26856156

Change-Id: I1d7437143c1369d77791136b68e06088acd72937
2016-10-24 01:43:13 -07:00
Sanket Padawe
6daeeef766 Fix build failure which occurs after setting macro RILC_LOG.
Bug: 29214796
Change-Id: I5f74981a59344078f900ecf769cc962b1416d5fd
2016-10-12 13:01:23 -07:00
Sooraj Sasindran
cfef9bd422 RIL: release unsol wakelock
Make sure to release unsol wakelock

BUG=28635279
Change-Id: I4bdf0e7b35df4e6aa077b062ab359c6938ce8292
2016-10-12 13:01:10 -07:00
Ajay Nambi
0af7d1c98c Ril Error codes: Voice related messages
This change adds new error codes for messages
related to voice

Bug: 27038563
Change-Id: I61bcc853f8046e6baf6c8000029f7af0f3f894f0
2016-10-12 13:00:58 -07:00
Ajay Nambi
6965975b2a New error codes for SMS/other messages
This gerrit adds error codes for messages related
to SMS and set_mute, get_mute requests

Bug: 27038563
Change-Id: I4991e4a38c81501c39e91cfd5df90d8288f542ad
2016-10-12 13:00:43 -07:00
twen.chang
7dd377ce80 Add RIL Error code list
BUG: 27589497

Change-Id: I9cc8c12364676c3c56dbee57fdc01cf055460816
2016-10-12 13:00:31 -07:00