Fix ClassCastException

In "Change I95ed2aae: Stop using shared DUN APN when tethering stops",
sha1: 8beff9586f, an assumption is made
that the msg.obj is always an ApnContext, this is not true for CDMA.
Eventually we plan on removing the destinction between GSM and CDMA but
for now we need to handle it handle it.

Bug: 5904734
Change-Id: I86873dc7aeda5234c14a6fe1e4ec7345ee30e957
This commit is contained in:
Wink Saville
2012-01-25 12:42:51 -08:00
parent e575005f7c
commit b2bf3350a2

View File

@@ -328,8 +328,11 @@ public abstract class DataConnection extends StateMachine {
String reason = null;
if (dp.onCompletedMsg != null) {
// Get ApnContext, but only valid on GSM devices this is a string on CDMA devices.
Message msg = dp.onCompletedMsg;
alreadySent = (ApnContext)msg.obj;
if (msg.obj instanceof ApnContext) {
alreadySent = (ApnContext)msg.obj;
}
reason = dp.reason;
if (VDBG) {
log(String.format("msg=%s msg.obj=%s", msg.toString(),