3131import android .os .Message ;
3232import android .os .RemoteException ;
3333import android .provider .Settings ;
34+ import android .telephony .TelephonyManager ;
3435import android .util .Log ;
3536
3637import com .android .internal .util .State ;
@@ -63,6 +64,7 @@ public class CaptivePortalTracker extends StateMachine {
6364 private boolean mNotificationShown = false ;
6465 private boolean mIsCaptivePortalCheckEnabled = false ;
6566 private IConnectivityManager mConnService ;
67+ private TelephonyManager mTelephonyManager ;
6668 private Context mContext ;
6769 private NetworkInfo mNetworkInfo ;
6870
@@ -84,6 +86,7 @@ private CaptivePortalTracker(Context context, IConnectivityManager cs) {
8486
8587 mContext = context ;
8688 mConnService = cs ;
89+ mTelephonyManager = (TelephonyManager ) context .getSystemService (Context .TELEPHONY_SERVICE );
8790
8891 IntentFilter filter = new IntentFilter ();
8992 filter .addAction (ConnectivityManager .CONNECTIVITY_ACTION );
@@ -326,13 +329,25 @@ private void setNotificationVisible(boolean visible) {
326329
327330 if (visible ) {
328331 CharSequence title ;
329- if (mNetworkInfo .getType () == ConnectivityManager .TYPE_WIFI ) {
330- title = r .getString (R .string .wifi_available_sign_in , 0 );
331- } else {
332- title = r .getString (R .string .network_available_sign_in , 0 );
332+ CharSequence details ;
333+ switch (mNetworkInfo .getType ()) {
334+ case ConnectivityManager .TYPE_WIFI :
335+ title = r .getString (R .string .wifi_available_sign_in , 0 );
336+ details = r .getString (R .string .network_available_sign_in_detailed ,
337+ mNetworkInfo .getExtraInfo ());
338+ break ;
339+ case ConnectivityManager .TYPE_MOBILE :
340+ title = r .getString (R .string .network_available_sign_in , 0 );
341+ // TODO: Change this to pull from NetworkInfo once a printable
342+ // name has been added to it
343+ details = mTelephonyManager .getNetworkOperatorName ();
344+ break ;
345+ default :
346+ title = r .getString (R .string .network_available_sign_in , 0 );
347+ details = r .getString (R .string .network_available_sign_in_detailed ,
348+ mNetworkInfo .getExtraInfo ());
349+ break ;
333350 }
334- CharSequence details = r .getString (R .string .network_available_sign_in_detailed ,
335- mNetworkInfo .getExtraInfo ());
336351
337352 Notification notification = new Notification ();
338353 notification .when = 0 ;
0 commit comments