diff options
author | Robert Greenwalt <rgreenwalt@google.com> | 2010-11-09 10:24:40 -0800 |
---|---|---|
committer | Robert Greenwalt <rgreenwalt@google.com> | 2010-11-09 16:28:51 -0800 |
commit | 8e7e0a9fd5c377294bfe2e09fca9b7551871f3c2 (patch) | |
tree | 09b81345a86c17ff1e15c8a8a014ad8d5e054504 /services | |
parent | 2cf17ed7d87f8e0fc77de5e22c152018e7553959 (diff) | |
download | frameworks_base-8e7e0a9fd5c377294bfe2e09fca9b7551871f3c2.zip frameworks_base-8e7e0a9fd5c377294bfe2e09fca9b7551871f3c2.tar.gz frameworks_base-8e7e0a9fd5c377294bfe2e09fca9b7551871f3c2.tar.bz2 |
Fix data state change callbacks
Initial state should be unknown or we miss the first connected change.
Don't send a disconnected msg when changing network types.
Filter out redundent disconnects.
Add some logging.
bug:3060742
Change-Id: Idc797c1276b7417337a91ed60b12b1bf392d57c0
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/TelephonyRegistry.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java index a7a0c68..689b1c6 100644 --- a/services/java/com/android/server/TelephonyRegistry.java +++ b/services/java/com/android/server/TelephonyRegistry.java @@ -85,7 +85,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { private int mDataActivity = TelephonyManager.DATA_ACTIVITY_NONE; - private int mDataConnectionState = TelephonyManager.DATA_CONNECTED; + private int mDataConnectionState = TelephonyManager.DATA_UNKNOWN; private boolean mDataConnectionPossible = false; @@ -401,13 +401,14 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } } } else { - mConnectedApns.remove(apnType); - if (mConnectedApns.isEmpty()) { - mDataConnectionState = state; - modified = true; - } else { - // leave mDataConnectionState as is and - // send out the new status for the APN in question. + if (mConnectedApns.remove(apnType)) { + if (mConnectedApns.isEmpty()) { + mDataConnectionState = state; + modified = true; + } else { + // leave mDataConnectionState as is and + // send out the new status for the APN in question. + } } } mDataConnectionPossible = isDataConnectivityPossible; @@ -416,9 +417,11 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { mDataConnectionLinkCapabilities = linkCapabilities; if (mDataConnectionNetworkType != networkType) { mDataConnectionNetworkType = networkType; + // need to tell registered listeners about the new network type modified = true; } if (modified) { + Slog.d(TAG, "onDataConnectionStateChanged(" + state + ", " + networkType + ")"); for (Record r : mRecords) { if ((r.events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) { try { |