Merge "Run bpfmt on api/Android.bp"
diff --git a/core/api/current.txt b/core/api/current.txt
index e32f07b..536c118 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -40984,8 +40984,9 @@
field public static final int OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO = 2; // 0x2
field public static final int OVERRIDE_NETWORK_TYPE_LTE_CA = 1; // 0x1
field public static final int OVERRIDE_NETWORK_TYPE_NONE = 0; // 0x0
+ field public static final int OVERRIDE_NETWORK_TYPE_NR_ADVANCED = 4; // 0x4
field public static final int OVERRIDE_NETWORK_TYPE_NR_NSA = 3; // 0x3
- field public static final int OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE = 4; // 0x4
+ field @Deprecated public static final int OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE = 4; // 0x4
}
public class TelephonyManager {
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 114f395..1f15dfd 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -631,6 +631,8 @@
char saveResolvedClassesDelayMsOptsBuf[
sizeof("-Xps-save-resolved-classes-delay-ms:")-1 + PROPERTY_VALUE_MAX];
char profileMinSavePeriodOptsBuf[sizeof("-Xps-min-save-period-ms:")-1 + PROPERTY_VALUE_MAX];
+ char profileMinFirstSaveOptsBuf[
+ sizeof("-Xps-min-first-save-ms:")-1 + PROPERTY_VALUE_MAX];
char madviseRandomOptsBuf[sizeof("-XX:MadviseRandomAccess:")-1 + PROPERTY_VALUE_MAX];
char madviseWillNeedFileSizeVdex[
sizeof("-XMadviseWillNeedVdexFileSize:")-1 + PROPERTY_VALUE_MAX];
@@ -869,6 +871,9 @@
parseRuntimeOption("dalvik.vm.ps-min-save-period-ms", profileMinSavePeriodOptsBuf,
"-Xps-min-save-period-ms:");
+ parseRuntimeOption("dalvik.vm.ps-min-first-save-ms", profileMinFirstSaveOptsBuf,
+ "-Xps-min-first-save-ms:");
+
property_get("ro.config.low_ram", propBuf, "");
if (strcmp(propBuf, "true") == 0) {
addOption("-XX:LowMemoryMode");
diff --git a/services/core/java/com/android/server/am/CachedAppOptimizer.java b/services/core/java/com/android/server/am/CachedAppOptimizer.java
index 36d4a38..8e259b5 100644
--- a/services/core/java/com/android/server/am/CachedAppOptimizer.java
+++ b/services/core/java/com/android/server/am/CachedAppOptimizer.java
@@ -80,20 +80,22 @@
// Phenotype sends int configurations and we map them to the strings we'll use on device,
// preventing a weird string value entering the kernel.
+ private static final int COMPACT_ACTION_NONE = 0;
+ private static final int COMPACT_ACTION_FILE = 1;
+ private static final int COMPACT_ACTION_ANON = 2;
+ private static final int COMPACT_ACTION_FULL = 3;
+
+ private static final String COMPACT_ACTION_STRING[] = {"", "file", "anon", "all"};
+
+ // Keeps these flags in sync with services/core/jni/com_android_server_am_CachedAppOptimizer.cpp
private static final int COMPACT_ACTION_FILE_FLAG = 1;
private static final int COMPACT_ACTION_ANON_FLAG = 2;
- private static final int COMPACT_ACTION_FULL_FLAG = 3;
- private static final int COMPACT_ACTION_NONE_FLAG = 4;
- private static final String COMPACT_ACTION_NONE = "";
- private static final String COMPACT_ACTION_FILE = "file";
- private static final String COMPACT_ACTION_ANON = "anon";
- private static final String COMPACT_ACTION_FULL = "all";
// Defaults for phenotype flags.
@VisibleForTesting static final Boolean DEFAULT_USE_COMPACTION = false;
@VisibleForTesting static final Boolean DEFAULT_USE_FREEZER = false;
- @VisibleForTesting static final int DEFAULT_COMPACT_ACTION_1 = COMPACT_ACTION_FILE_FLAG;
- @VisibleForTesting static final int DEFAULT_COMPACT_ACTION_2 = COMPACT_ACTION_FULL_FLAG;
+ @VisibleForTesting static final int DEFAULT_COMPACT_ACTION_1 = COMPACT_ACTION_FILE;
+ @VisibleForTesting static final int DEFAULT_COMPACT_ACTION_2 = COMPACT_ACTION_FULL;
@VisibleForTesting static final long DEFAULT_COMPACT_THROTTLE_1 = 5_000;
@VisibleForTesting static final long DEFAULT_COMPACT_THROTTLE_2 = 10_000;
@VisibleForTesting static final long DEFAULT_COMPACT_THROTTLE_3 = 500;
@@ -406,6 +408,14 @@
private native void compactSystem();
/**
+ * Compacts a process or app
+ * @param pid pid of process to compact
+ * @param compactionFlags selects the compaction type as defined by COMPACT_ACTION_{TYPE}_FLAG
+ * constants
+ */
+ static private native void compactProcess(int pid, int compactionFlags);
+
+ /**
* Reads the flag value from DeviceConfig to determine whether app compaction
* should be enabled, and starts the freeze/compaction thread if needed.
*/
@@ -706,18 +716,11 @@
@VisibleForTesting
static String compactActionIntToString(int action) {
- switch(action) {
- case COMPACT_ACTION_NONE_FLAG:
- return COMPACT_ACTION_NONE;
- case COMPACT_ACTION_FILE_FLAG:
- return COMPACT_ACTION_FILE;
- case COMPACT_ACTION_ANON_FLAG:
- return COMPACT_ACTION_ANON;
- case COMPACT_ACTION_FULL_FLAG:
- return COMPACT_ACTION_FULL;
- default:
- return COMPACT_ACTION_NONE;
+ if (action < 0 || action >= COMPACT_ACTION_STRING.length) {
+ return "";
}
+
+ return COMPACT_ACTION_STRING[action];
}
// This will ensure app will be out of the freezer for at least FREEZE_TIMEOUT_MS
@@ -950,11 +953,11 @@
action = mCompactActionFull;
break;
default:
- action = COMPACT_ACTION_NONE;
+ action = COMPACT_ACTION_STRING[COMPACT_ACTION_NONE];
break;
}
- if (COMPACT_ACTION_NONE.equals(action)) {
+ if (COMPACT_ACTION_STRING[COMPACT_ACTION_NONE].equals(action)) {
return;
}
@@ -978,7 +981,8 @@
return;
}
- if (action.equals(COMPACT_ACTION_FULL) || action.equals(COMPACT_ACTION_ANON)) {
+ if (action.equals(COMPACT_ACTION_STRING[COMPACT_ACTION_FULL])
+ || action.equals(COMPACT_ACTION_STRING[COMPACT_ACTION_ANON])) {
if (mFullAnonRssThrottleKb > 0L
&& anonRssBefore < mFullAnonRssThrottleKb) {
if (DEBUG_COMPACTION) {
@@ -1054,8 +1058,8 @@
proc.lastCompactTime = end;
proc.lastCompactAction = pendingAction;
}
- if (action.equals(COMPACT_ACTION_FULL)
- || action.equals(COMPACT_ACTION_ANON)) {
+ if (action.equals(COMPACT_ACTION_STRING[COMPACT_ACTION_FULL])
+ || action.equals(COMPACT_ACTION_STRING[COMPACT_ACTION_ANON])) {
// Remove entry and insert again to update insertion order.
mLastCompactionStats.remove(pid);
mLastCompactionStats.put(pid, new LastCompactionStats(rssAfter));
@@ -1197,8 +1201,12 @@
// Compact process.
@Override
public void performCompaction(String action, int pid) throws IOException {
- try (FileOutputStream fos = new FileOutputStream("/proc/" + pid + "/reclaim")) {
- fos.write(action.getBytes());
+ if (action.equals(COMPACT_ACTION_STRING[COMPACT_ACTION_FULL])) {
+ compactProcess(pid, COMPACT_ACTION_FILE_FLAG | COMPACT_ACTION_ANON_FLAG);
+ } else if (action.equals(COMPACT_ACTION_STRING[COMPACT_ACTION_FILE])) {
+ compactProcess(pid, COMPACT_ACTION_FILE_FLAG);
+ } else if (action.equals(COMPACT_ACTION_STRING[COMPACT_ACTION_ANON])) {
+ compactProcess(pid, COMPACT_ACTION_ANON_FLAG);
}
}
}
diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp
index d0bd8b3..a0c96f0 100644
--- a/services/core/jni/Android.bp
+++ b/services/core/jni/Android.bp
@@ -74,6 +74,7 @@
"frameworks/base/libs",
"frameworks/native/services",
"system/gatekeeper/include",
+ "system/memory/libmeminfo/include",
],
header_libs: [
@@ -111,6 +112,7 @@
"libhardware",
"libhardware_legacy",
"libhidlbase",
+ "libmeminfo",
"libmemtrackproxy",
"libmtp",
"libnativehelper",
diff --git a/services/core/jni/com_android_server_am_CachedAppOptimizer.cpp b/services/core/jni/com_android_server_am_CachedAppOptimizer.cpp
index 678308a..af3948b 100644
--- a/services/core/jni/com_android_server_am_CachedAppOptimizer.cpp
+++ b/services/core/jni/com_android_server_am_CachedAppOptimizer.cpp
@@ -17,30 +17,177 @@
#define LOG_TAG "CachedAppOptimizer"
//#define LOG_NDEBUG 0
+#include <android-base/file.h>
+#include <android-base/logging.h>
+#include <android-base/stringprintf.h>
+#include <android-base/unique_fd.h>
+#include <android_runtime/AndroidRuntime.h>
+#include <binder/IPCThreadState.h>
+#include <cutils/compiler.h>
#include <dirent.h>
+#include <jni.h>
+#include <linux/errno.h>
+#include <log/log.h>
+#include <meminfo/procmeminfo.h>
+#include <nativehelper/JNIHelp.h>
+#include <processgroup/processgroup.h>
#include <stddef.h>
#include <stdio.h>
+#include <sys/mman.h>
+#include <sys/pidfd.h>
#include <sys/stat.h>
+#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
-#include <android-base/stringprintf.h>
-#include <android-base/file.h>
-
-#include <nativehelper/JNIHelp.h>
-#include <android_runtime/AndroidRuntime.h>
-#include <binder/IPCThreadState.h>
-#include <jni.h>
-#include <processgroup/processgroup.h>
+#include <algorithm>
using android::base::StringPrintf;
using android::base::WriteStringToFile;
+using android::meminfo::ProcMemInfo;
+using namespace android::meminfo;
+
+#define COMPACT_ACTION_FILE_FLAG 1
+#define COMPACT_ACTION_ANON_FLAG 2
+
+using VmaToAdviseFunc = std::function<int(const Vma&)>;
+using android::base::unique_fd;
#define SYNC_RECEIVED_WHILE_FROZEN (1)
#define ASYNC_RECEIVED_WHILE_FROZEN (2)
namespace android {
+// Legacy method for compacting processes, any new code should
+// use compactProcess instead.
+static inline void compactProcessProcfs(int pid, const std::string& compactionType) {
+ std::string reclaim_path = StringPrintf("/proc/%d/reclaim", pid);
+ WriteStringToFile(compactionType, reclaim_path);
+}
+
+// Compacts a set of VMAs for pid using an madviseType accepted by process_madvise syscall
+// On success returns the total bytes that where compacted. On failure it returns
+// a negative error code from the standard linux error codes.
+static int64_t compactMemory(const std::vector<Vma>& vmas, int pid, int madviseType) {
+ // UIO_MAXIOV is currently a small value and we might have more addresses
+ // we do multiple syscalls if we exceed its maximum
+ static struct iovec vmasToKernel[UIO_MAXIOV];
+
+ if (vmas.empty()) {
+ return 0;
+ }
+
+ unique_fd pidfd(pidfd_open(pid, 0));
+ if (pidfd < 0) {
+ // Skip compaction if failed to open pidfd with any error
+ return -errno;
+ }
+
+ int64_t totalBytesCompacted = 0;
+ for (int iBase = 0; iBase < vmas.size(); iBase += UIO_MAXIOV) {
+ int totalVmasToKernel = std::min(UIO_MAXIOV, (int)(vmas.size() - iBase));
+ for (int iVec = 0, iVma = iBase; iVec < totalVmasToKernel; ++iVec, ++iVma) {
+ vmasToKernel[iVec].iov_base = (void*)vmas[iVma].start;
+ vmasToKernel[iVec].iov_len = vmas[iVma].end - vmas[iVma].start;
+ }
+
+ auto bytesCompacted =
+ process_madvise(pidfd, vmasToKernel, totalVmasToKernel, madviseType, 0);
+ if (CC_UNLIKELY(bytesCompacted == -1)) {
+ return -errno;
+ }
+
+ totalBytesCompacted += bytesCompacted;
+ }
+
+ return totalBytesCompacted;
+}
+
+static int getFilePageAdvice(const Vma& vma) {
+ if (vma.inode > 0 && !vma.is_shared) {
+ return MADV_COLD;
+ }
+ return -1;
+}
+static int getAnonPageAdvice(const Vma& vma) {
+ if (vma.inode == 0 && !vma.is_shared) {
+ return MADV_PAGEOUT;
+ }
+ return -1;
+}
+static int getAnyPageAdvice(const Vma& vma) {
+ if (vma.inode == 0 && !vma.is_shared) {
+ return MADV_PAGEOUT;
+ }
+ return MADV_COLD;
+}
+
+// Perform a full process compaction using process_madvise syscall
+// reading all filtering VMAs and filtering pages as specified by pageFilter
+static int64_t compactProcess(int pid, VmaToAdviseFunc vmaToAdviseFunc) {
+ ProcMemInfo meminfo(pid);
+ std::vector<Vma> pageoutVmas, coldVmas;
+ auto vmaCollectorCb = [&coldVmas,&pageoutVmas,&vmaToAdviseFunc](const Vma& vma) {
+ int advice = vmaToAdviseFunc(vma);
+ switch (advice) {
+ case MADV_COLD:
+ coldVmas.push_back(vma);
+ break;
+ case MADV_PAGEOUT:
+ pageoutVmas.push_back(vma);
+ break;
+ }
+ };
+ meminfo.ForEachVmaFromMaps(vmaCollectorCb);
+
+ int64_t pageoutBytes = compactMemory(pageoutVmas, pid, MADV_PAGEOUT);
+ if (pageoutBytes < 0) {
+ // Error, just forward it.
+ return pageoutBytes;
+ }
+
+ int64_t coldBytes = compactMemory(coldVmas, pid, MADV_COLD);
+ if (coldBytes < 0) {
+ // Error, just forward it.
+ return coldBytes;
+ }
+
+ return pageoutBytes + coldBytes;
+}
+
+// Compact process using process_madvise syscall or fallback to procfs in
+// case syscall does not exist.
+static void compactProcessOrFallback(int pid, int compactionFlags) {
+ if ((compactionFlags & (COMPACT_ACTION_ANON_FLAG | COMPACT_ACTION_FILE_FLAG)) == 0) return;
+
+ bool compactAnon = compactionFlags & COMPACT_ACTION_ANON_FLAG;
+ bool compactFile = compactionFlags & COMPACT_ACTION_FILE_FLAG;
+
+ // Set when the system does not support process_madvise syscall to avoid
+ // gathering VMAs in subsequent calls prior to falling back to procfs
+ static bool shouldForceProcFs = false;
+ std::string compactionType;
+ VmaToAdviseFunc vmaToAdviseFunc;
+
+ if (compactAnon) {
+ if (compactFile) {
+ compactionType = "all";
+ vmaToAdviseFunc = getAnyPageAdvice;
+ } else {
+ compactionType = "anon";
+ vmaToAdviseFunc = getAnonPageAdvice;
+ }
+ } else {
+ compactionType = "file";
+ vmaToAdviseFunc = getFilePageAdvice;
+ }
+
+ if (shouldForceProcFs || compactProcess(pid, vmaToAdviseFunc) == -ENOSYS) {
+ shouldForceProcFs = true;
+ compactProcessProcfs(pid, compactionType);
+ }
+}
+
// This performs per-process reclaim on all processes belonging to non-app UIDs.
// For the most part, these are non-zygote processes like Treble HALs, but it
// also includes zygote-derived processes that run in system UIDs, like bluetooth
@@ -74,11 +221,17 @@
continue;
}
- std::string reclaim_path = StringPrintf("/proc/%s/reclaim", current->d_name);
- WriteStringToFile(std::string("all"), reclaim_path);
+ int pid = atoi(current->d_name);
+
+ compactProcessOrFallback(pid, COMPACT_ACTION_ANON_FLAG | COMPACT_ACTION_FILE_FLAG);
}
}
+static void com_android_server_am_CachedAppOptimizer_compactProcess(JNIEnv*, jobject, jint pid,
+ jint compactionFlags) {
+ compactProcessOrFallback(pid, compactionFlags);
+}
+
static void com_android_server_am_CachedAppOptimizer_enableFreezerInternal(
JNIEnv *env, jobject clazz, jboolean enable) {
bool success = true;
@@ -126,14 +279,14 @@
}
static const JNINativeMethod sMethods[] = {
- /* name, signature, funcPtr */
- {"compactSystem", "()V", (void*)com_android_server_am_CachedAppOptimizer_compactSystem},
- {"enableFreezerInternal", "(Z)V",
- (void*)com_android_server_am_CachedAppOptimizer_enableFreezerInternal},
- {"freezeBinder", "(IZ)V", (void*)com_android_server_am_CachedAppOptimizer_freezeBinder},
- {"getBinderFreezeInfo", "(I)I",
- (void*)com_android_server_am_CachedAppOptimizer_getBinderFreezeInfo}
-};
+ /* name, signature, funcPtr */
+ {"compactSystem", "()V", (void*)com_android_server_am_CachedAppOptimizer_compactSystem},
+ {"compactProcess", "(II)V", (void*)com_android_server_am_CachedAppOptimizer_compactProcess},
+ {"enableFreezerInternal", "(Z)V",
+ (void*)com_android_server_am_CachedAppOptimizer_enableFreezerInternal},
+ {"freezeBinder", "(IZ)V", (void*)com_android_server_am_CachedAppOptimizer_freezeBinder},
+ {"getBinderFreezeInfo", "(I)I",
+ (void*)com_android_server_am_CachedAppOptimizer_getBinderFreezeInfo}};
int register_android_server_am_CachedAppOptimizer(JNIEnv* env)
{
diff --git a/telephony/java/android/telephony/Annotation.java b/telephony/java/android/telephony/Annotation.java
index 4a53a80..4ae11b8 100644
--- a/telephony/java/android/telephony/Annotation.java
+++ b/telephony/java/android/telephony/Annotation.java
@@ -648,7 +648,7 @@
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA,
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO,
TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA,
- TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE})
+ TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_ADVANCED})
public @interface OverrideNetworkType {}
/**
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 15ad5bc..f96c243 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -3388,6 +3388,16 @@
"nr_timers_reset_if_non_endc_and_rrc_idle_bool";
/**
+ * A list of additional NR advanced band would map to
+ * {@link TelephonyDisplayInfo#OVERRIDE_NETWORK_TYPE_NR_ADVANCED} when the device is on that
+ * band.
+ *
+ * @hide
+ */
+ public static final String KEY_ADDITIONAL_NR_ADVANCED_BANDS_INT_ARRAY =
+ "additional_nr_advanced_bands_int_array";
+
+ /**
* Controls time in milliseconds until DcTracker reevaluates 5G connection state.
* @hide
*/
@@ -4158,7 +4168,7 @@
"+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.deferred\"",
"+g.gsma.rcs.cpm.pager-large",
"+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.session\"",
- "+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.session\"",
+ "+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.filetransfer\"",
"+g.3gpp.iari-ref=\"urn%3Aurn-7%3A3gpp-application.ims.iari.rcs.fthttp\"",
"+g.3gpp.iari-ref=\"urn%3Aurn-7%3A3gpp-application.ims.iari.rcs.ftsms\"",
"+g.3gpp.iari-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.gsma.callcomposer\"",
@@ -4878,6 +4888,7 @@
sDefaults.putBoolean(KEY_NR_TIMERS_RESET_IF_NON_ENDC_AND_RRC_IDLE_BOOL, false);
/* Default value is 1 hour. */
sDefaults.putLong(KEY_5G_WATCHDOG_TIME_MS_LONG, 3600000);
+ sDefaults.putIntArray(KEY_ADDITIONAL_NR_ADVANCED_BANDS_INT_ARRAY, new int[0]);
sDefaults.putBoolean(KEY_UNMETERED_NR_NSA_BOOL, false);
sDefaults.putBoolean(KEY_UNMETERED_NR_NSA_MMWAVE_BOOL, false);
sDefaults.putBoolean(KEY_UNMETERED_NR_NSA_SUB6_BOOL, false);
diff --git a/telephony/java/android/telephony/DataFailCause.java b/telephony/java/android/telephony/DataFailCause.java
index c8ed82c..4d5b6ac 100644
--- a/telephony/java/android/telephony/DataFailCause.java
+++ b/telephony/java/android/telephony/DataFailCause.java
@@ -1055,6 +1055,20 @@
*/
public static final int HANDOVER_FAILED = 0x10006;
+ /**
+ * Enterprise setup failure: duplicate CID in DataCallResponse.
+ *
+ * @hide
+ */
+ public static final int DUPLICATE_CID = 0x10007;
+
+ /**
+ * Enterprise setup failure: no default data connection set up yet.
+ *
+ * @hide
+ */
+ public static final int NO_DEFAULT_DATA = 0x10008;
+
private static final Map<Integer, String> sFailCauseMap;
static {
sFailCauseMap = new HashMap<>();
@@ -1426,6 +1440,8 @@
sFailCauseMap.put(IPV6_PREFIX_UNAVAILABLE, "IPV6_PREFIX_UNAVAILABLE");
sFailCauseMap.put(HANDOFF_PREFERENCE_CHANGED, "HANDOFF_PREFERENCE_CHANGED");
sFailCauseMap.put(SLICE_REJECTED, "SLICE_REJECTED");
+ sFailCauseMap.put(MATCH_ALL_RULE_NOT_ALLOWED, "MATCH_ALL_RULE_NOT_ALLOWED");
+ sFailCauseMap.put(ALL_MATCHING_RULES_FAILED, "ALL_MATCHING_RULES_FAILED");
sFailCauseMap.put(IWLAN_PDN_CONNECTION_REJECTION, "IWLAN_PDN_CONNECTION_REJECTION");
sFailCauseMap.put(IWLAN_MAX_CONNECTION_REACHED, "IWLAN_MAX_CONNECTION_REACHED");
sFailCauseMap.put(IWLAN_SEMANTIC_ERROR_IN_THE_TFT_OPERATION,
@@ -1481,6 +1497,9 @@
sFailCauseMap.put(UNACCEPTABLE_NETWORK_PARAMETER,
"UNACCEPTABLE_NETWORK_PARAMETER");
sFailCauseMap.put(LOST_CONNECTION, "LOST_CONNECTION");
+ sFailCauseMap.put(HANDOVER_FAILED, "HANDOVER_FAILED");
+ sFailCauseMap.put(DUPLICATE_CID, "DUPLICATE_CID");
+ sFailCauseMap.put(NO_DEFAULT_DATA, "NO_DEFAULT_DATA");
}
private DataFailCause() {
@@ -1580,6 +1599,9 @@
add(RADIO_NOT_AVAILABLE);
add(UNACCEPTABLE_NETWORK_PARAMETER);
add(SIGNAL_LOST);
+ add(DUPLICATE_CID);
+ add(MATCH_ALL_RULE_NOT_ALLOWED);
+ add(ALL_MATCHING_RULES_FAILED);
}
};
}
diff --git a/telephony/java/android/telephony/TelephonyDisplayInfo.java b/telephony/java/android/telephony/TelephonyDisplayInfo.java
index 8778275..2f89bfb 100644
--- a/telephony/java/android/telephony/TelephonyDisplayInfo.java
+++ b/telephony/java/android/telephony/TelephonyDisplayInfo.java
@@ -66,9 +66,26 @@
* {@link TelephonyManager#NETWORK_TYPE_LTE} network and has E-UTRA-NR Dual Connectivity(EN-DC)
* capability or is currently connected to the secondary
* {@link TelephonyManager#NETWORK_TYPE_NR} cellular network on millimeter wave bands.
+ * @deprecated Use{@link #OVERRIDE_NETWORK_TYPE_NR_ADVANCED} instead.
*/
+ @Deprecated
public static final int OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE = 4;
+ /**
+ * Override network type when the device is connected NR cellular network and the data rate is
+ * higher than the generic 5G date rate.
+ * Including but not limited to
+ * <ul>
+ * <li>The device is connected to the NR cellular network on millimeter wave bands. </li>
+ * <li>The device is connected to the specific network which the carrier is using
+ * proprietary means to provide a faster overall data connection than would be otherwise
+ * possible. This may include using other bands unique to the carrier, or carrier
+ * aggregation, for example.</li>
+ * </ul>
+ * One of the use case is that UX can show a different icon, for example, "5G+"
+ */
+ public static final int OVERRIDE_NETWORK_TYPE_NR_ADVANCED = 4;
+
@NetworkType
private final int mNetworkType;
@@ -169,7 +186,7 @@
case OVERRIDE_NETWORK_TYPE_LTE_CA: return "LTE_CA";
case OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO: return "LTE_ADV_PRO";
case OVERRIDE_NETWORK_TYPE_NR_NSA: return "NR_NSA";
- case OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE: return "NR_NSA_MMWAVE";
+ case OVERRIDE_NETWORK_TYPE_NR_ADVANCED: return "NR_NSA_MMWAVE";
default: return "UNKNOWN";
}
}
diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java
index 08f5613..bb90fb1 100644
--- a/telephony/java/android/telephony/data/ApnSetting.java
+++ b/telephony/java/android/telephony/data/ApnSetting.java
@@ -1551,6 +1551,20 @@
}
/**
+ * Converts the APN type bitmask to an array of all APN types
+ * @param apnTypeBitmask bitmask of APN types.
+ * @return int array of APN types
+ * @hide
+ */
+ @NonNull
+ public static int[] getApnTypesFromBitmask(int apnTypeBitmask) {
+ return APN_TYPE_INT_MAP.keySet().stream()
+ .filter(type -> ((apnTypeBitmask & type) == type))
+ .mapToInt(Integer::intValue)
+ .toArray();
+ }
+
+ /**
* Converts the integer representation of APN type to its string representation.
*
* @param apnType APN type as an integer