summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorWink Saville <wink@google.com>2013-07-20 20:31:59 -0700
committerWink Saville <wink@google.com>2013-08-05 14:15:54 -0700
commit42d4f08db2c15e1829c1fc5d1942cf029ab0895b (patch)
treee7b2fd38393e14bfb49d65e4323e8fcba9dab6eb /core/java
parent607b414d0444067e166fa54d8ea37563f2715ea3 (diff)
downloadframeworks_base-42d4f08db2c15e1829c1fc5d1942cf029ab0895b.zip
frameworks_base-42d4f08db2c15e1829c1fc5d1942cf029ab0895b.tar.gz
frameworks_base-42d4f08db2c15e1829c1fc5d1942cf029ab0895b.tar.bz2
Have CaptivePortalTracker use gservices updateable provisioning urls.
After detecting there is a captive portal the url used in the notification for mobile networks should be updateable via gservices. These urls will be the same as used by CheckMp and is needed for carriers that have specific provisioning urls such as AT&T and Verizon. Bug: 9622647 Change-Id: Idcf4dabc72ece1dbbe1d5e5a21e550dd06fe16c7
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/net/CaptivePortalTracker.java22
-rw-r--r--core/java/android/net/ConnectivityManager.java14
-rw-r--r--core/java/android/net/IConnectivityManager.aidl2
3 files changed, 35 insertions, 3 deletions
diff --git a/core/java/android/net/CaptivePortalTracker.java b/core/java/android/net/CaptivePortalTracker.java
index 21995c0..269bd7c 100644
--- a/core/java/android/net/CaptivePortalTracker.java
+++ b/core/java/android/net/CaptivePortalTracker.java
@@ -34,6 +34,7 @@ import android.os.Message;
import android.os.RemoteException;
import android.provider.Settings;
import android.telephony.TelephonyManager;
+import android.text.TextUtils;
import com.android.internal.util.State;
import com.android.internal.util.StateMachine;
@@ -52,7 +53,7 @@ import com.android.internal.R;
* @hide
*/
public class CaptivePortalTracker extends StateMachine {
- private static final boolean DBG = false;
+ private static final boolean DBG = true;
private static final String TAG = "CaptivePortalTracker";
private static final String DEFAULT_SERVER = "clients3.google.com";
@@ -364,6 +365,7 @@ public class CaptivePortalTracker extends StateMachine {
private void setNotificationVisible(boolean visible) {
// if it should be hidden and it is already hidden, then noop
if (!visible && !mNotificationShown) {
+ if (DBG) log("setNotivicationVisible: false and not shown, so noop");
return;
}
@@ -375,12 +377,14 @@ public class CaptivePortalTracker extends StateMachine {
CharSequence title;
CharSequence details;
int icon;
+ String url = null;
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());
icon = R.drawable.stat_notify_wifi_in_range;
+ url = mUrl;
break;
case ConnectivityManager.TYPE_MOBILE:
title = r.getString(R.string.network_available_sign_in, 0);
@@ -388,12 +392,24 @@ public class CaptivePortalTracker extends StateMachine {
// name has been added to it
details = mTelephonyManager.getNetworkOperatorName();
icon = R.drawable.stat_notify_rssi_in_range;
+ try {
+ url = mConnService.getMobileProvisioningUrl();
+ if (TextUtils.isEmpty(url)) {
+ url = mConnService.getMobileRedirectedProvisioningUrl();
+ }
+ } catch(RemoteException e) {
+ e.printStackTrace();
+ }
+ if (TextUtils.isEmpty(url)) {
+ url = mUrl;
+ }
break;
default:
title = r.getString(R.string.network_available_sign_in, 0);
details = r.getString(R.string.network_available_sign_in_detailed,
mNetworkInfo.getExtraInfo());
icon = R.drawable.stat_notify_rssi_in_range;
+ url = mUrl;
break;
}
@@ -401,15 +417,17 @@ public class CaptivePortalTracker extends StateMachine {
notification.when = 0;
notification.icon = icon;
notification.flags = Notification.FLAG_AUTO_CANCEL;
- Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(mUrl));
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT |
Intent.FLAG_ACTIVITY_NEW_TASK);
notification.contentIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
notification.tickerText = title;
notification.setLatestEventInfo(mContext, title, details, notification.contentIntent);
+ if (DBG) log("setNotivicationVisible: make visible");
notificationManager.notify(NOTIFICATION_ID, 1, notification);
} else {
+ if (DBG) log("setNotivicationVisible: cancel notification");
notificationManager.cancel(NOTIFICATION_ID, 1);
}
mNotificationShown = visible;
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index 697bde9..b6df2fa 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -1360,7 +1360,7 @@ public class ConnectivityManager {
}
/**
- * Get the carrier provisioning url.
+ * Get the mobile provisioning url.
* {@hide}
*/
public String getMobileProvisioningUrl() {
@@ -1370,4 +1370,16 @@ public class ConnectivityManager {
}
return null;
}
+
+ /**
+ * Get the mobile redirected provisioning url.
+ * {@hide}
+ */
+ public String getMobileRedirectedProvisioningUrl() {
+ try {
+ return mService.getMobileRedirectedProvisioningUrl();
+ } catch (RemoteException e) {
+ }
+ return null;
+ }
}
diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl
index 4600c1a..5daf39c 100644
--- a/core/java/android/net/IConnectivityManager.aidl
+++ b/core/java/android/net/IConnectivityManager.aidl
@@ -136,4 +136,6 @@ interface IConnectivityManager
int checkMobileProvisioning(boolean sendNotification, int suggestedTimeOutMs, in ResultReceiver resultReceiver);
String getMobileProvisioningUrl();
+
+ String getMobileRedirectedProvisioningUrl();
}