am d9b8d180: Merge "Launch browser directly when user selects "Mobile Plan"." into lmp-dev

* commit 'd9b8d1803aac44f382e330ea62bc936e049a1aed':
  Launch browser directly when user selects "Mobile Plan".
This commit is contained in:
Paul Jensen
2014-10-22 17:26:58 +00:00
committed by Android Git Automerger

View File

@@ -21,6 +21,7 @@ import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.admin.DevicePolicyManager; import android.app.admin.DevicePolicyManager;
import android.content.ActivityNotFoundException;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
@@ -29,6 +30,7 @@ import android.content.pm.PackageManager;
import android.content.res.Resources; import android.content.res.Resources;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.net.Uri;
import android.nfc.NfcAdapter; import android.nfc.NfcAdapter;
import android.nfc.NfcManager; import android.nfc.NfcManager;
import android.os.Bundle; import android.os.Bundle;
@@ -118,8 +120,6 @@ public class WirelessSettings extends SettingsPreferenceFragment
} }
private String mManageMobilePlanMessage; private String mManageMobilePlanMessage;
private static final String CONNECTED_TO_PROVISIONING_NETWORK_ACTION
= "com.android.server.connectivityservice.CONNECTED_TO_PROVISIONING_NETWORK_ACTION";
public void onManageMobilePlanClick() { public void onManageMobilePlanClick() {
log("onManageMobilePlanClick:"); log("onManageMobilePlanClick:");
mManageMobilePlanMessage = null; mManageMobilePlanMessage = null;
@@ -143,11 +143,16 @@ public class WirelessSettings extends SettingsPreferenceFragment
// Get provisioning URL // Get provisioning URL
String url = mCm.getMobileProvisioningUrl(); String url = mCm.getMobileProvisioningUrl();
if (!TextUtils.isEmpty(url)) { if (!TextUtils.isEmpty(url)) {
Intent intent = new Intent(CONNECTED_TO_PROVISIONING_NETWORK_ACTION); Intent intent = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN,
intent.putExtra("EXTRA_URL", url); Intent.CATEGORY_APP_BROWSER);
Context context = getActivity().getBaseContext(); intent.setData(Uri.parse(url));
context.sendBroadcast(intent); intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT |
mManageMobilePlanMessage = null; Intent.FLAG_ACTIVITY_NEW_TASK);
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
Log.w(TAG, "onManageMobilePlanClick: startActivity failed" + e);
}
} else { } else {
// No provisioning URL // No provisioning URL
String operatorName = mTm.getSimOperatorName(); String operatorName = mTm.getSimOperatorName();