From 5310c3096751660413ed0f5f5c46996d9c9da7d0 Mon Sep 17 00:00:00 2001 From: fionaxu Date: Mon, 23 May 2016 16:33:16 -0700 Subject: [PATCH] cold sim clean up - add a new field: provisioningNotificationEnabled from NetworkMisc. set to false if we want to hide "sign in" notification and placed carrier-specific notification instead. it is set on connect, once set, it is carrier-app's responsibility to post new UI to users - rework on the interaction between carrier app and framework - code cleanup - unit test support Bug: 28567303 Change-Id: Ic84db7ffbb920d15344717f104496d3cb82e1a85 --- core/java/android/net/NetworkMisc.java | 12 ++++++++++++ .../java/com/android/server/ConnectivityService.java | 9 ++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/core/java/android/net/NetworkMisc.java b/core/java/android/net/NetworkMisc.java index 5511a248b6..69f50a272a 100644 --- a/core/java/android/net/NetworkMisc.java +++ b/core/java/android/net/NetworkMisc.java @@ -51,6 +51,15 @@ public class NetworkMisc implements Parcelable { */ public boolean acceptUnvalidated; + /** + * Set to avoid surfacing the "Sign in to network" notification. + * if carrier receivers/apps are registered to handle the carrier-specific provisioning + * procedure, a carrier specific provisioning notification will be placed. + * only one notification should be displayed. This field is set based on + * which notification should be used for provisioning. + */ + public boolean provisioningNotificationDisabled; + /** * For mobile networks, this is the subscriber ID (such as IMSI). */ @@ -65,6 +74,7 @@ public class NetworkMisc implements Parcelable { explicitlySelected = nm.explicitlySelected; acceptUnvalidated = nm.acceptUnvalidated; subscriberId = nm.subscriberId; + provisioningNotificationDisabled = nm.provisioningNotificationDisabled; } } @@ -79,6 +89,7 @@ public class NetworkMisc implements Parcelable { out.writeInt(explicitlySelected ? 1 : 0); out.writeInt(acceptUnvalidated ? 1 : 0); out.writeString(subscriberId); + out.writeInt(provisioningNotificationDisabled ? 1 : 0); } public static final Creator CREATOR = new Creator() { @@ -89,6 +100,7 @@ public class NetworkMisc implements Parcelable { networkMisc.explicitlySelected = in.readInt() != 0; networkMisc.acceptUnvalidated = in.readInt() != 0; networkMisc.subscriberId = in.readString(); + networkMisc.provisioningNotificationDisabled = in.readInt() != 0; return networkMisc; } diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 5118b3f2ab..50c1ca09f6 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -2150,9 +2150,11 @@ public class ConnectivityService extends IConnectivityManager.Stub loge("EVENT_PROVISIONING_NOTIFICATION from unknown NetworkMonitor"); break; } - setProvNotificationVisibleIntent(true, netId, NotificationType.SIGN_IN, - nai.networkInfo.getType(), nai.networkInfo.getExtraInfo(), - (PendingIntent)msg.obj, nai.networkMisc.explicitlySelected); + if (!nai.networkMisc.provisioningNotificationDisabled) { + setProvNotificationVisibleIntent(true, netId, NotificationType.SIGN_IN, + nai.networkInfo.getType(), nai.networkInfo.getExtraInfo(), + (PendingIntent)msg.obj, nai.networkMisc.explicitlySelected); + } } break; } @@ -2553,6 +2555,7 @@ public class ConnectivityService extends IConnectivityManager.Stub PendingIntent pendingIntent = PendingIntent.getActivityAsUser( mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT); + setProvNotificationVisibleIntent(true, nai.network.netId, NotificationType.NO_INTERNET, nai.networkInfo.getType(), nai.networkInfo.getExtraInfo(), pendingIntent, true); }