Merge "Added new testNotifyCellLocationForSubscriberByUserSwitched" into sc-dev
diff --git a/src/java/com/android/internal/telephony/dataconnection/DcTracker.java b/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
index cb07185..16fdbb2 100644
--- a/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
+++ b/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
@@ -261,6 +261,9 @@
private static final String INTENT_DATA_STALL_ALARM_EXTRA_TRANSPORT_TYPE =
"data_stall_alarm_extra_transport_type";
+ // Unique id for no data notification on setup data permanently failed.
+ private static final int NO_DATA_NOTIFICATION = 1001;
+
/** The higher index has higher priority. */
private static final DctConstants.State[] DATA_CONNECTION_STATE_PRIORITIES = {
DctConstants.State.IDLE,
@@ -2310,9 +2313,13 @@
protected void startReconnect(long delay, ApnContext apnContext,
@RequestNetworkType int requestType) {
+ apnContext.setState(DctConstants.State.RETRYING);
Message msg = obtainMessage(DctConstants.EVENT_DATA_RECONNECT,
mPhone.getSubId(), requestType, apnContext);
cancelReconnect(apnContext);
+
+ // Wait a bit before trying the next APN, so that
+ // we're not tying up the RIL command channel
sendMessageDelayed(msg, delay);
if (DBG) {
@@ -2925,6 +2932,16 @@
startNetStatPoll();
startDataStallAlarm(DATA_STALL_NOT_SUSPECTED);
+
+ PersistableBundle b = getCarrierConfig();
+ if (apnContext.getApnTypeBitmask() == ApnSetting.TYPE_DEFAULT
+ && b.getBoolean(CarrierConfigManager
+ .KEY_DISPLAY_NO_DATA_NOTIFICATION_ON_PERMANENT_FAILURE_BOOL)) {
+ NotificationManager notificationManager = (NotificationManager)
+ mPhone.getContext().getSystemService(Context.NOTIFICATION_SERVICE);
+ notificationManager.cancel(Integer.toString(mPhone.getSubId()),
+ NO_DATA_NOTIFICATION);
+ }
}
/**
@@ -3095,6 +3112,34 @@
log("cause=" + DataFailCause.toString(cause)
+ ", mark apn as permanent failed. apn = " + apn);
apnContext.markApnPermanentFailed(apn);
+
+ PersistableBundle b = getCarrierConfig();
+ if (apnContext.getApnTypeBitmask() == ApnSetting.TYPE_DEFAULT
+ && b.getBoolean(CarrierConfigManager
+ .KEY_DISPLAY_NO_DATA_NOTIFICATION_ON_PERMANENT_FAILURE_BOOL)) {
+ NotificationManager notificationManager = (NotificationManager)
+ mPhone.getContext().getSystemService(Context.NOTIFICATION_SERVICE);
+
+ CharSequence title = mPhone.getContext().getText(
+ com.android.internal.R.string.RestrictedOnDataTitle);
+ CharSequence details = mPhone.getContext().getText(
+ com.android.internal.R.string.RestrictedStateContent);
+
+ Notification notification = new Notification.Builder(mPhone.getContext(),
+ NotificationChannelController.CHANNEL_ID_MOBILE_DATA_STATUS)
+ .setWhen(System.currentTimeMillis())
+ .setAutoCancel(true)
+ .setSmallIcon(com.android.internal.R.drawable.stat_sys_warning)
+ .setTicker(title)
+ .setColor(mPhone.getContext().getResources().getColor(
+ com.android.internal.R.color.system_notification_accent_color))
+ .setContentTitle(title)
+ .setStyle(new Notification.BigTextStyle().bigText(details))
+ .setContentText(details)
+ .build();
+ notificationManager.notify(Integer.toString(mPhone.getSubId()),
+ NO_DATA_NOTIFICATION, notification);
+ }
}
int newRequestType = calculateNewRetryRequestType(handoverFailureMode, requestType,
@@ -3121,10 +3166,6 @@
+ ". Request type=" + requestTypeToString(requestType) + ", Retry in "
+ delay + "ms.");
}
- apnContext.setState(DctConstants.State.RETRYING);
- // Wait a bit before trying the next APN, so that
- // we're not tying up the RIL command channel
-
startReconnect(delay, apnContext, requestType);
} else {
// If we are not going to retry any APN, set this APN context to failed state.
@@ -5345,6 +5386,9 @@
cleanUpAllConnectionsInternal(false, Phone.REASON_IWLAN_DATA_SERVICE_DIED);
}
}
+ } else {
+ //reset throttling after binding to data service
+ mDataThrottler.reset();
}
mDataServiceBound = bound;
}