diff options
9 files changed, 44 insertions, 11 deletions
diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java index c34cb2f..eb7117b 100644 --- a/core/java/android/net/MobileDataStateTracker.java +++ b/core/java/android/net/MobileDataStateTracker.java @@ -240,6 +240,7 @@ public class MobileDataStateTracker extends NetworkStateTracker { if (mInterfaceName == null) { Log.d(TAG, "CONNECTED event did not supply interface name."); } + mDefaultGatewayAddr = intent.getIntExtra(Phone.DATA_GATEWAY_KEY, 0); setDetailedState(DetailedState.CONNECTED, reason, apnName); break; } diff --git a/core/java/android/net/NetworkUtils.java b/core/java/android/net/NetworkUtils.java index a3ae01b..e4f3d5c 100644 --- a/core/java/android/net/NetworkUtils.java +++ b/core/java/android/net/NetworkUtils.java @@ -128,4 +128,19 @@ public class NetworkUtils { | (addrBytes[0] & 0xff); return addr; } + + public static int v4StringToInt(String str) { + int result = 0; + String[] array = str.split("\\."); + if (array.length != 4) return 0; + try { + result = Integer.parseInt(array[3]); + result = (result << 8) + Integer.parseInt(array[2]); + result = (result << 8) + Integer.parseInt(array[1]); + result = (result << 8) + Integer.parseInt(array[0]); + } catch (NumberFormatException e) { + return 0; + } + return result; + } } diff --git a/core/java/android/view/accessibility/AccessibilityEvent.java b/core/java/android/view/accessibility/AccessibilityEvent.java index c22f991..fc61700 100644 --- a/core/java/android/view/accessibility/AccessibilityEvent.java +++ b/core/java/android/view/accessibility/AccessibilityEvent.java @@ -622,6 +622,7 @@ public final class AccessibilityEvent implements Parcelable { mPackageName = null; mContentDescription = null; mBeforeText = null; + mParcelableData = null; mText.clear(); } diff --git a/libs/utils/ZipFileRO.cpp b/libs/utils/ZipFileRO.cpp index a4c3500..604f558 100644 --- a/libs/utils/ZipFileRO.cpp +++ b/libs/utils/ZipFileRO.cpp @@ -636,7 +636,7 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, void* buffer) const memcpy(buffer, ptr, uncompLen); } else { if (!inflateBuffer(buffer, ptr, uncompLen, compLen)) - goto bail; + goto unmap; } if (compLen > kSequentialMin) @@ -644,6 +644,8 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, void* buffer) const result = true; +unmap: + file->release(); bail: return result; } @@ -667,7 +669,7 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, int fd) const getEntryInfo(entry, &method, &uncompLen, &compLen, &offset, NULL, NULL); - const FileMap* file = createEntryFileMap(entry); + FileMap* file = createEntryFileMap(entry); if (file == NULL) { goto bail; } @@ -678,21 +680,23 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, int fd) const ssize_t actual = write(fd, ptr, uncompLen); if (actual < 0) { LOGE("Write failed: %s\n", strerror(errno)); - goto bail; + goto unmap; } else if ((size_t) actual != uncompLen) { LOGE("Partial write during uncompress (%zd of %zd)\n", (size_t)actual, (size_t)uncompLen); - goto bail; + goto unmap; } else { LOGI("+++ successful write\n"); } } else { if (!inflateBuffer(fd, ptr, uncompLen, compLen)) - goto bail; + goto unmap; } result = true; +unmap: + file->release(); bail: return result; } diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java index 664dfa5..7e23422 100644 --- a/services/java/com/android/server/TelephonyRegistry.java +++ b/services/java/com/android/server/TelephonyRegistry.java @@ -19,6 +19,7 @@ package com.android.server; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; +import android.net.NetworkUtils; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; @@ -348,7 +349,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } public void notifyDataConnection(int state, boolean isDataConnectivityPossible, - String reason, String apn, String[] apnTypes, String interfaceName, int networkType) { + String reason, String apn, String[] apnTypes, String interfaceName, int networkType, + String gateway) { if (!checkNotifyPermission("notifyDataConnection()" )) { return; } @@ -372,7 +374,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } } broadcastDataConnectionStateChanged(state, isDataConnectivityPossible, reason, apn, - apnTypes, interfaceName); + apnTypes, interfaceName, gateway); } public void notifyDataConnectionFailed(String reason) { @@ -535,7 +537,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { private void broadcastDataConnectionStateChanged(int state, boolean isDataConnectivityPossible, - String reason, String apn, String[] apnTypes, String interfaceName) { + String reason, String apn, String[] apnTypes, String interfaceName, String gateway) { // Note: not reporting to the battery stats service here, because the // status bar takes care of that after taking into account all of the // required info. @@ -558,6 +560,12 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } intent.putExtra(Phone.DATA_APN_TYPES_KEY, types); intent.putExtra(Phone.DATA_IFACE_NAME_KEY, interfaceName); + int gatewayAddr = 0; + if (gateway != null) { + gatewayAddr = NetworkUtils.v4StringToInt(gateway); + } + intent.putExtra(Phone.DATA_GATEWAY_KEY, gatewayAddr); + mContext.sendStickyBroadcast(intent); } diff --git a/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java b/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java index 4da4b6a..057ba0a 100644 --- a/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java +++ b/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java @@ -102,7 +102,8 @@ public class DefaultPhoneNotifier implements PhoneNotifier { sender.getActiveApnTypes(), sender.getInterfaceName(null), ((telephony!=null) ? telephony.getNetworkType() : - TelephonyManager.NETWORK_TYPE_UNKNOWN)); + TelephonyManager.NETWORK_TYPE_UNKNOWN), + sender.getGateway(null)); } catch (RemoteException ex) { // system process is dead } diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl index 5bf8e58..87e4b52 100644 --- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl @@ -32,7 +32,8 @@ interface ITelephonyRegistry { void notifyCallForwardingChanged(boolean cfi); void notifyDataActivity(int state); void notifyDataConnection(int state, boolean isDataConnectivityPossible, - String reason, String apn, in String[] apnTypes, String interfaceName, int networkType); + String reason, String apn, in String[] apnTypes, String interfaceName, int networkType, + String gateway); void notifyDataConnectionFailed(String reason); void notifyCellLocation(in Bundle cellLocation); } diff --git a/telephony/java/com/android/internal/telephony/Phone.java b/telephony/java/com/android/internal/telephony/Phone.java index 33f7c9d..9afade3 100644 --- a/telephony/java/com/android/internal/telephony/Phone.java +++ b/telephony/java/com/android/internal/telephony/Phone.java @@ -103,6 +103,7 @@ public interface Phone { static final String DATA_APN_KEY = "apn"; static final String DATA_IFACE_NAME_KEY = "iface"; + static final String DATA_GATEWAY_KEY = "gateway"; static final String NETWORK_UNAVAILABLE_KEY = "networkUnvailable"; static final String PHONE_IN_ECM_STATE = "phoneinECMState"; diff --git a/telephony/java/com/android/internal/telephony/SipPhoneNotifier.java b/telephony/java/com/android/internal/telephony/SipPhoneNotifier.java index 81e151e..4092c69 100644 --- a/telephony/java/com/android/internal/telephony/SipPhoneNotifier.java +++ b/telephony/java/com/android/internal/telephony/SipPhoneNotifier.java @@ -104,7 +104,8 @@ public class SipPhoneNotifier implements PhoneNotifier { sender.getActiveApnTypes(), sender.getInterfaceName(null), ((telephony!=null) ? telephony.getNetworkType() : - TelephonyManager.NETWORK_TYPE_UNKNOWN)); + TelephonyManager.NETWORK_TYPE_UNKNOWN), + sender.getGateway(null)); } catch (RemoteException ex) { // system process is dead } |