Merge "Pass debug.allocTracker.stackDepth to runtime if it exists"
diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml
index d44f5a9..28099a1 100644
--- a/data/etc/privapp-permissions-platform.xml
+++ b/data/etc/privapp-permissions-platform.xml
@@ -261,6 +261,7 @@
<permission name="android.permission.MOUNT_FORMAT_FILESYSTEMS"/>
<permission name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<permission name="android.permission.MOVE_PACKAGE"/>
+ <permission name="android.permission.NETWORK_SCAN"/>
<permission name="android.permission.PACKAGE_USAGE_STATS" />
<!-- Needed for test only -->
<permission name="android.permission.PACKET_KEEPALIVE_OFFLOAD" />
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index 8778e30..7804498 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -118,6 +118,8 @@
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.MOUNT_FORMAT_FILESYSTEMS" />
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
+ <!-- Shell only holds android.permission.NETWORK_SCAN in order to to enable CTS testing -->
+ <uses-permission android:name="android.permission.NETWORK_SCAN" />
<uses-permission android:name="android.permission.REGISTER_CALL_PROVIDER" />
<uses-permission android:name="android.permission.REGISTER_CONNECTION_MANAGER" />
<uses-permission android:name="android.permission.REGISTER_SIM_SUBSCRIPTION" />
diff --git a/telephony/java/android/telephony/CellIdentity.java b/telephony/java/android/telephony/CellIdentity.java
index bda8812..3728de2 100644
--- a/telephony/java/android/telephony/CellIdentity.java
+++ b/telephony/java/android/telephony/CellIdentity.java
@@ -110,6 +110,22 @@
}
/**
+ * @return MCC or null for CDMA
+ * @hide
+ */
+ public String getMccString() {
+ return mMccStr;
+ }
+
+ /**
+ * @return MNC or null for CDMA
+ * @hide
+ */
+ public String getMncString() {
+ return mMncStr;
+ }
+
+ /**
* Returns the channel number of the cell identity.
*
* @hide
diff --git a/telephony/java/android/telephony/CellIdentityCdma.java b/telephony/java/android/telephony/CellIdentityCdma.java
index fa19867..637f49d 100644
--- a/telephony/java/android/telephony/CellIdentityCdma.java
+++ b/telephony/java/android/telephony/CellIdentityCdma.java
@@ -109,6 +109,13 @@
return new CellIdentityCdma(this);
}
+ /** @hide */
+ public CellIdentityCdma sanitizeLocationInfo() {
+ return new CellIdentityCdma(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
+ CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
+ mAlphaLong, mAlphaShort);
+ }
+
/**
* Take the latitude and longitude in 1/4 seconds and see if
* the reported location is on Null Island.
diff --git a/telephony/java/android/telephony/CellIdentityGsm.java b/telephony/java/android/telephony/CellIdentityGsm.java
index 9a24e47..6c1048f 100644
--- a/telephony/java/android/telephony/CellIdentityGsm.java
+++ b/telephony/java/android/telephony/CellIdentityGsm.java
@@ -97,6 +97,12 @@
return new CellIdentityGsm(this);
}
+ /** @hide */
+ public CellIdentityGsm sanitizeLocationInfo() {
+ return new CellIdentityGsm(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
+ CellInfo.UNAVAILABLE, mMccStr, mMncStr, mAlphaLong, mAlphaShort);
+ }
+
/**
* @return 3-digit Mobile Country Code, 0..999,
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
diff --git a/telephony/java/android/telephony/CellIdentityLte.java b/telephony/java/android/telephony/CellIdentityLte.java
index 51393b9..824fbc5 100644
--- a/telephony/java/android/telephony/CellIdentityLte.java
+++ b/telephony/java/android/telephony/CellIdentityLte.java
@@ -113,6 +113,13 @@
cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort);
}
+ /** @hide */
+ public CellIdentityLte sanitizeLocationInfo() {
+ return new CellIdentityLte(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
+ CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
+ mMccStr, mMncStr, mAlphaLong, mAlphaShort);
+ }
+
CellIdentityLte copy() {
return new CellIdentityLte(this);
}
diff --git a/telephony/java/android/telephony/CellIdentityNr.java b/telephony/java/android/telephony/CellIdentityNr.java
index 771e7b9..44896e2 100644
--- a/telephony/java/android/telephony/CellIdentityNr.java
+++ b/telephony/java/android/telephony/CellIdentityNr.java
@@ -46,7 +46,7 @@
*
* @hide
*/
- public CellIdentityNr(int pci, int tac, int nrArfcn, String mccStr, String mncStr,
+ public CellIdentityNr(int pci, int tac, int nrArfcn, String mccStr, String mncStr,
long nci, String alphal, String alphas) {
super(TAG, CellInfo.TYPE_NR, mccStr, mncStr, alphal, alphas);
mPci = pci;
@@ -55,6 +55,12 @@
mNci = nci;
}
+ /** @hide */
+ public CellIdentityNr sanitizeLocationInfo() {
+ return new CellIdentityNr(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
+ mMccStr, mMncStr, CellInfo.UNAVAILABLE, mAlphaLong, mAlphaShort);
+ }
+
/**
* @return a CellLocation object for this CellIdentity.
* @hide
diff --git a/telephony/java/android/telephony/CellIdentityTdscdma.java b/telephony/java/android/telephony/CellIdentityTdscdma.java
index 19b11b6..a591bd1 100644
--- a/telephony/java/android/telephony/CellIdentityTdscdma.java
+++ b/telephony/java/android/telephony/CellIdentityTdscdma.java
@@ -90,6 +90,12 @@
cid.uarfcn, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort);
}
+ /** @hide */
+ public CellIdentityTdscdma sanitizeLocationInfo() {
+ return new CellIdentityTdscdma(mMccStr, mMncStr, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
+ CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, mAlphaLong, mAlphaShort);
+ }
+
CellIdentityTdscdma copy() {
return new CellIdentityTdscdma(this);
}
diff --git a/telephony/java/android/telephony/CellIdentityWcdma.java b/telephony/java/android/telephony/CellIdentityWcdma.java
index 6e09784..3a1772f 100644
--- a/telephony/java/android/telephony/CellIdentityWcdma.java
+++ b/telephony/java/android/telephony/CellIdentityWcdma.java
@@ -91,6 +91,13 @@
cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort);
}
+ /** @hide */
+ public CellIdentityWcdma sanitizeLocationInfo() {
+ return new CellIdentityWcdma(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
+ CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, mMccStr, mMncStr,
+ mAlphaLong, mAlphaShort);
+ }
+
CellIdentityWcdma copy() {
return new CellIdentityWcdma(this);
}
diff --git a/telephony/java/android/telephony/CellInfo.java b/telephony/java/android/telephony/CellInfo.java
index cdaf6ed..2142feb 100644
--- a/telephony/java/android/telephony/CellInfo.java
+++ b/telephony/java/android/telephony/CellInfo.java
@@ -197,6 +197,11 @@
@NonNull
public abstract CellSignalStrength getCellSignalStrength();
+ /** @hide */
+ public CellInfo sanitizeLocationInfo() {
+ return null;
+ }
+
/**
* Gets the connection status of this cell.
*
diff --git a/telephony/java/android/telephony/CellInfoCdma.java b/telephony/java/android/telephony/CellInfoCdma.java
index 359c8be..d9f44b8 100644
--- a/telephony/java/android/telephony/CellInfoCdma.java
+++ b/telephony/java/android/telephony/CellInfoCdma.java
@@ -90,6 +90,15 @@
public CellSignalStrengthCdma getCellSignalStrength() {
return mCellSignalStrengthCdma;
}
+
+ /** @hide */
+ @Override
+ public CellInfo sanitizeLocationInfo() {
+ CellInfoCdma result = new CellInfoCdma(this);
+ result.mCellIdentityCdma = mCellIdentityCdma.sanitizeLocationInfo();
+ return result;
+ }
+
/** @hide */
public void setCellSignalStrength(CellSignalStrengthCdma css) {
mCellSignalStrengthCdma = css;
diff --git a/telephony/java/android/telephony/CellInfoGsm.java b/telephony/java/android/telephony/CellInfoGsm.java
index dc2779f..1cecbc6 100644
--- a/telephony/java/android/telephony/CellInfoGsm.java
+++ b/telephony/java/android/telephony/CellInfoGsm.java
@@ -84,6 +84,15 @@
public CellSignalStrengthGsm getCellSignalStrength() {
return mCellSignalStrengthGsm;
}
+
+ /** @hide */
+ @Override
+ public CellInfo sanitizeLocationInfo() {
+ CellInfoGsm result = new CellInfoGsm(this);
+ result.mCellIdentityGsm = mCellIdentityGsm.sanitizeLocationInfo();
+ return result;
+ }
+
/** @hide */
public void setCellSignalStrength(CellSignalStrengthGsm css) {
mCellSignalStrengthGsm = css;
diff --git a/telephony/java/android/telephony/CellInfoLte.java b/telephony/java/android/telephony/CellInfoLte.java
index 0e9623d..45f4b1d 100644
--- a/telephony/java/android/telephony/CellInfoLte.java
+++ b/telephony/java/android/telephony/CellInfoLte.java
@@ -96,6 +96,15 @@
if (DBG) log("getCellSignalStrength: " + mCellSignalStrengthLte);
return mCellSignalStrengthLte;
}
+
+ /** @hide */
+ @Override
+ public CellInfo sanitizeLocationInfo() {
+ CellInfoLte result = new CellInfoLte(this);
+ result.mCellIdentityLte = mCellIdentityLte.sanitizeLocationInfo();
+ return result;
+ }
+
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
public void setCellSignalStrength(CellSignalStrengthLte css) {
diff --git a/telephony/java/android/telephony/CellInfoNr.java b/telephony/java/android/telephony/CellInfoNr.java
index 7f7902c..2a8b067 100644
--- a/telephony/java/android/telephony/CellInfoNr.java
+++ b/telephony/java/android/telephony/CellInfoNr.java
@@ -36,6 +36,13 @@
mCellSignalStrength = CellSignalStrengthNr.CREATOR.createFromParcel(in);
}
+ private CellInfoNr(CellInfoNr other, boolean sanitizeLocationInfo) {
+ super(other);
+ mCellIdentity = sanitizeLocationInfo ? other.mCellIdentity.sanitizeLocationInfo()
+ : other.mCellIdentity;
+ mCellSignalStrength = other.mCellSignalStrength;
+ }
+
@Override
@NonNull
public CellIdentity getCellIdentity() {
@@ -48,6 +55,12 @@
return mCellSignalStrength;
}
+ /** @hide */
+ @Override
+ public CellInfo sanitizeLocationInfo() {
+ return new CellInfoNr(this, true);
+ }
+
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), mCellIdentity, mCellSignalStrength);
diff --git a/telephony/java/android/telephony/CellInfoTdscdma.java b/telephony/java/android/telephony/CellInfoTdscdma.java
index 1830086..ccafda6 100644
--- a/telephony/java/android/telephony/CellInfoTdscdma.java
+++ b/telephony/java/android/telephony/CellInfoTdscdma.java
@@ -91,6 +91,14 @@
}
/** @hide */
+ @Override
+ public CellInfo sanitizeLocationInfo() {
+ CellInfoTdscdma result = new CellInfoTdscdma(this);
+ result.mCellIdentityTdscdma = mCellIdentityTdscdma.sanitizeLocationInfo();
+ return result;
+ }
+
+ /** @hide */
public void setCellSignalStrength(CellSignalStrengthTdscdma css) {
mCellSignalStrengthTdscdma = css;
}
diff --git a/telephony/java/android/telephony/CellInfoWcdma.java b/telephony/java/android/telephony/CellInfoWcdma.java
index fe06c78..81fc7bb 100644
--- a/telephony/java/android/telephony/CellInfoWcdma.java
+++ b/telephony/java/android/telephony/CellInfoWcdma.java
@@ -84,6 +84,15 @@
public CellSignalStrengthWcdma getCellSignalStrength() {
return mCellSignalStrengthWcdma;
}
+
+ /** @hide */
+ @Override
+ public CellInfo sanitizeLocationInfo() {
+ CellInfoWcdma result = new CellInfoWcdma(this);
+ result.mCellIdentityWcdma = mCellIdentityWcdma.sanitizeLocationInfo();
+ return result;
+ }
+
/** @hide */
public void setCellSignalStrength(CellSignalStrengthWcdma css) {
mCellSignalStrengthWcdma = css;
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 9982b9b..92ac619 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -1992,24 +1992,6 @@
}
/**
- * If a default is set to subscription which is not active, this will reset that default back to
- * an invalid subscription id, i.e. < 0.
- * @hide
- */
- @UnsupportedAppUsage
- public void clearDefaultsForInactiveSubIds() {
- if (VDBG) logd("clearDefaultsForInactiveSubIds");
- try {
- ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
- if (iSub != null) {
- iSub.clearDefaultsForInactiveSubIds();
- }
- } catch (RemoteException ex) {
- // ignore it
- }
- }
-
- /**
* Check if the supplied subscription ID is valid.
*
* <p>A valid subscription ID is not necessarily an active subscription ID
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 41d7eb1..3d3ef98 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -1417,6 +1417,70 @@
public static final String EXTRA_ANOMALY_DESCRIPTION =
"android.telephony.extra.ANOMALY_DESCRIPTION";
+ /**
+ * Broadcast intent sent to indicate primary (non-opportunistic) subscription list has changed.
+ *
+ * @hide
+ */
+ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String ACTION_PRIMARY_SUBSCRIPTION_LIST_CHANGED =
+ "android.telephony.action.PRIMARY_SUBSCRIPTION_LIST_CHANGED";
+
+ /**
+ * Integer intent extra to be used with {@link #ACTION_PRIMARY_SUBSCRIPTION_LIST_CHANGED}
+ * to indicate whether a SIM selection is needed to choose default subscription.
+ *
+ * @hide
+ */
+ public static final String EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE =
+ "android.telephony.extra.DEFAULT_SUBSCRIPTION_SELECT_TYPE";
+
+ /**
+ * Used as an int value for {@link #EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE}
+ * to indicate there's no need to re-select any default subscription.
+ * @hide
+ */
+ public static final int EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_NONE = 0;
+
+ /**
+ * Used as an int value for {@link #EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE}
+ * to indicate there's a need to select default data subscription.
+ * @hide
+ */
+ public static final int EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_DATA = 1;
+
+ /**
+ * Used as an int value for {@link #EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE}
+ * to indicate there's a need to select default voice call subscription.
+ * @hide
+ */
+ public static final int EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_VOICE = 2;
+
+ /**
+ * Used as an int value for {@link #EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE}
+ * to indicate there's a need to select default sms subscription.
+ * @hide
+ */
+ public static final int EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE_SMS = 3;
+
+ /**
+ * Used as an int value for {@link #EXTRA_DEFAULT_SUBSCRIPTION_SELECT_TYPE}
+ * to indicate user to decide whether current SIM should be preferred for all
+ * data / voice / sms.
+ * @hide
+ */
+ public static final int EXTRA_DEFAULT_SUBSCRIPTION_SELECT_FOR_ALL_TYPES = 4;
+
+ /**
+ * Integer intent extra to be used with
+ * {@link #EXTRA_DEFAULT_SUBSCRIPTION_SELECT_FOR_ALL_TYPES}
+ * to indicate which SIM is being selected.
+ *
+ * @hide
+ */
+ public static final String EXTRA_DEFAULT_SUBSCRIPTION_ID =
+ "android.telephony.extra.DEFAULT_SUBSCRIPTION_ID";
+
//
//
// Device Info
@@ -6864,6 +6928,17 @@
* app has carrier privileges (see {@link #hasCarrierPrivileges})
* and {@link android.Manifest.permission#ACCESS_FINE_LOCATION}.
*
+ * If the system-wide location switch is off, apps may still call this API, with the
+ * following constraints:
+ * <ol>
+ * <li>The app must hold the {@code android.permission.NETWORK_SCAN} permission.</li>
+ * <li>The app must not supply any specific bands or channels to scan.</li>
+ * <li>The app must only specify MCC/MNC pairs that are
+ * associated to a SIM in the device.</li>
+ * <li>Returned results will have no meaningful info other than signal strength
+ * and MCC/MNC info.</li>
+ * </ol>
+ *
* @param request Contains all the RAT with bands/channels that need to be scanned.
* @param executor The executor through which the callback should be invoked. Since the scan
* request may trigger multiple callbacks and they must be invoked in the same order as
diff --git a/telephony/java/android/telephony/TelephonyScanManager.java b/telephony/java/android/telephony/TelephonyScanManager.java
index 91f74b8..28747da 100644
--- a/telephony/java/android/telephony/TelephonyScanManager.java
+++ b/telephony/java/android/telephony/TelephonyScanManager.java
@@ -53,6 +53,11 @@
public static final int CALLBACK_SCAN_ERROR = 2;
/** @hide */
public static final int CALLBACK_SCAN_COMPLETE = 3;
+ /** @hide */
+ public static final int CALLBACK_RESTRICTED_SCAN_RESULTS = 4;
+
+ /** @hide */
+ public static final int INVALID_SCAN_ID = -1;
/**
* The caller of
@@ -129,6 +134,7 @@
}
switch (message.what) {
+ case CALLBACK_RESTRICTED_SCAN_RESULTS:
case CALLBACK_SCAN_RESULTS:
try {
final Bundle b = message.getData();
@@ -137,9 +143,9 @@
for (int i = 0; i < parcelables.length; i++) {
ci[i] = (CellInfo) parcelables[i];
}
- executor.execute(() ->{
+ executor.execute(() -> {
Rlog.d(TAG, "onResults: " + ci.toString());
- callback.onResults((List<CellInfo>) Arrays.asList(ci));
+ callback.onResults(Arrays.asList(ci));
});
} catch (Exception e) {
Rlog.e(TAG, "Exception in networkscan callback onResults", e);
@@ -200,6 +206,10 @@
if (telephony != null) {
int scanId = telephony.requestNetworkScan(
subId, request, mMessenger, new Binder(), callingPackage);
+ if (scanId == INVALID_SCAN_ID) {
+ Rlog.e(TAG, "Failed to initiate network scan");
+ return null;
+ }
saveScanInfo(scanId, request, executor, callback);
return new NetworkScan(scanId, subId);
}
diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl
index 6eb6fd8..daea9d5 100755
--- a/telephony/java/com/android/internal/telephony/ISub.aidl
+++ b/telephony/java/com/android/internal/telephony/ISub.aidl
@@ -267,8 +267,6 @@
void setDefaultSmsSubId(int subId);
- void clearDefaultsForInactiveSubIds();
-
@UnsupportedAppUsage
int[] getActiveSubIdList(boolean visibleOnly);