Do not show datadisconnectRoaming notification if data is disabled.
Bug: 62447655
Test: manual
Change-Id: Iff5b06f34e9057d5470b63f720eed546c0bc99d1
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index 31bca92..61bf860 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -16,8 +16,6 @@
package com.android.phone;
-import static android.Manifest.permission.READ_PHONE_STATE;
-
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
@@ -52,6 +50,7 @@
import android.util.Log;
import android.widget.Toast;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.TelephonyCapabilities;
@@ -62,6 +61,8 @@
import java.util.List;
import java.util.Set;
+import static android.Manifest.permission.READ_PHONE_STATE;
+
/**
* NotificationManager-related utility code for the Phone app.
*
@@ -543,7 +544,8 @@
* appears when you lose data connectivity because you're roaming and
* you have the "data roaming" feature turned off.
*/
- /* package */ void showDataDisconnectedRoaming() {
+ @VisibleForTesting
+ public void showDataDisconnectedRoaming() {
if (DBG) log("showDataDisconnectedRoaming()...");
// "Mobile network settings" screen / dialog
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index 2ed5139..1d61c8e 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -680,10 +680,12 @@
// if (a) you have the "data roaming" feature turned off, and
// (b) you just lost data connectivity because you're roaming.
// (c) if we haven't shown the notification for this disconnection earlier.
+ // (d) if data was enabled for the sim
if (!mDataDisconnectedDueToRoaming
&& PhoneConstants.DataState.DISCONNECTED.name().equals(state)
&& Phone.REASON_ROAMING_ON.equals(reason)
- && !phone.getDataRoamingEnabled()) {
+ && !phone.getDataRoamingEnabled()
+ && phone.getDataEnabled()) {
// Notify the user that data call is disconnected due to roaming. Note that
// calling this multiple times will not cause multiple notifications.
mHandler.sendEmptyMessage(EVENT_DATA_ROAMING_DISCONNECTED);