diff options
author | Irfan Sheriff <isheriff@google.com> | 2012-10-02 14:01:28 -0700 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2012-10-02 14:01:28 -0700 |
commit | b8aad91f059527e04abaf8a83ed1ce6b5f09c55d (patch) | |
tree | c364e1f541b54f0ebefd85fea18c5bc1f21cf297 /core | |
parent | 56925d65fde7f1ac8676ada6f91d0e604645c0a5 (diff) | |
download | frameworks_base-b8aad91f059527e04abaf8a83ed1ce6b5f09c55d.zip frameworks_base-b8aad91f059527e04abaf8a83ed1ce6b5f09c55d.tar.gz frameworks_base-b8aad91f059527e04abaf8a83ed1ce6b5f09c55d.tar.bz2 |
Add operator name to network notification
Bug: 7087564
Change-Id: Ibe7a09fc6858dfea5f65092777bbd6ca82177043
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/net/CaptivePortalTracker.java | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/core/java/android/net/CaptivePortalTracker.java b/core/java/android/net/CaptivePortalTracker.java index 9b11094..19ed658 100644 --- a/core/java/android/net/CaptivePortalTracker.java +++ b/core/java/android/net/CaptivePortalTracker.java @@ -31,6 +31,7 @@ import android.os.UserHandle; import android.os.Message; import android.os.RemoteException; import android.provider.Settings; +import android.telephony.TelephonyManager; import android.util.Log; import com.android.internal.util.State; @@ -63,6 +64,7 @@ public class CaptivePortalTracker extends StateMachine { private boolean mNotificationShown = false; private boolean mIsCaptivePortalCheckEnabled = false; private IConnectivityManager mConnService; + private TelephonyManager mTelephonyManager; private Context mContext; private NetworkInfo mNetworkInfo; @@ -84,6 +86,7 @@ public class CaptivePortalTracker extends StateMachine { mContext = context; mConnService = cs; + mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); IntentFilter filter = new IntentFilter(); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); @@ -326,13 +329,25 @@ public class CaptivePortalTracker extends StateMachine { if (visible) { CharSequence title; - if (mNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI) { - title = r.getString(R.string.wifi_available_sign_in, 0); - } else { - title = r.getString(R.string.network_available_sign_in, 0); + CharSequence details; + switch (mNetworkInfo.getType()) { + case ConnectivityManager.TYPE_WIFI: + title = r.getString(R.string.wifi_available_sign_in, 0); + details = r.getString(R.string.network_available_sign_in_detailed, + mNetworkInfo.getExtraInfo()); + break; + case ConnectivityManager.TYPE_MOBILE: + title = r.getString(R.string.network_available_sign_in, 0); + // TODO: Change this to pull from NetworkInfo once a printable + // name has been added to it + details = mTelephonyManager.getNetworkOperatorName(); + break; + default: + title = r.getString(R.string.network_available_sign_in, 0); + details = r.getString(R.string.network_available_sign_in_detailed, + mNetworkInfo.getExtraInfo()); + break; } - CharSequence details = r.getString(R.string.network_available_sign_in_detailed, - mNetworkInfo.getExtraInfo()); Notification notification = new Notification(); notification.when = 0; |