diff options
| -rw-r--r-- | api/Android.bp | 40 | ||||
| -rw-r--r-- | core/api/current.txt | 3 | ||||
| -rw-r--r-- | core/jni/AndroidRuntime.cpp | 5 | ||||
| -rw-r--r-- | services/core/java/com/android/server/am/CachedAppOptimizer.java | 60 | ||||
| -rw-r--r-- | services/core/jni/Android.bp | 2 | ||||
| -rw-r--r-- | services/core/jni/com_android_server_am_CachedAppOptimizer.cpp | 189 | ||||
| -rw-r--r-- | telephony/java/android/telephony/Annotation.java | 2 | ||||
| -rw-r--r-- | telephony/java/android/telephony/CarrierConfigManager.java | 13 | ||||
| -rw-r--r-- | telephony/java/android/telephony/DataFailCause.java | 22 | ||||
| -rw-r--r-- | telephony/java/android/telephony/TelephonyDisplayInfo.java | 19 | ||||
| -rw-r--r-- | telephony/java/android/telephony/data/ApnSetting.java | 14 |
11 files changed, 313 insertions, 56 deletions
diff --git a/api/Android.bp b/api/Android.bp index 438e7dc29b22..6dc177e62290 100644 --- a/api/Android.bp +++ b/api/Android.bp @@ -65,7 +65,10 @@ genrule { dest: "current.txt", }, { - targets: ["sdk", "win_sdk"], + targets: [ + "sdk", + "win_sdk", + ], dir: "apistubs/android/public/api", dest: "android.txt", }, @@ -139,7 +142,10 @@ genrule { dest: "removed.txt", }, { - targets: ["sdk", "win_sdk"], + targets: [ + "sdk", + "win_sdk", + ], dir: "apistubs/android/public/api", dest: "removed.txt", }, @@ -171,7 +177,10 @@ genrule { dest: "system-current.txt", }, { - targets: ["sdk", "win_sdk"], + targets: [ + "sdk", + "win_sdk", + ], dir: "apistubs/android/system/api", dest: "android.txt", }, @@ -222,7 +231,10 @@ genrule { dest: "system-removed.txt", }, { - targets: ["sdk", "win_sdk"], + targets: [ + "sdk", + "win_sdk", + ], dir: "apistubs/android/system/api", dest: "removed.txt", }, @@ -255,7 +267,10 @@ genrule { dest: "module-lib-current.txt", }, { - targets: ["sdk", "win_sdk"], + targets: [ + "sdk", + "win_sdk", + ], dir: "apistubs/android/module-lib/api", dest: "android.txt", }, @@ -308,7 +323,10 @@ genrule { dest: "module-lib-removed.txt", }, { - targets: ["sdk", "win_sdk"], + targets: [ + "sdk", + "win_sdk", + ], dir: "apistubs/android/module-lib/api", dest: "removed.txt", }, @@ -348,7 +366,10 @@ genrule { dest: "system-server-current.txt", }, { - targets: ["sdk", "win_sdk"], + targets: [ + "sdk", + "win_sdk", + ], dir: "apistubs/android/system-server/api", dest: "android.txt", }, @@ -371,7 +392,10 @@ genrule { dest: "system-server-removed.txt", }, { - targets: ["sdk", "win_sdk"], + targets: [ + "sdk", + "win_sdk", + ], dir: "apistubs/android/system-server/api", dest: "removed.txt", }, diff --git a/core/api/current.txt b/core/api/current.txt index e32f07b53187..536c11855458 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -40984,8 +40984,9 @@ package android.telephony { 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 114f3955fc86..1f15dfd1eb1c 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -631,6 +631,8 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote, bool p 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 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote, bool p 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 36d4a38c1624..8e259b5f5075 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 @@ public final class CachedAppOptimizer { // 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 @@ public final class CachedAppOptimizer { 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 @@ public final class CachedAppOptimizer { @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 @@ public final class CachedAppOptimizer { 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 @@ public final class CachedAppOptimizer { 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 @@ public final class CachedAppOptimizer { 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 @@ public final class CachedAppOptimizer { // 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 d0bd8b3e1ae2..a0c96f0f19b8 100644 --- a/services/core/jni/Android.bp +++ b/services/core/jni/Android.bp @@ -74,6 +74,7 @@ cc_library_static { "frameworks/base/libs", "frameworks/native/services", "system/gatekeeper/include", + "system/memory/libmeminfo/include", ], header_libs: [ @@ -111,6 +112,7 @@ cc_defaults { "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 678308af34ea..af3948bd7ce2 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 @@ static void com_android_server_am_CachedAppOptimizer_compactSystem(JNIEnv *, job 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 jint com_android_server_am_CachedAppOptimizer_getBinderFreezeInfo(JNIEnv } 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 4a53a8023792..4ae11b8458cb 100644 --- a/telephony/java/android/telephony/Annotation.java +++ b/telephony/java/android/telephony/Annotation.java @@ -648,7 +648,7 @@ public class Annotation { 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 15ad5bc7864e..f96c2434d319 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -3388,6 +3388,16 @@ public class CarrierConfigManager { "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 @@ public class CarrierConfigManager { "+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 @@ public class CarrierConfigManager { 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 c8ed82cd2a3f..4d5b6ace39ab 100644 --- a/telephony/java/android/telephony/DataFailCause.java +++ b/telephony/java/android/telephony/DataFailCause.java @@ -1055,6 +1055,20 @@ public final class DataFailCause { */ 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 @@ public final class DataFailCause { 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 @@ public final class DataFailCause { 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 @@ public final class DataFailCause { 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 877827578760..2f89bfb60d3d 100644 --- a/telephony/java/android/telephony/TelephonyDisplayInfo.java +++ b/telephony/java/android/telephony/TelephonyDisplayInfo.java @@ -66,9 +66,26 @@ public final class TelephonyDisplayInfo implements Parcelable { * {@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 @@ public final class TelephonyDisplayInfo implements Parcelable { 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 08f56132121e..bb90fb17f4bb 100644 --- a/telephony/java/android/telephony/data/ApnSetting.java +++ b/telephony/java/android/telephony/data/ApnSetting.java @@ -1551,6 +1551,20 @@ public class ApnSetting implements Parcelable { } /** + * 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 |