Merge "Remove mobile provision design out from connectivity service"
This commit is contained in:
@@ -3131,39 +3131,6 @@ public class ConnectivityManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check mobile provisioning.
|
|
||||||
*
|
|
||||||
* @param suggestedTimeOutMs, timeout in milliseconds
|
|
||||||
*
|
|
||||||
* @return time out that will be used, maybe less that suggestedTimeOutMs
|
|
||||||
* -1 if an error.
|
|
||||||
*
|
|
||||||
* {@hide}
|
|
||||||
*/
|
|
||||||
public int checkMobileProvisioning(int suggestedTimeOutMs) {
|
|
||||||
int timeOutMs = -1;
|
|
||||||
try {
|
|
||||||
timeOutMs = mService.checkMobileProvisioning(suggestedTimeOutMs);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
throw e.rethrowFromSystemServer();
|
|
||||||
}
|
|
||||||
return timeOutMs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mobile provisioning url.
|
|
||||||
* {@hide}
|
|
||||||
*/
|
|
||||||
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
|
|
||||||
public String getMobileProvisioningUrl() {
|
|
||||||
try {
|
|
||||||
return mService.getMobileProvisioningUrl();
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
throw e.rethrowFromSystemServer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set sign in error notification to visible or invisible
|
* Set sign in error notification to visible or invisible
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -147,10 +147,6 @@ interface IConnectivityManager
|
|||||||
boolean isVpnLockdownEnabled(int userId);
|
boolean isVpnLockdownEnabled(int userId);
|
||||||
List<String> getVpnLockdownWhitelist(int userId);
|
List<String> getVpnLockdownWhitelist(int userId);
|
||||||
|
|
||||||
int checkMobileProvisioning(int suggestedTimeOutMs);
|
|
||||||
|
|
||||||
String getMobileProvisioningUrl();
|
|
||||||
|
|
||||||
void setProvisioningNotificationVisible(boolean visible, int networkType, in String action);
|
void setProvisioningNotificationVisible(boolean visible, int networkType, in String action);
|
||||||
|
|
||||||
void setAirplaneMode(boolean enable);
|
void setAirplaneMode(boolean enable);
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
import android.net.CaptivePortal;
|
import android.net.CaptivePortal;
|
||||||
import android.net.CaptivePortalData;
|
import android.net.CaptivePortalData;
|
||||||
@@ -172,7 +171,6 @@ import android.util.Log;
|
|||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.util.SparseIntArray;
|
import android.util.SparseIntArray;
|
||||||
import android.util.Xml;
|
|
||||||
|
|
||||||
import com.android.connectivity.aidl.INetworkAgent;
|
import com.android.connectivity.aidl.INetworkAgent;
|
||||||
import com.android.internal.R;
|
import com.android.internal.R;
|
||||||
@@ -189,7 +187,6 @@ import com.android.internal.util.AsyncChannel;
|
|||||||
import com.android.internal.util.IndentingPrintWriter;
|
import com.android.internal.util.IndentingPrintWriter;
|
||||||
import com.android.internal.util.LocationPermissionChecker;
|
import com.android.internal.util.LocationPermissionChecker;
|
||||||
import com.android.internal.util.MessageUtils;
|
import com.android.internal.util.MessageUtils;
|
||||||
import com.android.internal.util.XmlUtils;
|
|
||||||
import com.android.modules.utils.BasicShellCommandHandler;
|
import com.android.modules.utils.BasicShellCommandHandler;
|
||||||
import com.android.net.module.util.LinkPropertiesUtils.CompareOrUpdateResult;
|
import com.android.net.module.util.LinkPropertiesUtils.CompareOrUpdateResult;
|
||||||
import com.android.net.module.util.LinkPropertiesUtils.CompareResult;
|
import com.android.net.module.util.LinkPropertiesUtils.CompareResult;
|
||||||
@@ -220,14 +217,7 @@ import com.google.android.collect.Lists;
|
|||||||
|
|
||||||
import libcore.io.IoUtils;
|
import libcore.io.IoUtils;
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.net.Inet4Address;
|
import java.net.Inet4Address;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
@@ -5078,101 +5068,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int checkMobileProvisioning(int suggestedTimeOutMs) {
|
|
||||||
// TODO: Remove? Any reason to trigger a provisioning check?
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Location to an updatable file listing carrier provisioning urls.
|
|
||||||
* An example:
|
|
||||||
*
|
|
||||||
* <?xml version="1.0" encoding="utf-8"?>
|
|
||||||
* <provisioningUrls>
|
|
||||||
* <provisioningUrl mcc="310" mnc="4">http://myserver.com/foo?mdn=%3$s&iccid=%1$s&imei=%2$s</provisioningUrl>
|
|
||||||
* </provisioningUrls>
|
|
||||||
*/
|
|
||||||
private static final String PROVISIONING_URL_PATH =
|
|
||||||
"/data/misc/radio/provisioning_urls.xml";
|
|
||||||
private final File mProvisioningUrlFile = new File(PROVISIONING_URL_PATH);
|
|
||||||
|
|
||||||
/** XML tag for root element. */
|
|
||||||
private static final String TAG_PROVISIONING_URLS = "provisioningUrls";
|
|
||||||
/** XML tag for individual url */
|
|
||||||
private static final String TAG_PROVISIONING_URL = "provisioningUrl";
|
|
||||||
/** XML attribute for mcc */
|
|
||||||
private static final String ATTR_MCC = "mcc";
|
|
||||||
/** XML attribute for mnc */
|
|
||||||
private static final String ATTR_MNC = "mnc";
|
|
||||||
|
|
||||||
private String getProvisioningUrlBaseFromFile() {
|
|
||||||
XmlPullParser parser;
|
|
||||||
Configuration config = mContext.getResources().getConfiguration();
|
|
||||||
|
|
||||||
try (FileReader fileReader = new FileReader(mProvisioningUrlFile)) {
|
|
||||||
parser = Xml.newPullParser();
|
|
||||||
parser.setInput(fileReader);
|
|
||||||
XmlUtils.beginDocument(parser, TAG_PROVISIONING_URLS);
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
XmlUtils.nextElement(parser);
|
|
||||||
|
|
||||||
String element = parser.getName();
|
|
||||||
if (element == null) break;
|
|
||||||
|
|
||||||
if (element.equals(TAG_PROVISIONING_URL)) {
|
|
||||||
String mcc = parser.getAttributeValue(null, ATTR_MCC);
|
|
||||||
try {
|
|
||||||
if (mcc != null && Integer.parseInt(mcc) == config.mcc) {
|
|
||||||
String mnc = parser.getAttributeValue(null, ATTR_MNC);
|
|
||||||
if (mnc != null && Integer.parseInt(mnc) == config.mnc) {
|
|
||||||
parser.next();
|
|
||||||
if (parser.getEventType() == XmlPullParser.TEXT) {
|
|
||||||
return parser.getText();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
loge("NumberFormatException in getProvisioningUrlBaseFromFile: " + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
loge("Carrier Provisioning Urls file not found");
|
|
||||||
} catch (XmlPullParserException e) {
|
|
||||||
loge("Xml parser exception reading Carrier Provisioning Urls file: " + e);
|
|
||||||
} catch (IOException e) {
|
|
||||||
loge("I/O exception reading Carrier Provisioning Urls file: " + e);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMobileProvisioningUrl() {
|
|
||||||
enforceSettingsPermission();
|
|
||||||
String url = getProvisioningUrlBaseFromFile();
|
|
||||||
if (TextUtils.isEmpty(url)) {
|
|
||||||
url = mContext.getResources().getString(R.string.mobile_provisioning_url);
|
|
||||||
log("getMobileProvisioningUrl: mobile_provisioining_url from resource =" + url);
|
|
||||||
} else {
|
|
||||||
log("getMobileProvisioningUrl: mobile_provisioning_url from File =" + url);
|
|
||||||
}
|
|
||||||
// populate the iccid, imei and phone number in the provisioning url.
|
|
||||||
if (!TextUtils.isEmpty(url)) {
|
|
||||||
String phoneNumber = mTelephonyManager.getLine1Number();
|
|
||||||
if (TextUtils.isEmpty(phoneNumber)) {
|
|
||||||
phoneNumber = "0000000000";
|
|
||||||
}
|
|
||||||
url = String.format(url,
|
|
||||||
mTelephonyManager.getSimSerialNumber() /* ICCID */,
|
|
||||||
mTelephonyManager.getDeviceId() /* IMEI */,
|
|
||||||
phoneNumber /* Phone number */);
|
|
||||||
}
|
|
||||||
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setProvisioningNotificationVisible(boolean visible, int networkType,
|
public void setProvisioningNotificationVisible(boolean visible, int networkType,
|
||||||
String action) {
|
String action) {
|
||||||
|
|||||||
Reference in New Issue
Block a user