Merge lp:~phablet-team/ofono/ofono-mwi-and-bugs into lp:~phablet-team/ofono/ubuntu

Proposed by Tony Espy
Status: Merged
Merged at revision: 6854
Proposed branch: lp:~phablet-team/ofono/ofono-mwi-and-bugs
Merge into: lp:~phablet-team/ofono/ubuntu
Diff against target: 280 lines (+150/-19)
7 files modified
debian/changelog (+15/-1)
drivers/rilmodem/sim.c (+6/-1)
drivers/rilmodem/voicecall.c (+22/-7)
gril/grilreply.c (+12/-9)
plugins/ril.c (+5/-0)
src/smsutil.c (+1/-1)
unit/test-grilreply.c (+89/-0)
To merge this branch: bzr merge lp:~phablet-team/ofono/ofono-mwi-and-bugs
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ricardo Salveti Pending
Review via email: mp+204587@code.launchpad.net

This proposal supersedes a proposal from 2014-01-30.

Commit message

* gril, rilmodem/sim, unit: fix SIM IO crash (LP: #1268743)
   - cleanup gril_reply_parse_sim_io() to add malformed parcel
     check and fix memory leak.
   - add check for null hex_response in ril_file_io_cb(), as
     the emulator can return such responses.
   - add additional unit tests to cover crash scenarios.
 * ril, src: enable message-waiting-interface
   - register message_waiting atom in ril plugin
   - fix sms_mwi_dcs_decode bug which prevented incoming message
     waiting indications from being set.
 * rilmodem/voicecall: fix call-decline bug (LP: #1260988)
   Send a RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND instead of
   RIL_REQUEST_HANGUP for incoming calls.

Description of the change

This change includes a couple of upstream changes:

1. Fixes a SIM IO crash that only occurs on the emulator (LP: #1268743).

2. Enables the message-waiting interface in the ril device plugin.
   This exposes a new ofono DBus interface ( see doc/message-waiting-api.txt
   for details ) which allows the upper layers to detect when new voicemails
   have landed in the user's voicemailbox. It also exposes the voicemailbox
   phone number so that the dialer app can implenent a standard voicemail
   shortcut ( long press on "1" ).

3. Fixe a bug with certain operators where declining an incoming call leads to
   a fast busy signal instead of voicemail ( LP: #1260988 ).

Tested on mako, maguro, and the emulator using build #121. Please see bug descriptions
for testing instruction, and the specified documentation for the new message-waiting
API.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-01-21 19:01:39 +0000
3+++ debian/changelog 2014-02-03 22:25:52 +0000
4@@ -1,4 +1,5 @@
5 ofono (1.12+bzr6851-0ubuntu2) UNRELEASED; urgency=low
6+
7 [ Tony Espy ]
8 * unit: fix fail-to-build on powerpc
9 The previously released version enabled -Wall,
10@@ -8,8 +9,21 @@
11 systems via an ifdef, which leaves unused functions
12 and data. This change exends the ifdef to cover
13 the unused functions and test data.
14+ * gril, rilmodem/sim, unit: fix SIM IO crash (LP: #1268743)
15+ - cleanup gril_reply_parse_sim_io() to add malformed parcel
16+ check and fix memory leak.
17+ - add check for null hex_response in ril_file_io_cb(), as
18+ the emulator can return such responses.
19+ - add additional unit tests to cover crash scenarios.
20+ * ril, src: enable message-waiting-interface
21+ - register message_waiting atom in ril plugin
22+ - fix sms_mwi_dcs_decode bug which prevented incoming message
23+ waiting indications from being set.
24+ * rilmodem/voicecall: fix call-decline bug (LP: #1260988)
25+ Send a RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND instead of
26+ RIL_REQUEST_HANGUP for incoming calls.
27
28- -- tony espy <espy@canonical.com> Tue, 21 Jan 2014 13:54:46 -0500
29+ -- Tony Espy <espy@canonical.com> Tue, 21 Jan 2014 13:54:46 -0500
30
31 ofono (1.12+bzr6851-0ubuntu1) trusty; urgency=low
32
33
34=== modified file 'drivers/rilmodem/sim.c'
35--- drivers/rilmodem/sim.c 2013-12-09 17:09:20 +0000
36+++ drivers/rilmodem/sim.c 2014-02-03 22:25:52 +0000
37@@ -245,7 +245,12 @@
38 if ((reply = g_ril_reply_parse_sim_io(sd->ril, message))
39 == NULL) {
40 ofono_error("Can't parse SIM IO response from RILD");
41- decode_ril_error(&error, "FAIL");
42+ goto error;
43+ }
44+
45+ if (reply->hex_len == 0) {
46+ ofono_error("Null SIM IO response from RILD");
47+ g_ril_reply_free_sim_io(reply);
48 goto error;
49 }
50
51
52=== modified file 'drivers/rilmodem/voicecall.c'
53--- drivers/rilmodem/voicecall.c 2014-01-02 08:53:29 +0000
54+++ drivers/rilmodem/voicecall.c 2014-02-03 22:25:52 +0000
55@@ -433,13 +433,28 @@
56
57 for (l = vd->calls; l; l = l->next) {
58 call = l->data;
59- /* TODO: Hangup just the active ones once we have call
60- * state tracking (otherwise it can't handle ringing) */
61- g_ril_request_hangup(vd->ril, call->id, &rilp);
62-
63- /* Send request to RIL */
64- ril_template(RIL_REQUEST_HANGUP, vc, generic_cb,
65- AFFECTED_STATES_ALL, &rilp, NULL, NULL);
66+
67+ if (call->status == CALL_STATUS_INCOMING) {
68+ /*
69+ * Need to use this request so that declined
70+ * calls in this state, are properly forwarded
71+ * to voicemail. REQUEST_HANGUP doesn't do the
72+ * right thing for some operators, causing the
73+ * caller to hear a fast busy signal.
74+ */
75+ ril_template(RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND,
76+ vc, generic_cb, AFFECTED_STATES_ALL,
77+ NULL, NULL, NULL);
78+ } else {
79+
80+ /* TODO: Hangup just the active ones once we have call
81+ * state tracking (otherwise it can't handle ringing) */
82+ g_ril_request_hangup(vd->ril, call->id, &rilp);
83+
84+ /* Send request to RIL */
85+ ril_template(RIL_REQUEST_HANGUP, vc, generic_cb,
86+ AFFECTED_STATES_ALL, &rilp, NULL, NULL);
87+ }
88 }
89
90 /* TODO: Deal in case of an error at hungup */
91
92=== modified file 'gril/grilreply.c'
93--- gril/grilreply.c 2013-12-10 09:44:10 +0000
94+++ gril/grilreply.c 2014-02-03 22:25:52 +0000
95@@ -685,23 +685,26 @@
96
97 response = parcel_r_string(&rilp);
98
99+ g_ril_append_print_buf(gril,
100+ "(sw1=0x%.2X,sw2=0x%.2X,%s)",
101+ reply->sw1,
102+ reply->sw2,
103+ response);
104+ g_ril_print_response(gril, message);
105+
106+ if (rilp.malformed)
107+ goto error;
108+
109 if (response != NULL) {
110 reply->hex_response =
111 decode_hex(response, strlen(response),
112 (long *) &reply->hex_len, -1);
113+ g_free(response);
114+
115 if (reply->hex_response == NULL)
116 goto error;
117 }
118
119- g_ril_append_print_buf(gril,
120- "(sw1=0x%.2X,sw2=0x%.2X,%s)",
121- reply->sw1,
122- reply->sw2,
123- response);
124- g_ril_print_response(gril, message);
125-
126- g_free(response);
127-
128 return reply;
129
130 error:
131
132=== modified file 'plugins/ril.c'
133--- plugins/ril.c 2014-01-08 08:32:56 +0000
134+++ plugins/ril.c 2014-02-03 22:25:52 +0000
135@@ -257,6 +257,7 @@
136 struct ril_data *ril = ofono_modem_get_data(modem);
137 struct ofono_gprs *gprs;
138 struct ofono_gprs_context *gc;
139+ struct ofono_message_waiting *mw;
140
141 /* TODO: this function should setup:
142 * - phonebook
143@@ -272,6 +273,10 @@
144 DBG("calling gprs_add_context");
145 ofono_gprs_add_context(gprs, gc);
146 }
147+
148+ mw = ofono_message_waiting_create(modem);
149+ if (mw)
150+ ofono_message_waiting_register(mw);
151 }
152
153 static void ril_post_online(struct ofono_modem *modem)
154
155=== modified file 'src/smsutil.c'
156--- src/smsutil.c 2012-10-01 14:52:32 +0000
157+++ src/smsutil.c 2014-02-03 22:25:52 +0000
158@@ -240,7 +240,7 @@
159 else
160 ch = SMS_CHARSET_7BIT;
161
162- act = dcs & 0x8;
163+ act = (dcs & 0x8) ? TRUE : FALSE;
164
165 t = (enum sms_mwi_type) (dcs & 0x3);
166
167
168=== modified file 'unit/test-grilreply.c'
169--- unit/test-grilreply.c 2014-01-21 19:35:47 +0000
170+++ unit/test-grilreply.c 2014-02-03 22:25:52 +0000
171@@ -1128,6 +1128,74 @@
172 };
173
174 /*
175+ * The following hexadecimal data contains the event data of an valid
176+ * RIL_REQUEST_SIM_IO reply with the following parameters:
177+ *
178+ * {sw1=0x90,sw2=0x00,(null)}
179+ * This is a reply to a select file for EF_ICCID.
180+ */
181+static const guchar reply_sim_io_valid_parcel2[] = {
182+ 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
183+};
184+
185+static const struct ril_msg reply_sim_io_valid_2 = {
186+ .buf = (gchar *) reply_sim_io_valid_parcel2,
187+ .buf_len = sizeof(reply_sim_io_valid_parcel2),
188+ .unsolicited = FALSE,
189+ .req = RIL_REQUEST_SIM_IO,
190+ .serial_no = 0,
191+ .error = 0,
192+};
193+
194+/*
195+ * The following hexadecimal data contains the event data of an invalid
196+ * RIL_REQUEST_SIM_IO reply with the following parameters:
197+ *
198+ * Note - this is invalid because the response includes a non-hex char ('Z').
199+ *
200+ * {sw1=0x90,sw2=0x00,Z000000a2fe2040000000005020000}
201+ * This is a reply to a select file for EF_ICCID.
202+ */
203+static const guchar reply_sim_io_invalid_parcel1[] = {
204+ 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00,
205+ 0x5A, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
206+ 0x30, 0x00, 0x61, 0x00, 0x32, 0x00, 0x66, 0x00, 0x65, 0x00, 0x32, 0x00,
207+ 0x30, 0x00, 0x34, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
208+ 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x35, 0x00,
209+ 0x30, 0x00, 0x32, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
210+ 0x00, 0x00, 0x00, 0x00
211+};
212+
213+static const struct ril_msg reply_sim_io_invalid_1 = {
214+ .buf = (gchar *) reply_sim_io_invalid_parcel1,
215+ .buf_len = sizeof(reply_sim_io_invalid_parcel1),
216+ .unsolicited = FALSE,
217+ .req = RIL_REQUEST_SIM_IO,
218+ .serial_no = 0,
219+ .error = 0,
220+};
221+
222+/*
223+ * The following hexadecimal data contains the event data of an invalid
224+ * RIL_REQUEST_SIM_IO reply with the following parameters:
225+ *
226+ * {sw1=0x90,sw2=0x00,<malformed length>}
227+ * This is a reply to a select file for EF_ICCID.
228+ */
229+static const guchar reply_sim_io_invalid_parcel2[] = {
230+ 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff
231+};
232+
233+static const struct ril_msg reply_sim_io_invalid_2 = {
234+ .buf = (gchar *) reply_sim_io_invalid_parcel2,
235+ .buf_len = sizeof(reply_sim_io_invalid_parcel2),
236+ .unsolicited = FALSE,
237+ .req = RIL_REQUEST_SIM_IO,
238+ .serial_no = 0,
239+ .error = 0,
240+};
241+
242+/*
243 * The following hexadecimal data contains the event data of a valid
244 * RIL_REQUEST_GET_IMSI reply with the following parameters:
245 *
246@@ -1485,6 +1553,12 @@
247 g_ril_reply_free_sim_io(reply);
248 }
249
250+static void test_reply_sim_io_invalid(gconstpointer data)
251+{
252+ struct reply_sim_io *reply = g_ril_reply_parse_sim_io(NULL, data);
253+ g_assert(reply == NULL);
254+}
255+
256 static void test_reply_imsi_valid(gconstpointer data)
257 {
258 gchar *reply = g_ril_reply_parse_imsi(NULL, data);
259@@ -1790,6 +1864,21 @@
260 test_reply_sim_io_valid);
261
262 g_test_add_data_func("/testgrilreply/sim: "
263+ "valid SIM_IO Test 2",
264+ &reply_sim_io_valid_2,
265+ test_reply_sim_io_valid);
266+
267+ g_test_add_data_func("/testgrilreply/sim: "
268+ "invalid SIM_IO Test 1",
269+ &reply_sim_io_invalid_1,
270+ test_reply_sim_io_invalid);
271+
272+ g_test_add_data_func("/testgrilreply/sim: "
273+ "invalid SIM_IO Test 2",
274+ &reply_sim_io_invalid_2,
275+ test_reply_sim_io_invalid);
276+
277+ g_test_add_data_func("/testgrilreply/sim: "
278 "valid GET_IMSI Test 1",
279 &reply_imsi_valid_1,
280 test_reply_imsi_valid);

Subscribers

People subscribed via source and target branches

to all changes: