Merge "[RCS]Add OMA cpm filetransfer feature tag"
diff --git a/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__arm_CtsShimPriv_apk.asciipb b/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__arm_CtsShimPriv_apk.asciipb
index cfcb4e7..80317e4 100644
--- a/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__arm_CtsShimPriv_apk.asciipb
+++ b/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__arm_CtsShimPriv_apk.asciipb
@@ -1,6 +1,6 @@
drops {
android_build_drop {
- build_id: "7351002"
+ build_id: "7396576"
target: "CtsShim"
source_file: "aosp_arm64/CtsShimPriv.apk"
}
@@ -9,4 +9,5 @@
version_group: ""
git_project: "platform/frameworks/base"
git_branch: "sc-dev"
+ transform: TRANSFORM_NONE
}
diff --git a/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__arm_CtsShim_apk.asciipb b/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__arm_CtsShim_apk.asciipb
index 0948e47..3605b6d 100644
--- a/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__arm_CtsShim_apk.asciipb
+++ b/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__arm_CtsShim_apk.asciipb
@@ -1,6 +1,6 @@
drops {
android_build_drop {
- build_id: "7351002"
+ build_id: "7396576"
target: "CtsShim"
source_file: "aosp_arm64/CtsShim.apk"
}
@@ -9,4 +9,5 @@
version_group: ""
git_project: "platform/frameworks/base"
git_branch: "sc-dev"
+ transform: TRANSFORM_NONE
}
diff --git a/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__x86_CtsShimPriv_apk.asciipb b/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__x86_CtsShimPriv_apk.asciipb
index db64475..025ec3a 100644
--- a/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__x86_CtsShimPriv_apk.asciipb
+++ b/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__x86_CtsShimPriv_apk.asciipb
@@ -1,6 +1,6 @@
drops {
android_build_drop {
- build_id: "7351002"
+ build_id: "7396576"
target: "CtsShim"
source_file: "aosp_x86_64/CtsShimPriv.apk"
}
@@ -9,4 +9,5 @@
version_group: ""
git_project: "platform/frameworks/base"
git_branch: "sc-dev"
+ transform: TRANSFORM_NONE
}
diff --git a/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__x86_CtsShim_apk.asciipb b/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__x86_CtsShim_apk.asciipb
index 80812df..e19235a 100644
--- a/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__x86_CtsShim_apk.asciipb
+++ b/.prebuilt_info/prebuilt_info_packages_CtsShim_apk__x86_CtsShim_apk.asciipb
@@ -1,6 +1,6 @@
drops {
android_build_drop {
- build_id: "7351002"
+ build_id: "7396576"
target: "CtsShim"
source_file: "aosp_x86_64/CtsShim.apk"
}
@@ -9,4 +9,5 @@
version_group: ""
git_project: "platform/frameworks/base"
git_branch: "sc-dev"
+ transform: TRANSFORM_NONE
}
diff --git a/Android.bp b/Android.bp
index 05c852ee..1c4f628 100644
--- a/Android.bp
+++ b/Android.bp
@@ -416,7 +416,7 @@
],
libs: [
"framework-annotations-lib",
- "framework-connectivity",
+ "framework-connectivity.stubs.module_lib",
"unsupportedappusage",
],
visibility: [
diff --git a/StubLibraries.bp b/StubLibraries.bp
index e194c47..5f42019 100644
--- a/StubLibraries.bp
+++ b/StubLibraries.bp
@@ -54,7 +54,7 @@
},
api_lint: {
enabled: true,
- new_since: ":android-non-updatable.api.public.latest",
+ new_since: ":android.api.public.latest",
},
},
dists: [
@@ -109,7 +109,7 @@
},
api_lint: {
enabled: true,
- new_since: ":android-non-updatable.api.system.latest",
+ new_since: ":android.api.system.latest",
baseline_file: "core/api/system-lint-baseline.txt",
},
},
@@ -204,7 +204,7 @@
},
api_lint: {
enabled: true,
- new_since: ":android-non-updatable.api.module-lib.latest",
+ new_since: ":android.api.module-lib.latest",
},
},
dists: [
diff --git a/apex/appsearch/OWNERS b/apex/appsearch/OWNERS
index ce0c212..1703369 100644
--- a/apex/appsearch/OWNERS
+++ b/apex/appsearch/OWNERS
@@ -1 +1,3 @@
+adorokhine@google.com
sudheersai@google.com
+yamasani@google.com
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/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java
index ac00a04..f1ba8dc 100644
--- a/core/java/android/accessibilityservice/AccessibilityService.java
+++ b/core/java/android/accessibilityservice/AccessibilityService.java
@@ -100,14 +100,14 @@
* An accessibility is declared as any other service in an AndroidManifest.xml, but it
* must do two things:
* <ul>
- * <ol>
+ * <li>
* Specify that it handles the "android.accessibilityservice.AccessibilityService"
* {@link android.content.Intent}.
- * </ol>
- * <ol>
+ * </li>
+ * <li>
* Request the {@link android.Manifest.permission#BIND_ACCESSIBILITY_SERVICE} permission to
* ensure that only the system can bind to it.
- * </ol>
+ * </li>
* </ul>
* If either of these items is missing, the system will ignore the accessibility service.
* Following is an example declaration:
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 71cc11b..b087054 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -1123,7 +1123,7 @@
InetAddress.clearDnsCache();
// Allow libcore to perform the necessary actions as it sees fit upon a network
// configuration change.
- NetworkEventDispatcher.getInstance().onNetworkConfigurationChanged();
+ NetworkEventDispatcher.getInstance().dispatchNetworkConfigurationChange();
}
public void updateHttpProxy() {
diff --git a/core/java/android/content/pm/PackagePartitions.java b/core/java/android/content/pm/PackagePartitions.java
index 98a20f7..4eb991c 100644
--- a/core/java/android/content/pm/PackagePartitions.java
+++ b/core/java/android/content/pm/PackagePartitions.java
@@ -119,6 +119,9 @@
@Nullable
private final DeferredCanonicalFile mOverlayFolder;
+ @NonNull
+ private final File mNonConicalFolder;
+
private SystemPartition(@NonNull File folder, @PartitionType int type,
boolean containsPrivApp, boolean containsOverlay) {
this.type = type;
@@ -128,6 +131,7 @@
: null;
this.mOverlayFolder = containsOverlay ? new DeferredCanonicalFile(folder, "overlay")
: null;
+ this.mNonConicalFolder = folder;
}
public SystemPartition(@NonNull SystemPartition original) {
@@ -136,6 +140,7 @@
this.mAppFolder = original.mAppFolder;
this.mPrivAppFolder = original.mPrivAppFolder;
this.mOverlayFolder = original.mOverlayFolder;
+ this.mNonConicalFolder = original.mNonConicalFolder;
}
/**
@@ -153,6 +158,12 @@
return mFolder.getFile();
}
+ /** Returns the non-canonical folder of the partition. */
+ @NonNull
+ public File getNonConicalFolder() {
+ return mNonConicalFolder;
+ }
+
/** Returns the canonical app folder of the partition. */
@Nullable
public File getAppFolder() {
diff --git a/core/java/android/net/NetworkTemplate.java b/core/java/android/net/NetworkTemplate.java
index 352f2e9..68917a8 100644
--- a/core/java/android/net/NetworkTemplate.java
+++ b/core/java/android/net/NetworkTemplate.java
@@ -514,6 +514,10 @@
return mSubscriberIdMatchRule;
}
+ public int getMeteredness() {
+ return mMetered;
+ }
+
/**
* Test if given {@link NetworkIdentity} matches this template.
*/
diff --git a/core/java/android/widget/OWNERS b/core/java/android/widget/OWNERS
index 64570a8..e1d6012 100644
--- a/core/java/android/widget/OWNERS
+++ b/core/java/android/widget/OWNERS
@@ -8,6 +8,6 @@
mount@google.com
njawad@google.com
-per-file TextView.java, EditText.java, Editor.java = siyamed@google.com, nona@google.com, clarabayarri@google.com
+per-file TextView*, EditText.java, Editor.java = siyamed@google.com, nona@google.com, clarabayarri@google.com
per-file SpellChecker.java = file:../view/inputmethod/OWNERS
diff --git a/core/java/com/android/internal/content/om/OverlayConfig.java b/core/java/com/android/internal/content/om/OverlayConfig.java
index 3b5cf48..c36e37a 100644
--- a/core/java/com/android/internal/content/om/OverlayConfig.java
+++ b/core/java/com/android/internal/content/om/OverlayConfig.java
@@ -111,7 +111,7 @@
// Rebase the system partitions and settings file on the specified root directory.
partitions = new ArrayList<>(PackagePartitions.getOrderedPartitions(
p -> new OverlayPartition(
- new File(rootDirectory, p.getFolder().getPath()),
+ new File(rootDirectory, p.getNonConicalFolder().getPath()),
p)));
}
diff --git a/core/jni/Android.bp b/core/jni/Android.bp
index 382acc0..b236385 100644
--- a/core/jni/Android.bp
+++ b/core/jni/Android.bp
@@ -227,6 +227,7 @@
shared_libs: [
"android.hardware.memtrack-V1-ndk_platform",
"libandroidicu",
+ "libandroid_net",
"libbpf_android",
"libnetdbpf",
"libnetdutils",
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/core/jni/OWNERS b/core/jni/OWNERS
index a3287c1..701960e 100644
--- a/core/jni/OWNERS
+++ b/core/jni/OWNERS
@@ -68,6 +68,7 @@
# These are highly common-use files
per-file Android.bp = file:/graphics/java/android/graphics/OWNERS
per-file AndroidRuntime.cpp = file:/graphics/java/android/graphics/OWNERS
+per-file AndroidRuntime.cpp = calin@google.com, ngeoffray@google.com, oth@google.com
# Although marked "view" this is mostly graphics stuff
per-file android_view_* = file:/graphics/java/android/graphics/OWNERS
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 4a57448..8db1bbf 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -575,8 +575,6 @@
<protected-broadcast android:name="android.intent.action.DYNAMIC_SENSOR_CHANGED" />
- <protected-broadcast android:name="android.intent.action.ACTION_RADIO_OFF" />
-
<protected-broadcast android:name="android.accounts.LOGIN_ACCOUNTS_CHANGED" />
<protected-broadcast android:name="android.accounts.action.ACCOUNT_REMOVED" />
<protected-broadcast android:name="android.accounts.action.VISIBLE_ACCOUNTS_CHANGED" />
diff --git a/core/res/res/xml/sms_short_codes.xml b/core/res/res/xml/sms_short_codes.xml
index 2650d9f..2be5c47 100644
--- a/core/res/res/xml/sms_short_codes.xml
+++ b/core/res/res/xml/sms_short_codes.xml
@@ -245,6 +245,9 @@
<!-- Slovakia: 4 digits (premium), plus EU: http://www.cmtelecom.com/premium-sms/slovakia -->
<shortcode country="sk" premium="\\d{4}" free="116\\d{3}|8000" />
+ <!-- Taiwan -->
+ <shortcode country="tw" pattern="\\d{4}" free="1922" />
+
<!-- Thailand: 4186001 used by AIS_TH_DCB -->
<shortcode country="th" pattern="\\d{1,5}" premium="4\\d{6}" free="4186001" />
diff --git a/data/etc/Android.bp b/data/etc/Android.bp
index d0e2474..e7c8f9d 100644
--- a/data/etc/Android.bp
+++ b/data/etc/Android.bp
@@ -119,6 +119,20 @@
}
prebuilt_etc {
+ name: "privapp_whitelist_com.android.networkstack",
+ sub_dir: "permissions",
+ src: "com.android.networkstack.xml",
+ filename_from_src: true,
+}
+
+prebuilt_etc {
+ name: "privapp_whitelist_com.android.networkstack.tethering",
+ sub_dir: "permissions",
+ src: "com.android.networkstack.tethering.xml",
+ filename_from_src: true,
+}
+
+prebuilt_etc {
name: "privapp_whitelist_com.android.provision",
system_ext_specific: true,
sub_dir: "permissions",
diff --git a/data/etc/com.android.networkstack.tethering.xml b/data/etc/com.android.networkstack.tethering.xml
new file mode 100644
index 0000000..f26a961
--- /dev/null
+++ b/data/etc/com.android.networkstack.tethering.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2021 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+-->
+
+<permissions>
+ <privapp-permissions package="com.android.networkstack.tethering">
+ <permission name="android.permission.BLUETOOTH_PRIVILEGED" />
+ <permission name="android.permission.MANAGE_USB"/>
+ <permission name="android.permission.MODIFY_PHONE_STATE"/>
+ <permission name="android.permission.READ_NETWORK_USAGE_HISTORY"/>
+ <permission name="android.permission.TETHER_PRIVILEGED"/>
+ <permission name="android.permission.UPDATE_APP_OPS_STATS"/>
+ <permission name="android.permission.UPDATE_DEVICE_STATS"/>
+ </privapp-permissions>
+</permissions>
diff --git a/data/etc/com.android.networkstack.xml b/data/etc/com.android.networkstack.xml
new file mode 100644
index 0000000..06fec1c
--- /dev/null
+++ b/data/etc/com.android.networkstack.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2021 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+-->
+
+<permissions>
+ <privapp-permissions package="com.android.networkstack">
+ <permission name="android.permission.ACCESS_NETWORK_CONDITIONS"/>
+ <permission name="android.permission.CONNECTIVITY_INTERNAL"/>
+ <permission name="android.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS"/>
+ <permission name="android.permission.CONTROL_VPN"/>
+ <permission name="android.permission.INTERACT_ACROSS_USERS"/>
+ <permission name="android.permission.LOCAL_MAC_ADDRESS"/>
+ <permission name="android.permission.MANAGE_SUBSCRIPTION_PLANS"/>
+ <permission name="android.permission.MANAGE_USB"/>
+ <permission name="android.permission.NETWORK_BYPASS_PRIVATE_DNS"/>
+ <permission name="android.permission.PACKET_KEEPALIVE_OFFLOAD"/>
+ <permission name="android.permission.READ_NETWORK_USAGE_HISTORY"/>
+ <permission name="android.permission.READ_PRECISE_PHONE_STATE"/>
+ <permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
+ <permission name="android.permission.READ_WIFI_CREDENTIAL"/>
+ <permission name="android.permission.RECEIVE_DATA_ACTIVITY_CHANGE"/>
+ <permission name="android.permission.TETHER_PRIVILEGED"/>
+ <permission name="android.permission.WRITE_SECURE_SETTINGS"/>
+ </privapp-permissions>
+</permissions>
diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml
index f858e52..4731a8e 100644
--- a/data/etc/privapp-permissions-platform.xml
+++ b/data/etc/privapp-permissions-platform.xml
@@ -254,36 +254,6 @@
<permission name="android.permission.READ_COMPAT_CHANGE_CONFIG" />
</privapp-permissions>
- <privapp-permissions package="com.android.networkstack">
- <permission name="android.permission.ACCESS_NETWORK_CONDITIONS"/>
- <permission name="android.permission.CONNECTIVITY_INTERNAL"/>
- <permission name="android.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS"/>
- <permission name="android.permission.CONTROL_VPN"/>
- <permission name="android.permission.INTERACT_ACROSS_USERS"/>
- <permission name="android.permission.LOCAL_MAC_ADDRESS"/>
- <permission name="android.permission.MANAGE_SUBSCRIPTION_PLANS"/>
- <permission name="android.permission.MANAGE_USB"/>
- <permission name="android.permission.NETWORK_BYPASS_PRIVATE_DNS"/>
- <permission name="android.permission.PACKET_KEEPALIVE_OFFLOAD"/>
- <permission name="android.permission.READ_NETWORK_USAGE_HISTORY"/>
- <permission name="android.permission.READ_PRECISE_PHONE_STATE"/>
- <permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
- <permission name="android.permission.READ_WIFI_CREDENTIAL"/>
- <permission name="android.permission.RECEIVE_DATA_ACTIVITY_CHANGE"/>
- <permission name="android.permission.TETHER_PRIVILEGED"/>
- <permission name="android.permission.WRITE_SECURE_SETTINGS"/>
- </privapp-permissions>
-
- <privapp-permissions package="com.android.networkstack.tethering">
- <permission name="android.permission.BLUETOOTH_PRIVILEGED" />
- <permission name="android.permission.MANAGE_USB"/>
- <permission name="android.permission.MODIFY_PHONE_STATE"/>
- <permission name="android.permission.READ_NETWORK_USAGE_HISTORY"/>
- <permission name="android.permission.TETHER_PRIVILEGED"/>
- <permission name="android.permission.UPDATE_APP_OPS_STATS"/>
- <permission name="android.permission.UPDATE_DEVICE_STATS"/>
- </privapp-permissions>
-
<privapp-permissions package="com.android.server.telecom">
<permission name="android.permission.BIND_CONNECTION_SERVICE"/>
<permission name="android.permission.BIND_INCALL_SERVICE"/>
diff --git a/libs/usb/Android.bp b/libs/usb/Android.bp
index edc8474..e685a73 100644
--- a/libs/usb/Android.bp
+++ b/libs/usb/Android.bp
@@ -28,4 +28,5 @@
name: "com.android.future.usb.accessory",
srcs: ["src/**/*.java"],
api_packages: ["com.android.future.usb"],
+ dist_group: "android",
}
diff --git a/location/lib/Android.bp b/location/lib/Android.bp
index 5cd5a59..f99c59c 100644
--- a/location/lib/Android.bp
+++ b/location/lib/Android.bp
@@ -30,4 +30,5 @@
"androidx.annotation_annotation",
],
api_packages: ["com.android.location.provider"],
+ dist_group: "android",
}
diff --git a/media/jni/android_media_tv_Tuner.cpp b/media/jni/android_media_tv_Tuner.cpp
index 49ef504..f7b0fb5 100644
--- a/media/jni/android_media_tv_Tuner.cpp
+++ b/media/jni/android_media_tv_Tuner.cpp
@@ -3094,7 +3094,7 @@
r = iFilterSp->setDataSource(NULL);
} else {
sp<IFilter> srcSp = getFilter(env, srcFilter)->getIFilter();
- if (iFilterSp == NULL) {
+ if (srcSp == NULL) {
ALOGD("Failed to set filter data source: src filter not found");
return (jint) Result::INVALID_ARGUMENT;
}
diff --git a/media/lib/remotedisplay/Android.bp b/media/lib/remotedisplay/Android.bp
index bfb0cb8..e1d7cae 100644
--- a/media/lib/remotedisplay/Android.bp
+++ b/media/lib/remotedisplay/Android.bp
@@ -27,4 +27,5 @@
name: "com.android.media.remotedisplay",
srcs: ["java/**/*.java"],
api_packages: ["com.android.media.remotedisplay"],
+ dist_group: "android",
}
diff --git a/media/lib/signer/Android.bp b/media/lib/signer/Android.bp
index 6504176..65a6073a4 100644
--- a/media/lib/signer/Android.bp
+++ b/media/lib/signer/Android.bp
@@ -27,4 +27,5 @@
name: "com.android.mediadrm.signer",
srcs: ["java/**/*.java"],
api_packages: ["com.android.mediadrm.signer"],
+ dist_group: "android",
}
diff --git a/media/lib/tvremote/Android.bp b/media/lib/tvremote/Android.bp
index 5f9185a..1f3401f 100644
--- a/media/lib/tvremote/Android.bp
+++ b/media/lib/tvremote/Android.bp
@@ -29,5 +29,6 @@
api_packages: ["com.android.media.tv.remoteprovider"],
dex_preopt: {
enabled: false,
- }
+ },
+ dist_group: "android",
}
diff --git a/native/android/libandroid.map.txt b/native/android/libandroid.map.txt
index d56aa86..33c4c40 100644
--- a/native/android/libandroid.map.txt
+++ b/native/android/libandroid.map.txt
@@ -274,7 +274,10 @@
ATrace_endAsyncSection; # introduced=29
ATrace_setCounter; # introduced=29
android_getaddrinfofornetwork; # introduced=23
+ android_getprocnetwork; # introduced=31
android_setprocnetwork; # introduced=23
+ android_getprocdns; # introduced=31
+ android_setprocdns; # introduced=31
android_setsocknetwork; # introduced=23
android_res_cancel; # introduced=29
android_res_nquery; # introduced=29
diff --git a/native/android/libandroid_net.map.txt b/native/android/libandroid_net.map.txt
index 8d4e900..a6c1b50 100644
--- a/native/android/libandroid_net.map.txt
+++ b/native/android/libandroid_net.map.txt
@@ -14,6 +14,10 @@
android_res_nquery; # llndk
android_res_nresult; # llndk
android_res_nsend; # llndk
+ # These functions have been part of the NDK since API 31.
+ android_getprocnetwork; # llndk
+ android_setprocdns; # llndk
+ android_getprocdns; # llndk
local:
*;
};
diff --git a/native/android/net.c b/native/android/net.c
index a8104fc..e2f36a7 100644
--- a/native/android/net.c
+++ b/native/android/net.c
@@ -22,12 +22,13 @@
#include <stdlib.h>
#include <sys/limits.h>
+// This value MUST be kept in sync with the corresponding value in
+// the android.net.Network#getNetworkHandle() implementation.
+static const uint32_t kHandleMagic = 0xcafed00d;
+static const uint32_t kHandleMagicSize = 32;
static int getnetidfromhandle(net_handle_t handle, unsigned *netid) {
static const uint32_t k32BitMask = 0xffffffff;
- // This value MUST be kept in sync with the corresponding value in
- // the android.net.Network#getNetworkHandle() implementation.
- static const uint32_t kHandleMagic = 0xcafed00d;
// Check for minimum acceptable version of the API in the low bits.
if (handle != NETWORK_UNSPECIFIED &&
@@ -41,6 +42,12 @@
return 1;
}
+static net_handle_t gethandlefromnetid(unsigned netid) {
+ if (netid == NETID_UNSET) {
+ return NETWORK_UNSPECIFIED;
+ }
+ return (((net_handle_t) netid) << kHandleMagicSize) | kHandleMagic;
+}
int android_setsocknetwork(net_handle_t network, int fd) {
unsigned netid;
@@ -72,6 +79,49 @@
return rval;
}
+int android_getprocnetwork(net_handle_t *network) {
+ if (network == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ unsigned netid = getNetworkForProcess();
+ *network = gethandlefromnetid(netid);
+ return 0;
+}
+
+int android_setprocdns(net_handle_t network) {
+ unsigned netid;
+ if (!getnetidfromhandle(network, &netid)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ int rval = setNetworkForResolv(netid);
+ if (rval < 0) {
+ errno = -rval;
+ rval = -1;
+ }
+ return rval;
+}
+
+int android_getprocdns(net_handle_t *network) {
+ if (network == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ unsigned netid;
+ int rval = getNetworkForDns(&netid);
+ if (rval < 0) {
+ errno = -rval;
+ return -1;
+ }
+
+ *network = gethandlefromnetid(netid);
+ return 0;
+}
+
int android_getaddrinfofornetwork(net_handle_t network,
const char *node, const char *service,
const struct addrinfo *hints, struct addrinfo **res) {
diff --git a/nfc-extras/Android.bp b/nfc-extras/Android.bp
index 43b2830..cb9ac6f 100644
--- a/nfc-extras/Android.bp
+++ b/nfc-extras/Android.bp
@@ -27,4 +27,5 @@
name: "com.android.nfc_extras",
srcs: ["java/**/*.java"],
api_packages: ["com.android.nfc_extras"],
+ dist_group: "android",
}
diff --git a/obex/Android.bp b/obex/Android.bp
index 95eac81..37e7f76 100644
--- a/obex/Android.bp
+++ b/obex/Android.bp
@@ -48,4 +48,5 @@
name: "javax.obex",
srcs: ["javax/**/*.java"],
api_packages: ["javax.obex"],
+ dist_group: "android",
}
diff --git a/packages/CtsShim/apk/arm/CtsShim.apk b/packages/CtsShim/apk/arm/CtsShim.apk
index ca69a28..bb6dfa3 100644
--- a/packages/CtsShim/apk/arm/CtsShim.apk
+++ b/packages/CtsShim/apk/arm/CtsShim.apk
Binary files differ
diff --git a/packages/CtsShim/apk/arm/CtsShimPriv.apk b/packages/CtsShim/apk/arm/CtsShimPriv.apk
index d7cfb96..2835d57 100644
--- a/packages/CtsShim/apk/arm/CtsShimPriv.apk
+++ b/packages/CtsShim/apk/arm/CtsShimPriv.apk
Binary files differ
diff --git a/packages/CtsShim/apk/x86/CtsShim.apk b/packages/CtsShim/apk/x86/CtsShim.apk
index ca69a28..bb6dfa3 100644
--- a/packages/CtsShim/apk/x86/CtsShim.apk
+++ b/packages/CtsShim/apk/x86/CtsShim.apk
Binary files differ
diff --git a/packages/CtsShim/apk/x86/CtsShimPriv.apk b/packages/CtsShim/apk/x86/CtsShimPriv.apk
index 84c3401..2e1a789 100644
--- a/packages/CtsShim/apk/x86/CtsShimPriv.apk
+++ b/packages/CtsShim/apk/x86/CtsShimPriv.apk
Binary files differ
diff --git a/packages/SettingsLib/src/com/android/settingslib/net/DataUsageUtils.java b/packages/SettingsLib/src/com/android/settingslib/net/DataUsageUtils.java
index b1234f2..51e533a 100644
--- a/packages/SettingsLib/src/com/android/settingslib/net/DataUsageUtils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/net/DataUsageUtils.java
@@ -73,6 +73,7 @@
private static NetworkTemplate getMobileTemplateForSubId(
TelephonyManager telephonyManager, int subId) {
- return NetworkTemplate.buildTemplateMobileAll(telephonyManager.getSubscriberId(subId));
+ return NetworkTemplate.buildTemplateCarrierMetered(
+ telephonyManager.getSubscriberId(subId));
}
}
diff --git a/packages/SettingsLib/tests/integ/src/com/android/settingslib/utils/NetworkPolicyEditorTest.java b/packages/SettingsLib/tests/integ/src/com/android/settingslib/utils/NetworkPolicyEditorTest.java
index 37f2600..7e389a1 100644
--- a/packages/SettingsLib/tests/integ/src/com/android/settingslib/utils/NetworkPolicyEditorTest.java
+++ b/packages/SettingsLib/tests/integ/src/com/android/settingslib/utils/NetworkPolicyEditorTest.java
@@ -44,7 +44,7 @@
@Before
public void setUp() {
- mNetworkTemplate = NetworkTemplate.buildTemplateMobileAll("123456789123456");
+ mNetworkTemplate = NetworkTemplate.buildTemplateCarrierMetered("123456789123456");
NetworkPolicyManager policyManager = NetworkPolicyManager.from(InstrumentationRegistry
.getContext());
mNetworkPolicyEditor = new NetworkPolicyEditor(policyManager);
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageControllerTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageControllerTest.java
index 27d877d..9be783d 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageControllerTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageControllerTest.java
@@ -87,8 +87,8 @@
ShadowSubscriptionManager.setDefaultDataSubscriptionId(mDefaultSubscriptionId);
doReturn(SUB_ID).when(mTelephonyManager).getSubscriberId();
- mNetworkTemplate = NetworkTemplate.buildTemplateMobileAll(SUB_ID);
- mNetworkTemplate2 = NetworkTemplate.buildTemplateMobileAll(SUB_ID_2);
+ mNetworkTemplate = NetworkTemplate.buildTemplateCarrierMetered(SUB_ID);
+ mNetworkTemplate2 = NetworkTemplate.buildTemplateCarrierMetered(SUB_ID_2);
mWifiNetworkTemplate = NetworkTemplate.buildTemplateWifi(
NetworkTemplate.WIFI_NETWORKID_ALL, null);
}
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/NetworkCycleDataForUidLoaderTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/NetworkCycleDataForUidLoaderTest.java
index 877eb61..e8d5844 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/NetworkCycleDataForUidLoaderTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/NetworkCycleDataForUidLoaderTest.java
@@ -62,7 +62,7 @@
when(mContext.getSystemService(Context.NETWORK_POLICY_SERVICE))
.thenReturn(mNetworkPolicyManager);
when(mNetworkPolicyManager.getNetworkPolicies()).thenReturn(new NetworkPolicy[0]);
- mNetworkTemplate = NetworkTemplate.buildTemplateMobileAll(SUB_ID);
+ mNetworkTemplate = NetworkTemplate.buildTemplateCarrierMetered(SUB_ID);
}
@Test
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index 992ef26..12a94e1 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -601,8 +601,12 @@
}
// waive WRITE_SECURE_SETTINGS permission check
long callingIdentity = Binder.clearCallingIdentity();
- Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.BLUETOOTH_ON, value);
- Binder.restoreCallingIdentity(callingIdentity);
+ try {
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.BLUETOOTH_ON, value);
+ } finally {
+ Binder.restoreCallingIdentity(callingIdentity);
+ }
}
/**
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/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java
index 07ac14f..aba9615 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsService.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java
@@ -105,6 +105,7 @@
import android.security.keystore2.AndroidKeyStoreProvider;
import android.service.gatekeeper.GateKeeperResponse;
import android.service.gatekeeper.IGateKeeperService;
+import android.system.keystore2.Domain;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.ArraySet;
@@ -253,8 +254,7 @@
* The UIDs that are used for system credential storage in keystore.
*/
private static final int[] SYSTEM_CREDENTIAL_UIDS = {
- Process.WIFI_UID, Process.VPN_UID,
- Process.ROOT_UID, Process.SYSTEM_UID };
+ Process.VPN_UID, Process.ROOT_UID, Process.SYSTEM_UID};
// This class manages life cycle events for encrypted users on File Based Encryption (FBE)
// devices. The most basic of these is to show/hide notifications about missing features until
@@ -1987,9 +1987,14 @@
// Clear all the users credentials could have been installed in for this user.
for (int profileId : mUserManager.getProfileIdsWithDisabled(userId)) {
for (int uid : SYSTEM_CREDENTIAL_UIDS) {
- mKeyStore.clearUid(UserHandle.getUid(profileId, uid));
+ AndroidKeyStoreMaintenance.clearNamespace(Domain.APP,
+ UserHandle.getUid(profileId, uid));
}
}
+ if (mUserManager.getUserInfo(userId).isPrimary()) {
+ AndroidKeyStoreMaintenance.clearNamespace(Domain.SELINUX,
+ KeyProperties.NAMESPACE_WIFI);
+ }
} finally {
if (managedUserId != -1 && managedUserDecryptedPassword != null) {
if (DEBUG) Slog.v(TAG, "Restore tied profile lock");
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index d0da912..9fb5f04 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -97,8 +97,12 @@
import static android.net.NetworkPolicyManager.uidPoliciesToString;
import static android.net.NetworkPolicyManager.uidRulesToString;
import static android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK;
+import static android.net.NetworkStats.METERED_ALL;
+import static android.net.NetworkStats.METERED_YES;
+import static android.net.NetworkTemplate.MATCH_CARRIER;
import static android.net.NetworkTemplate.MATCH_MOBILE;
import static android.net.NetworkTemplate.MATCH_WIFI;
+import static android.net.NetworkTemplate.buildTemplateCarrierMetered;
import static android.net.NetworkTemplate.buildTemplateMobileAll;
import static android.net.TrafficStats.MB_IN_BYTES;
import static android.net.netstats.provider.NetworkStatsProvider.QUOTA_UNLIMITED;
@@ -350,7 +354,8 @@
private static final int VERSION_SWITCH_UID = 10;
private static final int VERSION_ADDED_CYCLE = 11;
private static final int VERSION_ADDED_NETWORK_TYPES = 12;
- private static final int VERSION_LATEST = VERSION_ADDED_NETWORK_TYPES;
+ private static final int VERSION_SUPPORTED_CARRIER_USAGE = 13;
+ private static final int VERSION_LATEST = VERSION_SUPPORTED_CARRIER_USAGE;
@VisibleForTesting
public static final int TYPE_WARNING = SystemMessage.NOTE_NET_WARNING;
@@ -375,7 +380,9 @@
private static final String ATTR_RESTRICT_BACKGROUND = "restrictBackground";
private static final String ATTR_NETWORK_TEMPLATE = "networkTemplate";
private static final String ATTR_SUBSCRIBER_ID = "subscriberId";
+ private static final String ATTR_SUBSCRIBER_ID_MATCH_RULE = "subscriberIdMatchRule";
private static final String ATTR_NETWORK_ID = "networkId";
+ private static final String ATTR_TEMPLATE_METERED = "templateMetered";
@Deprecated private static final String ATTR_CYCLE_DAY = "cycleDay";
@Deprecated private static final String ATTR_CYCLE_TIMEZONE = "cycleTimezone";
private static final String ATTR_CYCLE_START = "cycleStart";
@@ -1430,7 +1437,7 @@
*/
@GuardedBy("mNetworkPoliciesSecondLock")
private int findRelevantSubIdNL(NetworkTemplate template) {
- // Mobile template is relevant when any active subscriber matches
+ // Carrier template is relevant when any active subscriber matches
for (int i = 0; i < mSubIdToSubscriberId.size(); i++) {
final int subId = mSubIdToSubscriberId.keyAt(i);
final String subscriberId = mSubIdToSubscriberId.valueAt(i);
@@ -1508,6 +1515,7 @@
}
case TYPE_LIMIT: {
switch (policy.template.getMatchRule()) {
+ case MATCH_CARRIER:
case MATCH_MOBILE:
title = res.getText(R.string.data_usage_mobile_limit_title);
break;
@@ -1536,6 +1544,7 @@
}
case TYPE_LIMIT_SNOOZED: {
switch (policy.template.getMatchRule()) {
+ case MATCH_CARRIER:
case MATCH_MOBILE:
title = res.getText(R.string.data_usage_mobile_limit_snoozed_title);
break;
@@ -1632,7 +1641,7 @@
synchronized (mUidRulesFirstLock) {
synchronized (mNetworkPoliciesSecondLock) {
- ensureActiveMobilePolicyAL();
+ ensureActiveCarrierPolicyAL();
normalizePoliciesNL();
updateNetworkEnabledNL();
updateNetworkRulesNL();
@@ -1657,17 +1666,17 @@
}
/**
- * Update mobile policies with data cycle information from {@link CarrierConfigManager}
+ * Update carrier policies with data cycle information from {@link CarrierConfigManager}
* if necessary.
*
* @param subId that has its associated NetworkPolicy updated if necessary
* @return if any policies were updated
*/
@GuardedBy("mNetworkPoliciesSecondLock")
- private boolean maybeUpdateMobilePolicyCycleAL(int subId, String subscriberId) {
- if (LOGV) Slog.v(TAG, "maybeUpdateMobilePolicyCycleAL()");
+ private boolean maybeUpdateCarrierPolicyCycleAL(int subId, String subscriberId) {
+ if (LOGV) Slog.v(TAG, "maybeUpdateCarrierPolicyCycleAL()");
- // find and update the mobile NetworkPolicy for this subscriber id
+ // find and update the carrier NetworkPolicy for this subscriber id
boolean policyUpdated = false;
final NetworkIdentity probeIdent = new NetworkIdentity(TYPE_MOBILE,
TelephonyManager.NETWORK_TYPE_UNKNOWN, subscriberId, null, false, true, true,
@@ -1676,21 +1685,21 @@
final NetworkTemplate template = mNetworkPolicy.keyAt(i);
if (template.matches(probeIdent)) {
final NetworkPolicy policy = mNetworkPolicy.valueAt(i);
- policyUpdated |= updateDefaultMobilePolicyAL(subId, policy);
+ policyUpdated |= updateDefaultCarrierPolicyAL(subId, policy);
}
}
return policyUpdated;
}
/**
- * Returns the cycle day that should be used for a mobile NetworkPolicy.
+ * Returns the cycle day that should be used for a carrier NetworkPolicy.
*
* It attempts to get an appropriate cycle day from the passed in CarrierConfig. If it's unable
* to do so, it returns the fallback value.
*
* @param config The CarrierConfig to read the value from.
* @param fallbackCycleDay to return if the CarrierConfig can't be read.
- * @return cycleDay to use in the mobile NetworkPolicy.
+ * @return cycleDay to use in the carrier NetworkPolicy.
*/
@VisibleForTesting
int getCycleDayFromCarrierConfig(@Nullable PersistableBundle config,
@@ -1715,14 +1724,14 @@
}
/**
- * Returns the warning bytes that should be used for a mobile NetworkPolicy.
+ * Returns the warning bytes that should be used for a carrier NetworkPolicy.
*
* It attempts to get an appropriate value from the passed in CarrierConfig. If it's unable
* to do so, it returns the fallback value.
*
* @param config The CarrierConfig to read the value from.
* @param fallbackWarningBytes to return if the CarrierConfig can't be read.
- * @return warningBytes to use in the mobile NetworkPolicy.
+ * @return warningBytes to use in the carrier NetworkPolicy.
*/
@VisibleForTesting
long getWarningBytesFromCarrierConfig(@Nullable PersistableBundle config,
@@ -1748,14 +1757,14 @@
}
/**
- * Returns the limit bytes that should be used for a mobile NetworkPolicy.
+ * Returns the limit bytes that should be used for a carrier NetworkPolicy.
*
* It attempts to get an appropriate value from the passed in CarrierConfig. If it's unable
* to do so, it returns the fallback value.
*
* @param config The CarrierConfig to read the value from.
* @param fallbackLimitBytes to return if the CarrierConfig can't be read.
- * @return limitBytes to use in the mobile NetworkPolicy.
+ * @return limitBytes to use in the carrier NetworkPolicy.
*/
@VisibleForTesting
long getLimitBytesFromCarrierConfig(@Nullable PersistableBundle config,
@@ -1801,8 +1810,8 @@
synchronized (mNetworkPoliciesSecondLock) {
final String subscriberId = mSubIdToSubscriberId.get(subId, null);
if (subscriberId != null) {
- ensureActiveMobilePolicyAL(subId, subscriberId);
- maybeUpdateMobilePolicyCycleAL(subId, subscriberId);
+ ensureActiveCarrierPolicyAL(subId, subscriberId);
+ maybeUpdateCarrierPolicyCycleAL(subId, subscriberId);
} else {
Slog.wtf(TAG, "Missing subscriberId for subId " + subId);
}
@@ -1888,10 +1897,12 @@
// TODO: reach into ConnectivityManager to proactively disable bringing
// up this network, since we know that traffic will be blocked.
- if (template.getMatchRule() == MATCH_MOBILE) {
- // If mobile data usage hits the limit or if the user resumes the data, we need to
+ if (template.getMatchRule() == MATCH_MOBILE
+ || template.getMatchRule() == MATCH_CARRIER) {
+ // If carrier data usage hits the limit or if the user resumes the data, we need to
// notify telephony.
+ // TODO: It needs to check if it matches the merged WIFI and notify to wifi module.
final IntArray matchingSubIds = new IntArray();
synchronized (mNetworkPoliciesSecondLock) {
for (int i = 0; i < mSubIdToSubscriberId.size(); i++) {
@@ -2151,7 +2162,7 @@
.truncatedTo(ChronoUnit.DAYS)
.toInstant().toEpochMilli();
final long totalBytes = getTotalBytes(
- NetworkTemplate.buildTemplateMobileAll(snapshot.getSubscriberId()),
+ buildTemplateCarrierMetered(snapshot.getSubscriberId()),
start, startOfDay);
final long remainingBytes = limitBytes - totalBytes;
// Number of remaining days including current day
@@ -2177,31 +2188,31 @@
/**
* Once any {@link #mNetworkPolicy} are loaded from disk, ensure that we
- * have at least a default mobile policy defined.
+ * have at least a default carrier policy defined.
*/
@GuardedBy("mNetworkPoliciesSecondLock")
- private void ensureActiveMobilePolicyAL() {
- if (LOGV) Slog.v(TAG, "ensureActiveMobilePolicyAL()");
+ private void ensureActiveCarrierPolicyAL() {
+ if (LOGV) Slog.v(TAG, "ensureActiveCarrierPolicyAL()");
if (mSuppressDefaultPolicy) return;
for (int i = 0; i < mSubIdToSubscriberId.size(); i++) {
final int subId = mSubIdToSubscriberId.keyAt(i);
final String subscriberId = mSubIdToSubscriberId.valueAt(i);
- ensureActiveMobilePolicyAL(subId, subscriberId);
+ ensureActiveCarrierPolicyAL(subId, subscriberId);
}
}
/**
* Once any {@link #mNetworkPolicy} are loaded from disk, ensure that we
- * have at least a default mobile policy defined.
+ * have at least a default carrier policy defined.
*
* @param subId to build a default policy for
* @param subscriberId that we check for an existing policy
- * @return true if a mobile network policy was added, or false one already existed.
+ * @return true if a carrier network policy was added, or false one already existed.
*/
@GuardedBy("mNetworkPoliciesSecondLock")
- private boolean ensureActiveMobilePolicyAL(int subId, String subscriberId) {
+ private boolean ensureActiveCarrierPolicyAL(int subId, String subscriberId) {
// Poke around to see if we already have a policy
final NetworkIdentity probeIdent = new NetworkIdentity(TYPE_MOBILE,
TelephonyManager.NETWORK_TYPE_UNKNOWN, subscriberId, null, false, true, true,
@@ -2220,7 +2231,7 @@
Slog.i(TAG, "No policy for subscriber "
+ NetworkIdentityUtils.scrubSubscriberId(subscriberId)
+ "; generating default policy");
- final NetworkPolicy policy = buildDefaultMobilePolicy(subId, subscriberId);
+ final NetworkPolicy policy = buildDefaultCarrierPolicy(subId, subscriberId);
addNetworkPolicyAL(policy);
return true;
}
@@ -2240,8 +2251,8 @@
}
@VisibleForTesting
- NetworkPolicy buildDefaultMobilePolicy(int subId, String subscriberId) {
- final NetworkTemplate template = buildTemplateMobileAll(subscriberId);
+ NetworkPolicy buildDefaultCarrierPolicy(int subId, String subscriberId) {
+ final NetworkTemplate template = buildTemplateCarrierMetered(subscriberId);
final RecurrenceRule cycleRule = NetworkPolicy
.buildRule(ZonedDateTime.now().getDayOfMonth(), ZoneId.systemDefault());
final NetworkPolicy policy = new NetworkPolicy(template, cycleRule,
@@ -2249,7 +2260,7 @@
SNOOZE_NEVER, SNOOZE_NEVER, true, true);
synchronized (mUidRulesFirstLock) {
synchronized (mNetworkPoliciesSecondLock) {
- updateDefaultMobilePolicyAL(subId, policy);
+ updateDefaultCarrierPolicyAL(subId, policy);
}
}
return policy;
@@ -2263,7 +2274,7 @@
* @return if the policy was modified
*/
@GuardedBy("mNetworkPoliciesSecondLock")
- private boolean updateDefaultMobilePolicyAL(int subId, NetworkPolicy policy) {
+ private boolean updateDefaultCarrierPolicyAL(int subId, NetworkPolicy policy) {
if (!policy.inferred) {
if (LOGD) Slog.d(TAG, "Ignoring user-defined policy " + policy);
return false;
@@ -2350,14 +2361,33 @@
mLoadedRestrictBackground = (version >= VERSION_ADDED_RESTRICT_BACKGROUND)
&& readBooleanAttribute(in, ATTR_RESTRICT_BACKGROUND);
} else if (TAG_NETWORK_POLICY.equals(tag)) {
- final int networkTemplate = readIntAttribute(in, ATTR_NETWORK_TEMPLATE);
+ int templateType = readIntAttribute(in, ATTR_NETWORK_TEMPLATE);
final String subscriberId = in.getAttributeValue(null, ATTR_SUBSCRIBER_ID);
final String networkId;
+ final int subscriberIdMatchRule;
+ final int templateMeteredness;
if (version >= VERSION_ADDED_NETWORK_ID) {
networkId = in.getAttributeValue(null, ATTR_NETWORK_ID);
} else {
networkId = null;
}
+
+ if (version >= VERSION_SUPPORTED_CARRIER_USAGE) {
+ subscriberIdMatchRule = readIntAttribute(in,
+ ATTR_SUBSCRIBER_ID_MATCH_RULE);
+ templateMeteredness = readIntAttribute(in, ATTR_TEMPLATE_METERED);
+
+ } else {
+ subscriberIdMatchRule = NetworkTemplate.SUBSCRIBER_ID_MATCH_RULE_EXACT;
+ if (templateType == MATCH_MOBILE) {
+ Log.d(TAG, "Update template match rule from mobile to carrier and"
+ + " force to metered");
+ templateType = MATCH_CARRIER;
+ templateMeteredness = METERED_YES;
+ } else {
+ templateMeteredness = METERED_ALL;
+ }
+ }
final RecurrenceRule cycleRule;
if (version >= VERSION_ADDED_CYCLE) {
final String start = readStringAttribute(in, ATTR_CYCLE_START);
@@ -2391,7 +2421,7 @@
if (version >= VERSION_ADDED_METERED) {
metered = readBooleanAttribute(in, ATTR_METERED);
} else {
- switch (networkTemplate) {
+ switch (templateType) {
case MATCH_MOBILE:
metered = true;
break;
@@ -2411,9 +2441,11 @@
} else {
inferred = false;
}
-
- final NetworkTemplate template = new NetworkTemplate(networkTemplate,
- subscriberId, networkId);
+ final NetworkTemplate template = new NetworkTemplate(templateType,
+ subscriberId, new String[] { subscriberId },
+ networkId, templateMeteredness, NetworkStats.ROAMING_ALL,
+ NetworkStats.DEFAULT_NETWORK_ALL, NetworkTemplate.NETWORK_TYPE_ALL,
+ NetworkTemplate.OEM_MANAGED_ALL, subscriberIdMatchRule);
if (template.isPersistable()) {
mNetworkPolicy.put(template, new NetworkPolicy(template, cycleRule,
warningBytes, limitBytes, lastWarningSnooze,
@@ -2621,10 +2653,14 @@
if (subscriberId != null) {
out.attribute(null, ATTR_SUBSCRIBER_ID, subscriberId);
}
+ writeIntAttribute(out, ATTR_SUBSCRIBER_ID_MATCH_RULE,
+ template.getSubscriberIdMatchRule());
final String networkId = template.getNetworkId();
if (networkId != null) {
out.attribute(null, ATTR_NETWORK_ID, networkId);
}
+ writeIntAttribute(out, ATTR_TEMPLATE_METERED,
+ template.getMeteredness());
writeStringAttribute(out, ATTR_CYCLE_START,
RecurrenceRule.convertZonedDateTime(policy.cycleRule.start));
writeStringAttribute(out, ATTR_CYCLE_END,
@@ -3492,8 +3528,8 @@
final String subscriberId = mSubIdToSubscriberId.get(subId, null);
if (subscriberId != null) {
- ensureActiveMobilePolicyAL(subId, subscriberId);
- maybeUpdateMobilePolicyCycleAL(subId, subscriberId);
+ ensureActiveCarrierPolicyAL(subId, subscriberId);
+ maybeUpdateCarrierPolicyCycleAL(subId, subscriberId);
} else {
Slog.wtf(TAG, "Missing subscriberId for subId " + subId);
}
@@ -5534,11 +5570,15 @@
return;
}
- // Turn mobile data limit off
+ // Turn carrier/mobile data limit off
NetworkPolicy[] policies = getNetworkPolicies(mContext.getOpPackageName());
- NetworkTemplate template = NetworkTemplate.buildTemplateMobileAll(subscriber);
+ NetworkTemplate templateCarrier = buildTemplateCarrierMetered(subscriber);
+ NetworkTemplate templateMobile = buildTemplateMobileAll(subscriber);
for (NetworkPolicy policy : policies) {
- if (policy.template.equals(template)) {
+ // All policies loaded from disk will be carrier templates, and setting will also only
+ // set carrier templates, but we clear mobile templates just in case one is set by
+ // some other caller
+ if (policy.template.equals(templateCarrier) || policy.template.equals(templateMobile)) {
policy.limitBytes = NetworkPolicy.LIMIT_DISABLED;
policy.inferred = false;
policy.clearSnooze();
diff --git a/services/core/java/com/android/server/notification/NotificationHistoryDatabase.java b/services/core/java/com/android/server/notification/NotificationHistoryDatabase.java
index 18da33c..fdb93a8 100644
--- a/services/core/java/com/android/server/notification/NotificationHistoryDatabase.java
+++ b/services/core/java/com/android/server/notification/NotificationHistoryDatabase.java
@@ -103,7 +103,7 @@
IntentFilter deletionFilter = new IntentFilter(ACTION_HISTORY_DELETION);
deletionFilter.addDataScheme(SCHEME_DELETION);
- mContext.registerReceiver(mFileCleaupReceiver, deletionFilter);
+ mContext.registerReceiver(mFileCleanupReceiver, deletionFilter);
}
public void init() {
@@ -329,6 +329,12 @@
}
}
+ public void unregisterFileCleanupReceiver() {
+ if(mContext != null) {
+ mContext.unregisterReceiver(mFileCleanupReceiver);
+ }
+ }
+
private static long safeParseLong(String fileName) {
// AtomicFile will create copies of the numeric files with ".new" and ".bak"
// over the course of its processing. If these files still exist on boot we need to clean
@@ -340,7 +346,7 @@
}
}
- private final BroadcastReceiver mFileCleaupReceiver = new BroadcastReceiver() {
+ private final BroadcastReceiver mFileCleanupReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
diff --git a/services/core/java/com/android/server/notification/NotificationHistoryManager.java b/services/core/java/com/android/server/notification/NotificationHistoryManager.java
index 69a7ce90..1aae6c3 100644
--- a/services/core/java/com/android/server/notification/NotificationHistoryManager.java
+++ b/services/core/java/com/android/server/notification/NotificationHistoryManager.java
@@ -272,6 +272,7 @@
private void disableHistory(NotificationHistoryDatabase userHistory, @UserIdInt int userId) {
userHistory.disableHistory();
+ userHistory.unregisterFileCleanupReceiver();
mUserPendingHistoryDisables.put(userId, false);
mHistoryEnabled.put(userId, false);
diff --git a/services/core/java/com/android/server/policy/LegacyGlobalActions.java b/services/core/java/com/android/server/policy/LegacyGlobalActions.java
index 5b48abb..5e4c801 100644
--- a/services/core/java/com/android/server/policy/LegacyGlobalActions.java
+++ b/services/core/java/com/android/server/policy/LegacyGlobalActions.java
@@ -135,7 +135,7 @@
filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
filter.addAction(Intent.ACTION_SCREEN_OFF);
filter.addAction(TelephonyManager.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
- context.registerReceiver(mBroadcastReceiver, filter);
+ context.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL, filter, null, null);
mHasTelephony =
context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
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/services/net/Android.bp b/services/net/Android.bp
index b09a66e..292671a 100644
--- a/services/net/Android.bp
+++ b/services/net/Android.bp
@@ -83,3 +83,15 @@
"//packages/modules/Connectivity/Tethering"
],
}
+
+filegroup {
+ name: "services-connectivity-shared-srcs",
+ srcs: [
+ // TODO: move to networkstack-client
+ "java/android/net/IpMemoryStore.java",
+ "java/android/net/NetworkMonitorManager.java",
+ // TODO: move to libs/net
+ "java/android/net/util/KeepalivePacketDataUtil.java",
+ "java/android/net/util/NetworkConstants.java",
+ ],
+}
diff --git a/services/tests/servicestests/assets/NetworkPolicyManagerServiceTest/netpolicy/network-policy-mobile.xml b/services/tests/servicestests/assets/NetworkPolicyManagerServiceTest/netpolicy/network-policy-mobile.xml
new file mode 100644
index 0000000..d1357e7
--- /dev/null
+++ b/services/tests/servicestests/assets/NetworkPolicyManagerServiceTest/netpolicy/network-policy-mobile.xml
@@ -0,0 +1,6 @@
+<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
+<policy-list version="12" restrictBackground="false">
+ <network-policy networkTemplate="1" subscriberId="466977604504520" cycleStart="2020-01-09T00:00+08:00[Asia/Taipei]" cyclePeriod="P1M" warningBytes="2147483648" limitBytes="-1" lastWarningSnooze="-1" lastLimitSnooze="-1" metered="true" inferred="true" />
+</policy-list>
+<whitelist />
+
diff --git a/services/tests/servicestests/assets/NetworkPolicyManagerServiceTest/netpolicy/network-policy-wifi-with-subscriberId-match-rule-all-and-templateMetered-no.xml b/services/tests/servicestests/assets/NetworkPolicyManagerServiceTest/netpolicy/network-policy-wifi-with-subscriberId-match-rule-all-and-templateMetered-no.xml
new file mode 100644
index 0000000..60d7d25
--- /dev/null
+++ b/services/tests/servicestests/assets/NetworkPolicyManagerServiceTest/netpolicy/network-policy-wifi-with-subscriberId-match-rule-all-and-templateMetered-no.xml
@@ -0,0 +1,5 @@
+<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
+<policy-list version="13" restrictBackground="false">
+<network-policy networkTemplate="4" subscriberIdMatchRule="1" networkId="TEST_SSID" templateMetered="0" cycleStart="2020-01-09T00:00+08:00[Asia/Taipei]" cyclePeriod="P1M" warningBytes="2147483648" limitBytes="-1" lastWarningSnooze="-1" lastLimitSnooze="-1" metered="true" inferred="true" />
+</policy-list>
+<whitelist />
diff --git a/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
index d041eec..fa65b07 100644
--- a/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
@@ -50,10 +50,12 @@
import static android.net.NetworkPolicyManager.uidRulesToString;
import static android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK;
import static android.net.NetworkStats.IFACE_ALL;
+import static android.net.NetworkStats.METERED_NO;
+import static android.net.NetworkStats.METERED_YES;
import static android.net.NetworkStats.SET_ALL;
import static android.net.NetworkStats.TAG_ALL;
import static android.net.NetworkStats.TAG_NONE;
-import static android.net.NetworkTemplate.buildTemplateMobileAll;
+import static android.net.NetworkTemplate.buildTemplateCarrierMetered;
import static android.net.NetworkTemplate.buildTemplateWifi;
import static android.net.TrafficStats.MB_IN_BYTES;
import static android.telephony.CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED;
@@ -229,7 +231,8 @@
private static final int TEST_NET_ID = 24;
private static NetworkTemplate sTemplateWifi = buildTemplateWifi(TEST_SSID);
- private static NetworkTemplate sTemplateMobileAll = buildTemplateMobileAll(TEST_IMSI);
+ private static NetworkTemplate sTemplateCarrierMetered =
+ buildTemplateCarrierMetered(TEST_IMSI);
/**
* Path on assets where files used by {@link NetPolicyXml} are located.
@@ -450,7 +453,7 @@
verify(mNetworkManager).registerObserver(networkObserver.capture());
mNetworkObserver = networkObserver.getValue();
- NetworkPolicy defaultPolicy = mService.buildDefaultMobilePolicy(0, "");
+ NetworkPolicy defaultPolicy = mService.buildDefaultCarrierPolicy(0, "");
mDefaultWarningBytes = defaultPolicy.warningBytes;
mDefaultLimitBytes = defaultPolicy.limitBytes;
}
@@ -1229,7 +1232,7 @@
reset(mTelephonyManager, mNetworkManager, mNotifManager);
TelephonyManager tmSub = expectMobileDefaults();
- mService.snoozeLimit(NetworkTemplate.buildTemplateMobileAll(TEST_IMSI));
+ mService.snoozeLimit(NetworkTemplate.buildTemplateCarrierMetered(TEST_IMSI));
mService.updateNetworks();
verify(tmSub, atLeastOnce()).setPolicyDataEnabled(true);
@@ -1482,7 +1485,7 @@
assertEquals(mDefaultLimitBytes, actualLimitBytes);
}
- private PersistableBundle setupUpdateMobilePolicyCycleTests() throws RemoteException {
+ private PersistableBundle setupUpdateCarrierPolicyCycleTests() throws RemoteException {
when(mConnManager.getAllNetworkStateSnapshots())
.thenReturn(new ArrayList<NetworkStateSnapshot>());
@@ -1490,19 +1493,19 @@
PersistableBundle bundle = CarrierConfigManager.getDefaultConfig();
when(mCarrierConfigManager.getConfigForSubId(FAKE_SUB_ID)).thenReturn(bundle);
- setNetworkPolicies(buildDefaultFakeMobilePolicy());
+ setNetworkPolicies(buildDefaultFakeCarrierPolicy());
return bundle;
}
@Test
- public void testUpdateMobilePolicyCycleWithNullConfig() throws RemoteException {
+ public void testUpdateCarrierPolicyCycleWithNullConfig() throws RemoteException {
when(mConnManager.getAllNetworkStateSnapshots())
.thenReturn(new ArrayList<NetworkStateSnapshot>());
setupTelephonySubscriptionManagers(FAKE_SUB_ID, FAKE_SUBSCRIBER_ID);
when(mCarrierConfigManager.getConfigForSubId(FAKE_SUB_ID)).thenReturn(null);
- setNetworkPolicies(buildDefaultFakeMobilePolicy());
+ setNetworkPolicies(buildDefaultFakeCarrierPolicy());
// smoke test to make sure no errors are raised
mServiceContext.sendBroadcast(
new Intent(ACTION_CARRIER_CONFIG_CHANGED)
@@ -1513,8 +1516,8 @@
}
@Test
- public void testUpdateMobilePolicyCycleWithInvalidConfig() throws RemoteException {
- PersistableBundle bundle = setupUpdateMobilePolicyCycleTests();
+ public void testUpdateCarrierPolicyCycleWithInvalidConfig() throws RemoteException {
+ PersistableBundle bundle = setupUpdateCarrierPolicyCycleTests();
// Test with an invalid CarrierConfig, there should be no changes or crashes.
bundle.putInt(CarrierConfigManager.KEY_MONTHLY_DATA_CYCLE_DAY_INT, -100);
bundle.putLong(CarrierConfigManager.KEY_DATA_WARNING_THRESHOLD_BYTES_LONG, -100);
@@ -1529,8 +1532,8 @@
}
@Test
- public void testUpdateMobilePolicyCycleWithDefaultConfig() throws RemoteException {
- PersistableBundle bundle = setupUpdateMobilePolicyCycleTests();
+ public void testUpdateCarrierPolicyCycleWithDefaultConfig() throws RemoteException {
+ PersistableBundle bundle = setupUpdateCarrierPolicyCycleTests();
// Test that we respect the platform values when told to
bundle.putInt(CarrierConfigManager.KEY_MONTHLY_DATA_CYCLE_DAY_INT,
DATA_CYCLE_USE_PLATFORM_DEFAULT);
@@ -1548,11 +1551,11 @@
}
@Test
- public void testUpdateMobilePolicyCycleWithUserOverrides() throws RemoteException {
- PersistableBundle bundle = setupUpdateMobilePolicyCycleTests();
+ public void testUpdateCarrierPolicyCycleWithUserOverrides() throws RemoteException {
+ PersistableBundle bundle = setupUpdateCarrierPolicyCycleTests();
// inferred = false implies that a user manually modified this policy.
- NetworkPolicy policy = buildDefaultFakeMobilePolicy();
+ NetworkPolicy policy = buildDefaultFakeCarrierPolicy();
policy.inferred = false;
setNetworkPolicies(policy);
@@ -1571,8 +1574,8 @@
}
@Test
- public void testUpdateMobilePolicyCycleUpdatesDataCycle() throws RemoteException {
- PersistableBundle bundle = setupUpdateMobilePolicyCycleTests();
+ public void testUpdateCarrierPolicyCycleUpdatesDataCycle() throws RemoteException {
+ PersistableBundle bundle = setupUpdateCarrierPolicyCycleTests();
bundle.putInt(CarrierConfigManager.KEY_MONTHLY_DATA_CYCLE_DAY_INT, 31);
bundle.putLong(CarrierConfigManager.KEY_DATA_WARNING_THRESHOLD_BYTES_LONG, 9999);
@@ -1586,8 +1589,8 @@
}
@Test
- public void testUpdateMobilePolicyCycleDisableThresholds() throws RemoteException {
- PersistableBundle bundle = setupUpdateMobilePolicyCycleTests();
+ public void testUpdateCarrierPolicyCycleDisableThresholds() throws RemoteException {
+ PersistableBundle bundle = setupUpdateCarrierPolicyCycleTests();
bundle.putInt(CarrierConfigManager.KEY_MONTHLY_DATA_CYCLE_DAY_INT, 31);
bundle.putLong(CarrierConfigManager.KEY_DATA_WARNING_THRESHOLD_BYTES_LONG,
@@ -1603,8 +1606,8 @@
}
@Test
- public void testUpdateMobilePolicyCycleRevertsToDefault() throws RemoteException {
- PersistableBundle bundle = setupUpdateMobilePolicyCycleTests();
+ public void testUpdateCarrierPolicyCycleRevertsToDefault() throws RemoteException {
+ PersistableBundle bundle = setupUpdateCarrierPolicyCycleTests();
bundle.putInt(CarrierConfigManager.KEY_MONTHLY_DATA_CYCLE_DAY_INT, 31);
bundle.putLong(CarrierConfigManager.KEY_DATA_WARNING_THRESHOLD_BYTES_LONG,
@@ -1774,7 +1777,7 @@
@Test
public void testSetNetworkPolicies_withNullPolicies_doesNotThrow() {
NetworkPolicy[] policies = new NetworkPolicy[3];
- policies[1] = buildDefaultFakeMobilePolicy();
+ policies[1] = buildDefaultFakeCarrierPolicy();
setNetworkPolicies(policies);
assertNetworkPolicyEquals(DEFAULT_CYCLE_DAY, mDefaultWarningBytes, mDefaultLimitBytes,
@@ -1820,7 +1823,8 @@
// Set warning to 7KB and limit to 10KB.
setNetworkPolicies(new NetworkPolicy(
- sTemplateMobileAll, CYCLE_DAY, TIMEZONE_UTC, 7000L, 10000L, true));
+ sTemplateCarrierMetered, CYCLE_DAY, TIMEZONE_UTC, 7000L, 10000L,
+ true));
postMsgAndWaitForCompletion();
// Verifies that remaining quotas are set to providers.
@@ -1971,6 +1975,40 @@
}
}
+ @Test
+ @NetPolicyXml("network-policy-mobile.xml")
+ public void testStartToSupportCarrierUsagePolicy() throws Exception {
+ NetworkPolicy[] policies = mService.getNetworkPolicies(
+ mServiceContext.getOpPackageName());
+ assertEquals("Unexpected number of network policies", 1, policies.length);
+ NetworkPolicy actualPolicy = policies[0];
+ assertEquals("Unexpected template match rule in network policies",
+ NetworkTemplate.MATCH_CARRIER,
+ actualPolicy.template.getMatchRule());
+ assertEquals("Unexpected subscriberId match rule in network policies",
+ NetworkTemplate.SUBSCRIBER_ID_MATCH_RULE_EXACT,
+ actualPolicy.template.getSubscriberIdMatchRule());
+ assertEquals("Unexpected template meteredness in network policies",
+ METERED_YES, actualPolicy.template.getMeteredness());
+ }
+
+ @Test
+ @NetPolicyXml("network-policy-wifi-with-subscriberId-match-rule-all-and-templateMetered-no.xml")
+ public void testSupportedCarrierUsagePolicy() throws Exception {
+ NetworkPolicy[] policies = mService.getNetworkPolicies(
+ mServiceContext.getOpPackageName());
+ assertEquals("Unexpected number of network policies", 1, policies.length);
+ NetworkPolicy actualPolicy = policies[0];
+ assertEquals("Unexpected template match rule in network policies",
+ NetworkTemplate.MATCH_WIFI,
+ actualPolicy.template.getMatchRule());
+ assertEquals("Unexpected subscriberId match rule in network policies",
+ NetworkTemplate.SUBSCRIBER_ID_MATCH_RULE_ALL,
+ actualPolicy.template.getSubscriberIdMatchRule());
+ assertEquals("Unexpected template meteredness in network policies",
+ METERED_NO, actualPolicy.template.getMeteredness());
+ }
+
private String formatBlockedStateError(int uid, int rule, boolean metered,
boolean backgroundRestricted) {
return String.format(
@@ -2023,8 +2061,8 @@
return nc;
}
- private NetworkPolicy buildDefaultFakeMobilePolicy() {
- NetworkPolicy p = mService.buildDefaultMobilePolicy(FAKE_SUB_ID, FAKE_SUBSCRIBER_ID);
+ private NetworkPolicy buildDefaultFakeCarrierPolicy() {
+ NetworkPolicy p = mService.buildDefaultCarrierPolicy(FAKE_SUB_ID, FAKE_SUBSCRIBER_ID);
// set a deterministic cycle date
p.cycleRule = new RecurrenceRule(
p.cycleRule.start.withDayOfMonth(DEFAULT_CYCLE_DAY),
@@ -2032,9 +2070,9 @@
return p;
}
- private static NetworkPolicy buildFakeMobilePolicy(int cycleDay, long warningBytes,
+ private static NetworkPolicy buildFakeCarrierPolicy(int cycleDay, long warningBytes,
long limitBytes, boolean inferred) {
- final NetworkTemplate template = buildTemplateMobileAll(FAKE_SUBSCRIBER_ID);
+ final NetworkTemplate template = buildTemplateCarrierMetered(FAKE_SUBSCRIBER_ID);
return new NetworkPolicy(template, cycleDay, TimeZone.getDefault().getID(), warningBytes,
limitBytes, SNOOZE_NEVER, SNOOZE_NEVER, true, inferred);
}
@@ -2045,8 +2083,8 @@
mServiceContext.getOpPackageName());
assertEquals("Unexpected number of network policies", 1, policies.length);
NetworkPolicy actualPolicy = policies[0];
- NetworkPolicy expectedPolicy = buildFakeMobilePolicy(expectedCycleDay, expectedWarningBytes,
- expectedLimitBytes, expectedInferred);
+ NetworkPolicy expectedPolicy = buildFakeCarrierPolicy(expectedCycleDay,
+ expectedWarningBytes, expectedLimitBytes, expectedInferred);
assertEquals(expectedPolicy, actualPolicy);
}
diff --git a/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java b/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
index 1ced467..9860d51 100644
--- a/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
+++ b/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
@@ -92,6 +92,7 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import java.util.Random;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -137,6 +138,8 @@
/** Mock variable used in {@link MyInjector#isPackageInstalled(String, int, int)} */
private static boolean isPackageInstalled = true;
+ private static final Random sRandom = new Random();
+
private MyInjector mInjector;
private AppStandbyController mController;
@@ -238,7 +241,7 @@
@Override
File getDataSystemDirectory() {
- return new File(getContext().getFilesDir(), Long.toString(Math.randomLongInternal()));
+ return new File(getContext().getFilesDir(), Long.toString(sRandom.nextLong()));
}
@Override
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 27c458a..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
*/
@@ -3581,6 +3591,13 @@
"emergency_number_prefix_string_array";
/**
+ * Indicates whether carrier treats "*67" or "*82" as a temporary mode CLIR.
+ * @hide
+ */
+ public static final String KEY_CARRIER_SUPPORTS_CALLER_ID_VERTICAL_SERVICE_CODES_BOOL =
+ "carrier_supports_caller_id_vertical_service_codes_bool";
+
+ /**
* Smart forwarding config. Smart forwarding is a feature to configure call forwarding to a
* different SIM in the device when one SIM is not reachable. The config here specifies a smart
* forwarding component that will launch UI for changing the configuration. An empty string
@@ -4871,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);
@@ -4910,6 +4928,7 @@
1 /* Roaming Indicator Off */
});
sDefaults.putStringArray(KEY_EMERGENCY_NUMBER_PREFIX_STRING_ARRAY, new String[0]);
+ sDefaults.putBoolean(KEY_CARRIER_SUPPORTS_CALLER_ID_VERTICAL_SERVICE_CODES_BOOL, false);
sDefaults.putBoolean(KEY_USE_USIM_BOOL, false);
sDefaults.putBoolean(KEY_SHOW_WFC_LOCATION_PRIVACY_POLICY_BOOL, false);
sDefaults.putBoolean(KEY_AUTO_CANCEL_CS_REJECT_NOTIFICATION, true);
@@ -4951,7 +4970,7 @@
sDefaults.putStringArray(KEY_MISSED_INCOMING_CALL_SMS_ORIGINATOR_STRING_ARRAY,
new String[0]);
sDefaults.putStringArray(KEY_APN_PRIORITY_STRING_ARRAY, new String[] {
- "default:0", "enterprise:1", "mms:2", "supl:2", "dun:2", "hipri:3", "fota:2",
+ "enterprise:0", "default:1", "mms:2", "supl:2", "dun:2", "hipri:3", "fota:2",
"ims:2", "cbs:2", "ia:2", "emergency:2", "mcx:3", "xcap:3"
});
sDefaults.putStringArray(KEY_MISSED_INCOMING_CALL_SMS_PATTERN_STRING_ARRAY, new String[0]);
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/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 1860ecb..4cc6c3d 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -59,7 +59,6 @@
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import android.os.PersistableBundle;
-import android.os.Process;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.SystemProperties;
@@ -414,10 +413,6 @@
return null;
}
- private boolean isSystemProcess() {
- return Process.myUid() == Process.SYSTEM_UID;
- }
-
/**
* Post a runnable to the BackgroundThread.
*
@@ -4196,19 +4191,12 @@
try {
IPhoneSubInfo info = getSubscriberInfoService();
if (info == null) {
- Rlog.e(TAG, "IMSI error: Subscriber Info is null");
- if (!isSystemProcess()) {
- throw new RuntimeException("IMSI error: Subscriber Info is null");
- }
- return;
+ throw new RuntimeException("IMSI error: Subscriber Info is null");
}
int subId = getSubId(SubscriptionManager.getDefaultDataSubscriptionId());
info.resetCarrierKeysForImsiEncryption(subId, mContext.getOpPackageName());
} catch (RemoteException ex) {
- Rlog.e(TAG, "getCarrierInfoForImsiEncryption RemoteException" + ex);
- if (!isSystemProcess()) {
- ex.rethrowAsRuntimeException();
- }
+ Rlog.e(TAG, "Telephony#getCarrierInfoForImsiEncryption RemoteException" + ex);
}
}
@@ -5247,17 +5235,11 @@
try {
final ITelephony telephony = getITelephony();
if (telephony == null) {
- if (!isSystemProcess()) {
- throw new RuntimeException("Telephony service unavailable");
- }
return;
}
telephony.sendDialerSpecialCode(mContext.getOpPackageName(), inputCode);
} catch (RemoteException ex) {
- // This could happen if binder process crashes.
- if (!isSystemProcess()) {
- ex.rethrowAsRuntimeException();
- }
+ Rlog.e(TAG, "Telephony#sendDialerSpecialCode RemoteException" + ex);
}
}
@@ -9534,9 +9516,7 @@
throw new IllegalStateException("telephony service is null.");
}
} catch (RemoteException ex) {
- if (!isSystemProcess()) {
- ex.rethrowAsRuntimeException();
- }
+ Rlog.e(TAG, "Telephony#getMobileProvisioningUrl RemoteException" + ex);
}
return null;
}
@@ -9687,7 +9667,8 @@
}
/**
- * Sets the roaming mode for CDMA phone to the given mode {@code mode}.
+ * Sets the roaming mode for CDMA phone to the given mode {@code mode}. If the phone is not
+ * CDMA capable, this method does nothing.
*
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
* given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
@@ -9710,6 +9691,7 @@
@SystemApi
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void setCdmaRoamingMode(@CdmaRoamingMode int mode) {
+ if (getPhoneType() != PHONE_TYPE_CDMA) return;
try {
ITelephony telephony = getITelephony();
if (telephony != null) {
@@ -9790,7 +9772,8 @@
}
/**
- * Sets the subscription mode for CDMA phone to the given mode {@code mode}.
+ * Sets the subscription mode for CDMA phone to the given mode {@code mode}. If the phone is not
+ * CDMA capable, this method does nothing.
*
* @param mode CDMA subscription mode.
* @throws SecurityException if the caller does not have the permission.
@@ -9809,6 +9792,7 @@
@SystemApi
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void setCdmaSubscriptionMode(@CdmaSubscription int mode) {
+ if (getPhoneType() != PHONE_TYPE_CDMA) return;
try {
ITelephony telephony = getITelephony();
if (telephony != null) {
@@ -13371,9 +13355,7 @@
return service.isDataEnabledForApn(apnType, getSubId(), pkgForDebug);
}
} catch (RemoteException ex) {
- if (!isSystemProcess()) {
- ex.rethrowAsRuntimeException();
- }
+ Rlog.e(TAG, "Telephony#isDataEnabledForApn RemoteException" + ex);
}
return false;
}
@@ -13393,9 +13375,7 @@
return service.isApnMetered(apnType, getSubId());
}
} catch (RemoteException ex) {
- if (!isSystemProcess()) {
- ex.rethrowAsRuntimeException();
- }
+ Rlog.e(TAG, "Telephony#isApnMetered RemoteException" + ex);
}
return true;
}
@@ -13455,9 +13435,7 @@
service.setSystemSelectionChannels(specifiers, getSubId(), aidlConsumer);
}
} catch (RemoteException ex) {
- if (!isSystemProcess()) {
- ex.rethrowAsRuntimeException();
- }
+ Rlog.e(TAG, "Telephony#setSystemSelectionChannels RemoteException" + ex);
}
}
@@ -13485,9 +13463,7 @@
throw new IllegalStateException("telephony service is null.");
}
} catch (RemoteException ex) {
- if (!isSystemProcess()) {
- ex.rethrowAsRuntimeException();
- }
+ Rlog.e(TAG, "Telephony#getSystemSelectionChannels RemoteException" + ex);
}
return new ArrayList<>();
}
@@ -13516,9 +13492,7 @@
return service.isMvnoMatched(getSubId(), mvnoType, mvnoMatchData);
}
} catch (RemoteException ex) {
- if (!isSystemProcess()) {
- ex.rethrowAsRuntimeException();
- }
+ Rlog.e(TAG, "Telephony#matchesCurrentSimOperator RemoteException" + ex);
}
return false;
}
@@ -13922,10 +13896,7 @@
service.setMobileDataPolicyEnabledStatus(getSubId(), policy, enabled);
}
} catch (RemoteException ex) {
- // This could happen if binder process crashes.
- if (!isSystemProcess()) {
- ex.rethrowAsRuntimeException();
- }
+ Rlog.e(TAG, "Telephony#setMobileDataPolicyEnabled RemoteException" + ex);
}
}
@@ -13946,10 +13917,7 @@
return service.isMobileDataPolicyEnabled(getSubId(), policy);
}
} catch (RemoteException ex) {
- // This could happen if binder process crashes.
- if (!isSystemProcess()) {
- ex.rethrowAsRuntimeException();
- }
+ Rlog.e(TAG, "Telephony#isMobileDataPolicyEnabled RemoteException" + ex);
}
return false;
}
@@ -14453,9 +14421,7 @@
throw new IllegalStateException("telephony service is null.");
}
} catch (RemoteException ex) {
- if (!isSystemProcess()) {
- ex.rethrowAsRuntimeException();
- }
+ Rlog.e(TAG, "Telephony#getEquivalentHomePlmns RemoteException" + ex);
}
return Collections.emptyList();
@@ -14549,9 +14515,7 @@
throw new IllegalStateException("telephony service is null.");
}
} catch (RemoteException ex) {
- if (!isSystemProcess()) {
- ex.rethrowAsRuntimeException();
- }
+ Rlog.e(TAG, "Telephony#isRadioInterfaceCapabilitySupported RemoteException" + ex);
}
return false;
}
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
diff --git a/test-base/Android.bp b/test-base/Android.bp
index b58aa11..97ebba6 100644
--- a/test-base/Android.bp
+++ b/test-base/Android.bp
@@ -55,6 +55,7 @@
hiddenapi_additional_annotations: [
"android.test.base-hiddenapi-annotations",
],
+ dist_group: "android",
}
// Build the android.test.base_static library
diff --git a/test-mock/Android.bp b/test-mock/Android.bp
index 107292c..460a26d 100644
--- a/test-mock/Android.bp
+++ b/test-mock/Android.bp
@@ -48,6 +48,7 @@
],
compile_dex: true,
default_to_stubs: true,
+ dist_group: "android",
}
// Make the current.txt available for use by the cts/tests/signature tests.
diff --git a/test-runner/Android.bp b/test-runner/Android.bp
index c380ae3..0f56bb3 100644
--- a/test-runner/Android.bp
+++ b/test-runner/Android.bp
@@ -52,6 +52,7 @@
compile_dex: true,
default_to_stubs: true,
+ dist_group: "android",
}
// Build the android.test.runner-minus-junit library
diff --git a/tools/aapt2/SdkConstants.cpp b/tools/aapt2/SdkConstants.cpp
index e8873bf..7546e41 100644
--- a/tools/aapt2/SdkConstants.cpp
+++ b/tools/aapt2/SdkConstants.cpp
@@ -27,7 +27,7 @@
static ApiVersion sDevelopmentSdkLevel = 10000;
static const auto sDevelopmentSdkCodeNames = std::unordered_set<StringPiece>({
- "Q", "R", "S"
+ "Q", "R", "S", "T"
});
static const std::vector<std::pair<uint16_t, ApiVersion>> sAttrIdMap = {