Merge "Handle hiding timer reset on every move."
diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java
index 40f72b2..de7abd7 100644
--- a/core/java/android/net/MobileDataStateTracker.java
+++ b/core/java/android/net/MobileDataStateTracker.java
@@ -46,6 +46,7 @@
private static final String TAG = "MobileDataStateTracker";
private static final boolean DBG = true;
+ private static final boolean VDBG = false;
private Phone.DataState mMobileDataState;
private ITelephony mPhoneService;
@@ -156,10 +157,15 @@
private class MobileDataStateReceiver extends BroadcastReceiver {
IConnectivityManager mConnectivityManager;
+ @Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(TelephonyIntents.
ACTION_ANY_DATA_CONNECTION_STATE_CHANGED)) {
String apnType = intent.getStringExtra(Phone.DATA_APN_TYPE_KEY);
+ if (VDBG) Log.d(TAG,
+ String.format("Broadcast received: ACTION_ANY_DATA_CONNECTION_STATE_CHANGED"
+ + "mApnType=%s %s received apnType=%s",
+ mApnType, TextUtils.equals(apnType, mApnType) ? "==" : "!=", apnType));
if (!TextUtils.equals(apnType, mApnType)) {
return;
}
@@ -171,8 +177,8 @@
mNetworkInfo.setIsAvailable(!intent.getBooleanExtra(Phone.NETWORK_UNAVAILABLE_KEY,
false));
- if (DBG) Log.d(TAG, mApnType + " Received state= " + state + ", old= " +
- mMobileDataState + ", reason= " +
+ if (DBG) Log.d(TAG, mApnType + " Received state=" + state + ", old=" +
+ mMobileDataState + ", reason=" +
(reason == null ? "(unspecified)" : reason));
if (mMobileDataState != state) {
@@ -249,6 +255,8 @@
equals(TelephonyIntents.ACTION_DATA_CONNECTION_FAILED)) {
String apnType = intent.getStringExtra(Phone.DATA_APN_TYPE_KEY);
if (!TextUtils.equals(apnType, mApnType)) {
+ if (DBG) Log.d(TAG, String.format("Broadcast received: ACTION_ANY_DATA_CONNECTION_FAILED ignore, mApnType=%s != received apnType=%s",
+ mApnType, apnType));
return;
}
String reason = intent.getStringExtra(Phone.FAILURE_REASON_KEY);
@@ -256,6 +264,8 @@
if (DBG) Log.d(TAG, mApnType + "Received " + intent.getAction() +
" broadcast" + reason == null ? "" : "(" + reason + ")");
setDetailedState(DetailedState.FAILED, reason, apnName);
+ } else {
+ if (DBG) Log.d(TAG, "Broadcast received: ignore " + intent.getAction());
}
}
}
diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java
index 689b1c6..e881523 100644
--- a/services/java/com/android/server/TelephonyRegistry.java
+++ b/services/java/com/android/server/TelephonyRegistry.java
@@ -388,8 +388,8 @@
return;
}
Slog.i(TAG, "notifyDataConnection: state=" + state + " isDataConnectivityPossible="
- + isDataConnectivityPossible + " reason=" + reason
- + " apn=" + apn + " networkType=" + networkType);
+ + isDataConnectivityPossible + " reason='" + reason
+ + "' apn='" + apn + "' apnType=" + apnType + " networkType=" + networkType);
synchronized (mRecords) {
boolean modified = false;
if (state == TelephonyManager.DATA_CONNECTED) {
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
index 8f3fa1b..cc01bc5 100644
--- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -687,7 +687,7 @@
public boolean isApnTypeEnabled(String apnType) {
if (apnType == null) {
- apnType = getActiveApnString();
+ apnType = getActiveApnType();
}
return isApnIdEnabled(apnTypeToId(apnType));
}
diff --git a/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java b/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java
index 52cbd7c..83db3d1 100644
--- a/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java
+++ b/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java
@@ -115,7 +115,7 @@
mRegistry.notifyDataConnection(
convertDataState(state),
sender.isDataConnectivityPossible(), reason,
- sender.getActiveApn(),
+ sender.getActiveApnHost(),
apnType,
linkProperties,
linkCapabilities,
diff --git a/telephony/java/com/android/internal/telephony/Phone.java b/telephony/java/com/android/internal/telephony/Phone.java
index 2957c7e..69b7de6 100644
--- a/telephony/java/com/android/internal/telephony/Phone.java
+++ b/telephony/java/com/android/internal/telephony/Phone.java
@@ -309,16 +309,17 @@
/**
* Returns an array of string identifiers for the APN types serviced by the
- * currently active or last connected APN.
- * @return The string array.
+ * currently active.
+ * @return The string array will always return at least one entry, Phone.APN_TYPE_DEFAULT.
+ * TODO: Revisit if we always should return at least one entry.
*/
String[] getActiveApnTypes();
/**
- * Returns a string identifier for currently active or last connected APN.
- * @return The string name.
+ * Returns string for the active APN host.
+ * @return type as a string or null if none.
*/
- String getActiveApn();
+ String getActiveApnHost();
/**
* Return the LinkProperties for the named apn or null if not available
diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java
index 83080ee..fe4fdb3 100644
--- a/telephony/java/com/android/internal/telephony/PhoneBase.java
+++ b/telephony/java/com/android/internal/telephony/PhoneBase.java
@@ -746,8 +746,10 @@
}
public void notifyDataConnection() {
- String apn = getActiveApn();
- mNotifier.notifyDataConnection(this, null, apn, getDataConnectionState(apn));
+ String types[] = getActiveApnTypes();
+ for (String apnType : types) {
+ mNotifier.notifyDataConnection(this, null, apnType, getDataConnectionState(apnType));
+ }
}
public void notifyOtaspChanged(int otaspMode) {
@@ -947,6 +949,10 @@
return mDataConnection.getActiveApnTypes();
}
+ public String getActiveApnHost() {
+ return mDataConnection.getActiveApnString();
+ }
+
public LinkProperties getLinkProperties(String apnType) {
return mDataConnection.getLinkProperties(apnType);
}
@@ -955,10 +961,6 @@
return mDataConnection.getLinkCapabilities(apnType);
}
- public String getActiveApn() {
- return mDataConnection.getActiveApnString();
- }
-
public int enableApnType(String type) {
return mDataConnection.enableApnType(type);
}
diff --git a/telephony/java/com/android/internal/telephony/PhoneProxy.java b/telephony/java/com/android/internal/telephony/PhoneProxy.java
index 02fdf28..2e79762 100644
--- a/telephony/java/com/android/internal/telephony/PhoneProxy.java
+++ b/telephony/java/com/android/internal/telephony/PhoneProxy.java
@@ -209,6 +209,10 @@
return mActivePhone.getActiveApnTypes();
}
+ public String getActiveApnHost() {
+ return mActivePhone.getActiveApnHost();
+ }
+
public LinkProperties getLinkProperties(String apnType) {
return mActivePhone.getLinkProperties(apnType);
}
@@ -217,10 +221,6 @@
return mActivePhone.getLinkCapabilities(apnType);
}
- public String getActiveApn() {
- return mActivePhone.getActiveApn();
- }
-
public SignalStrength getSignalStrength() {
return mActivePhone.getSignalStrength();
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
index 024ef33..f7664ca5 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
@@ -89,6 +89,8 @@
Phone.APN_TYPE_MMS,
Phone.APN_TYPE_HIPRI };
+ private static final int mDefaultApnId = DataConnectionTracker.APN_DEFAULT_ID;
+
/* Constructor */
CdmaDataConnectionTracker(CDMAPhone p) {
@@ -324,13 +326,17 @@
/** TODO: We probably want the connection being setup to a parameter passed around */
mPendingDataConnection = conn;
String[] types;
+ int apnId;
if (mRequestedApnType.equals(Phone.APN_TYPE_DUN)) {
types = new String[1];
types[0] = Phone.APN_TYPE_DUN;
+ apnId = DataConnectionTracker.APN_DUN_ID;
} else {
types = mDefaultApnTypes;
+ apnId = mDefaultApnId;
}
- mActiveApn = new ApnSetting(0, "", "", "", "", "", "", "", "", "", "", 0, types);
+ mActiveApn = new ApnSetting(apnId, "", "", "", "", "", "", "", "", "", "", 0, types);
+ if (DBG) log("setupData: mActiveApn=" + mActiveApn);
Message msg = obtainMessage();
msg.what = EVENT_DATA_SETUP_COMPLETE;