Merge "Turn hidden API lists into a single CSV"
diff --git a/Android.bp b/Android.bp
index 5bf47ce..fe4fdb2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -695,9 +695,11 @@
"netd_aidl_interface-java",
],
- // Loaded with System.loadLibrary by android.view.textclassifier
required: [
+ // TODO: remove gps_debug when the build system propagates "required" properly.
+ "gps_debug.conf",
"libtextclassifier",
+ // Loaded with System.loadLibrary by android.view.textclassifier
"libmedia2_jni",
],
diff --git a/api/current.txt b/api/current.txt
index 299700b..caa14d4 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -42945,6 +42945,7 @@
method public int getNetworkType();
method public int getPhoneCount();
method public int getPhoneType();
+ method public int getPreferredOpportunisticDataSubscription();
method public android.telephony.ServiceState getServiceState();
method public android.telephony.SignalStrength getSignalStrength();
method public int getSimCarrierId();
@@ -42995,6 +42996,7 @@
method public boolean setNetworkSelectionModeManual(java.lang.String, boolean);
method public boolean setOperatorBrandOverride(java.lang.String);
method public boolean setPreferredNetworkTypeToGlobal();
+ method public boolean setPreferredOpportunisticDataSubscription(int);
method public void setVisualVoicemailSmsFilterSettings(android.telephony.VisualVoicemailSmsFilterSettings);
method public boolean setVoiceMailNumber(java.lang.String, java.lang.String);
method public deprecated void setVoicemailRingtoneUri(android.telecom.PhoneAccountHandle, android.net.Uri);
diff --git a/services/core/Android.bp b/services/core/Android.bp
index 8cfbda2..4395f96 100644
--- a/services/core/Android.bp
+++ b/services/core/Android.bp
@@ -30,6 +30,10 @@
"android.hardware.tv.cec-V1.0-java",
],
+ required: [
+ "gps_debug.conf",
+ ],
+
static_libs: [
"time_zone_distro",
"time_zone_distro_installer",
@@ -66,3 +70,9 @@
name: "services.core",
static_libs: ["services.core.priorityboosted"],
}
+
+
+prebuilt_etc {
+ name: "gps_debug.conf",
+ src: "java/com/android/server/location/gps_debug.conf",
+}
diff --git a/services/core/java/com/android/server/location/gps_debug.conf b/services/core/java/com/android/server/location/gps_debug.conf
new file mode 100644
index 0000000..34ce96f
--- /dev/null
+++ b/services/core/java/com/android/server/location/gps_debug.conf
@@ -0,0 +1,52 @@
+# Sample file for use for on device debug override only
+# Prefer frameworks/base/core/res/res/values/config.xml and
+# frameworks/base/core/res/res/values-mcc*-mnc*/config.xml
+
+################################
+##### AGPS server settings #####
+################################
+# FOR SUPL SUPPORT, set the following
+# SUPL_HOST=supl.google.com or IP
+# SUPL_PORT=7275
+
+# supl version 2.0
+# SUPL_VER=0x20000
+
+#SUPL_MODE is a bit mask set in config.xml per carrier by default.
+#If it is uncommented here, this value will overwrite the value from
+#config.xml.
+#MSA=0X2
+#MSB=0X1
+#SUPL_MODE=1
+
+# Emergency SUPL, 1=enable, 0=disable
+#SUPL_ES=0
+
+#Choose PDN for Emergency SUPL
+#1 - Use emergency PDN
+#0 - Use regular SUPL PDN for Emergency SUPL
+#USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=0
+
+####################################
+# LTE Positioning Profile Settings
+####################################
+# 0: Enable RRLP on LTE(Default)
+# 1: Enable LPP_User_Plane on LTE
+# 2: Enable LPP_Control_Plane
+# 3: Enable both LPP_User_Plane and LPP_Control_Plane
+#LPP_PROFILE = 2
+
+##################################################
+# Select Positioning Protocol on A-GLONASS system
+##################################################
+# 0x1: RRC CPlane
+# 0x2: RRLP UPlane
+# 0x4: LLP Uplane
+#A_GLONASS_POS_PROTOCOL_SELECT = 0
+
+# Below bit mask configures how GPS functionalities
+# should be locked when user turns off GPS on Settings
+# Set bit 0x1 if MO GPS functionalities are to be locked
+# Set bit 0x2 if NI GPS functionalities are to be locked
+# default - non is locked for backward compatibility
+#GPS_LOCK = 0
diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java
index b41e14e..bacfe61a 100644
--- a/telephony/java/android/telephony/SubscriptionInfo.java
+++ b/telephony/java/android/telephony/SubscriptionInfo.java
@@ -150,6 +150,11 @@
private String mGroupUUID;
/**
+ * A property in opportunistic subscription to indicate whether it is metered or not.
+ */
+ private boolean mIsMetered;
+
+ /**
* @hide
*/
public SubscriptionInfo(int id, String iccId, int simSlotIndex, CharSequence displayName,
@@ -158,7 +163,7 @@
@Nullable UiccAccessRule[] accessRules, String cardId) {
this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number,
roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, cardId,
- false, null);
+ false, null, true);
}
/**
@@ -168,7 +173,7 @@
CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
@Nullable UiccAccessRule[] accessRules, String cardId, boolean isOpportunistic,
- @Nullable String groupUUID) {
+ @Nullable String groupUUID, boolean isMetered) {
this.mId = id;
this.mIccId = iccId;
this.mSimSlotIndex = simSlotIndex;
@@ -187,8 +192,10 @@
this.mCardId = cardId;
this.mIsOpportunistic = isOpportunistic;
this.mGroupUUID = groupUUID;
+ this.mIsMetered = isMetered;
}
+
/**
* @return the subscription ID.
*/
@@ -403,6 +410,18 @@
}
/**
+ * Used in opportunistic subscription ({@link #isOpportunistic()}) to indicate whether it's
+ * metered or not.This is one of the factors when deciding to switch to the subscription.
+ * (a non-metered subscription, for example, would likely be preferred over a metered one).
+ *
+ * @return whether subscription is metered.
+ * @hide
+ */
+ public boolean isMetered() {
+ return mIsMetered;
+ }
+
+ /**
* Checks whether the app with the given context is authorized to manage this subscription
* according to its metadata. Only supported for embedded subscriptions (if {@link #isEmbedded}
* returns true).
@@ -496,10 +515,11 @@
String cardId = source.readString();
boolean isOpportunistic = source.readBoolean();
String groupUUID = source.readString();
+ boolean isMetered = source.readBoolean();
return new SubscriptionInfo(id, iccId, simSlotIndex, displayName, carrierName,
nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc, countryIso,
- isEmbedded, accessRules, cardId, isOpportunistic, groupUUID);
+ isEmbedded, accessRules, cardId, isOpportunistic, groupUUID, isMetered);
}
@Override
@@ -528,6 +548,7 @@
dest.writeString(mCardId);
dest.writeBoolean(mIsOpportunistic);
dest.writeString(mGroupUUID);
+ dest.writeBoolean(mIsMetered);
}
@Override
@@ -561,14 +582,14 @@
+ " mnc " + mMnc + "mCountryIso=" + mCountryIso + " isEmbedded " + mIsEmbedded
+ " accessRules " + Arrays.toString(mAccessRules)
+ " cardId=" + cardIdToPrint + " isOpportunistic " + mIsOpportunistic
- + " mGroupUUID=" + mGroupUUID + "}";
+ + " mGroupUUID=" + mGroupUUID + " isMetered=" + mIsMetered + "}";
}
@Override
public int hashCode() {
return Objects.hash(mId, mSimSlotIndex, mNameSource, mIconTint, mDataRoaming, mIsEmbedded,
- mIsOpportunistic, mGroupUUID, mIccId, mNumber, mMcc, mMnc, mCountryIso,
- mCardId, mDisplayName, mCarrierName, mAccessRules);
+ mIsOpportunistic, mGroupUUID, mIsMetered, mIccId, mNumber, mMcc, mMnc,
+ mCountryIso, mCardId, mDisplayName, mCarrierName, mAccessRules);
}
@Override
@@ -591,6 +612,7 @@
&& mIsEmbedded == toCompare.mIsEmbedded
&& mIsOpportunistic == toCompare.mIsOpportunistic
&& Objects.equals(mGroupUUID, toCompare.mGroupUUID)
+ && mIsMetered == toCompare.mIsMetered
&& Objects.equals(mIccId, toCompare.mIccId)
&& Objects.equals(mNumber, toCompare.mNumber)
&& Objects.equals(mMcc, toCompare.mMcc)
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 781a048..f8ada9b 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -569,14 +569,6 @@
public static final String IS_OPPORTUNISTIC = "is_opportunistic";
/**
- * TelephonyProvider column name for subId of parent subscription of an opportunistic
- * subscription.
- * if the parent sub id is valid, then is_opportunistic should always to true.
- * @hide
- */
- public static final String PARENT_SUB_ID = "parent_sub_id";
-
- /**
* TelephonyProvider column name for group ID. Subscriptions with same group ID
* are considered bundled together, and should behave as a single subscription at
* certain scenarios.
@@ -586,6 +578,13 @@
public static final String GROUP_UUID = "group_uuid";
/**
+ * TelephonyProvider column name for whether a subscription is metered or not, that is, whether
+ * the network it connects to charges for subscription or not. For example, paid CBRS or unpaid.
+ * @hide
+ */
+ public static final String IS_METERED = "is_metered";
+
+ /**
* Broadcast Action: The user has changed one of the default subs related to
* data, phone calls, or sms</p>
*
@@ -2411,6 +2410,21 @@
return groupUUID;
}
+ /**
+ * Set metered by simInfo index
+ *
+ * @param isMetered whether it’s a metered subscription.
+ * @param subId the unique SubscriptionInfo index in database
+ * @return the number of records updated
+ * @hide
+ */
+ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
+ public int setMetered(boolean isMetered, int subId) {
+ if (VDBG) logd("[setIsMetered]+ isMetered:" + isMetered + " subId:" + subId);
+ return setSubscriptionPropertyHelper(subId, "setIsMetered",
+ (iSub)-> iSub.setMetered(isMetered, subId));
+ }
+
private interface CallISubMethodHelper {
int callMethod(ISub iSub) throws RemoteException;
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index e7b4f6a..254a388 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -8558,7 +8558,8 @@
/**
* Return the application ID for the uicc application type like {@link #APPTYPE_CSIM}.
- * All uicc applications are uniquely identified by application ID. See ETSI 102.221 and 101.220
+ * All uicc applications are uniquely identified by application ID, represented by the hex
+ * string. e.g, A00000015141434C00. See ETSI 102.221 and 101.220
* <p>Requires Permission:
* {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE}
*
@@ -9448,4 +9449,55 @@
}
return false;
}
+
+ /**
+ * Set preferred opportunistic data subscription id.
+ *
+ * <p>Requires that the calling app has carrier privileges on both primary and
+ * secondary subscriptions (see
+ * {@link #hasCarrierPrivileges}), or has permission
+ * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}.
+ *
+ * @param subId which opportunistic subscription
+ * {@link SubscriptionManager#getOpportunisticSubscriptions} is preferred for cellular data.
+ * Pass {@link SubscriptionManager#DEFAULT_SUBSCRIPTION_ID} to unset the preference
+ * @return true if request is accepted, else false.
+ *
+ */
+ public boolean setPreferredOpportunisticDataSubscription(int subId) {
+ String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
+ try {
+ IAns iAlternativeNetworkService = getIAns();
+ if (iAlternativeNetworkService != null) {
+ return iAlternativeNetworkService.setPreferredData(subId, pkgForDebug);
+ }
+ } catch (RemoteException ex) {
+ Rlog.e(TAG, "setPreferredData RemoteException", ex);
+ }
+ return false;
+ }
+
+ /**
+ * Get preferred opportunistic data subscription Id
+ *
+ * <p>Requires that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}),
+ * or has permission {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}.
+ * @return subId preferred opportunistic subscription id or
+ * {@link SubscriptionManager#DEFAULT_SUBSCRIPTION_ID} if there are no preferred
+ * subscription id
+ *
+ */
+ public int getPreferredOpportunisticDataSubscription() {
+ String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
+ int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+ try {
+ IAns iAlternativeNetworkService = getIAns();
+ if (iAlternativeNetworkService != null) {
+ subId = iAlternativeNetworkService.getPreferredData(pkgForDebug);
+ }
+ } catch (RemoteException ex) {
+ Rlog.e(TAG, "getPreferredData RemoteException", ex);
+ }
+ return subId;
+ }
}
diff --git a/telephony/java/com/android/internal/telephony/IAns.aidl b/telephony/java/com/android/internal/telephony/IAns.aidl
index 6eb8d66..e9a4649 100755
--- a/telephony/java/com/android/internal/telephony/IAns.aidl
+++ b/telephony/java/com/android/internal/telephony/IAns.aidl
@@ -49,4 +49,33 @@
* @param callingPackage caller's package name
*/
boolean isEnabled(String callingPackage);
+
+ /**
+ * Set preferred opportunistic data subscription id.
+ *
+ * <p>Requires that the calling app has carrier privileges on both primary and
+ * secondary subscriptions (see
+ * {@link #hasCarrierPrivileges}), or has permission
+ * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}.
+ *
+ * @param subId which opportunistic subscription
+ * {@link SubscriptionManager#getOpportunisticSubscriptions} is preferred for cellular data.
+ * Pass {@link SubscriptionManager#DEFAULT_SUBSCRIPTION_ID} to unset the preference
+ * @param callingPackage caller's package name
+ * @return true if request is accepted, else false.
+ *
+ */
+ boolean setPreferredData(int subId, String callingPackage);
+
+ /**
+ * Get preferred opportunistic data subscription Id
+ *
+ * <p>Requires that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}),
+ * or has permission {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}.
+ * @return subId preferred opportunistic subscription id or
+ * {@link SubscriptionManager#DEFAULT_SUBSCRIPTION_ID} if there are no preferred
+ * subscription id
+ *
+ */
+ int getPreferredData(String callingPackage);
}
diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl
index bc44519..f9db4b0 100755
--- a/telephony/java/com/android/internal/telephony/ISub.aidl
+++ b/telephony/java/com/android/internal/telephony/ISub.aidl
@@ -184,6 +184,15 @@
String setSubscriptionGroup(in int[] subIdList, String callingPackage);
/**
+ * Set whether a subscription is metered
+ *
+ * @param isMetered whether it’s a metered subscription.
+ * @param subId the unique SubscriptionInfo index in database
+ * @return the number of records updated
+ */
+ int setMetered(boolean isMetered, int subId);
+
+ /**
* Set which subscription is preferred for cellular data. It's
* designed to overwrite default data subscription temporarily.
*