summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-format2
-rw-r--r--Android.bp13
-rw-r--r--INTENT_OWNERS3
-rw-r--r--OWNERS1
-rw-r--r--SQLITE_OWNERS2
-rw-r--r--apct-tests/perftests/core/OWNERS2
-rw-r--r--apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java2
-rw-r--r--api/Android.bp5
-rw-r--r--api/ApiDocs.bp (renamed from ApiDocs.bp)10
-rw-r--r--api/StubLibraries.bp (renamed from StubLibraries.bp)59
-rw-r--r--api/api.go55
l---------api/docs1
-rw-r--r--cmds/bootanimation/FORMAT.md4
-rw-r--r--cmds/incidentd/Android.bp64
-rw-r--r--cmds/incidentd/fuzzers/IncidentServiceFuzzer.cpp31
-rw-r--r--cmds/incidentd/src/IncidentService.cpp5
-rw-r--r--core/api/current.txt1
-rw-r--r--core/api/module-lib-current.txt9
-rw-r--r--core/api/system-lint-baseline.txt4
-rw-r--r--core/api/test-current.txt15
-rw-r--r--core/java/Android.bp18
-rw-r--r--core/java/android/accessibilityservice/AccessibilityService.java4
-rw-r--r--core/java/android/accessibilityservice/AccessibilityServiceInfo.java10
-rw-r--r--core/java/android/app/Activity.java4
-rw-r--r--core/java/android/app/ActivityManager.java108
-rw-r--r--core/java/android/app/WallpaperInfo.java21
-rw-r--r--core/java/android/app/assist/OWNERS7
-rw-r--r--core/java/android/content/OWNERS4
-rw-r--r--core/java/android/database/sqlite/OWNERS1
-rw-r--r--core/java/android/hardware/SensorAdditionalInfo.java2
-rw-r--r--core/java/android/hardware/SensorManager.java14
-rw-r--r--core/java/android/hardware/SystemSensorManager.java8
-rw-r--r--core/java/android/hardware/camera2/impl/CameraDeviceImpl.java6
-rw-r--r--core/java/android/hardware/usb/OWNERS4
-rw-r--r--core/java/android/net/VpnManager.java2
-rw-r--r--core/java/android/net/metrics/WakeupStats.java26
-rw-r--r--core/java/android/nfc/NfcAntennaInfo.java4
-rw-r--r--core/java/android/os/BatteryManager.java2
-rw-r--r--core/java/android/os/BatteryStatsManager.java12
-rw-r--r--core/java/android/os/Binder.java19
-rwxr-xr-xcore/java/android/os/Build.java5
-rw-r--r--core/java/android/os/Parcel.java110
-rw-r--r--core/java/android/os/Process.java2
-rw-r--r--core/java/android/os/image/DynamicSystemClient.java7
-rw-r--r--core/java/android/os/image/DynamicSystemManager.java12
-rw-r--r--core/java/android/os/image/IDynamicSystemService.aidl6
-rw-r--r--core/java/android/provider/Settings.java12
-rw-r--r--core/java/android/security/keymaster/KeymasterDefs.java22
-rw-r--r--core/java/android/speech/OWNERS1
-rw-r--r--core/java/android/text/TextUtils.java60
-rw-r--r--core/java/android/text/util/Linkify.java12
-rw-r--r--core/java/android/view/GestureDetector.java6
-rw-r--r--core/java/android/view/contentcapture/OWNERS8
-rw-r--r--core/java/android/view/contentprotection/OWNERS4
-rw-r--r--core/java/android/webkit/OWNERS3
-rw-r--r--core/java/android/widget/Toast.java9
-rw-r--r--core/java/android/window/WindowOrganizer.java7
-rw-r--r--core/java/com/android/internal/app/IBatteryStats.aidl2
-rw-r--r--core/java/com/android/internal/jank/OWNERS3
-rw-r--r--core/jni/AndroidRuntime.cpp11
-rw-r--r--core/jni/OWNERS3
-rw-r--r--core/jni/android_media_AudioProductStrategies.cpp14
-rw-r--r--core/jni/android_media_AudioVolumeGroups.cpp5
-rw-r--r--core/jni/android_util_Binder.cpp5
-rw-r--r--core/jni/com_android_internal_os_ZygoteInit.cpp30
-rw-r--r--core/jni/com_android_internal_security_VerityUtils.cpp19
-rw-r--r--core/proto/android/input/OWNERS1
-rw-r--r--core/proto/android/os/system_properties.proto4
-rw-r--r--core/proto/android/providers/settings/global.proto4
-rw-r--r--core/res/AndroidManifest.xml8
-rw-r--r--core/res/res/values/config.xml3
-rw-r--r--core/res/res/values/strings.xml6
-rw-r--r--core/res/res/values/symbols.xml1
-rw-r--r--core/tests/coretests/OWNERS1
-rw-r--r--core/tests/coretests/src/android/content/OWNERS2
-rw-r--r--core/tests/coretests/src/android/database/sqlite/OWNERS1
-rw-r--r--core/tests/coretests/src/android/os/ParcelTest.java89
-rw-r--r--core/tests/coretests/src/android/os/ProcessTest.java1
-rw-r--r--core/tests/coretests/src/android/view/contentprotection/OWNERS4
-rw-r--r--core/tests/fuzzers/ParcelFuzzer/Android.bp1
-rw-r--r--core/tests/fuzzers/java_service_fuzzer/Android.bp1
-rw-r--r--core/xsd/vts/OWNERS2
-rw-r--r--data/etc/com.android.networkstack.xml1
-rw-r--r--keystore/java/android/security/KeyStoreException.java20
-rw-r--r--keystore/java/android/security/keystore2/AndroidKeyStoreCipherSpiBase.java42
-rw-r--r--keystore/java/android/security/keystore2/AndroidKeyStoreRSACipherSpi.java28
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/freeform/OWNERS1
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java7
-rw-r--r--libs/WindowManager/Shell/tests/OWNERS1
-rw-r--r--libs/androidfw/include/androidfw/ObbFile.h6
-rw-r--r--libs/hwui/AndroidTest.xml1
-rw-r--r--libs/hwui/jni/FontFamily.cpp2
-rw-r--r--libs/hwui/jni/fonts/FontFamily.cpp2
-rw-r--r--libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp7
-rw-r--r--libs/incident/src/IncidentReportArgs.cpp7
-rw-r--r--libs/services/Android.bp7
-rw-r--r--media/java/android/media/AudioAttributes.java2
-rw-r--r--media/java/android/media/MediaCodec.java7
-rw-r--r--media/java/android/media/audiopolicy/AudioMix.java13
-rw-r--r--media/java/android/media/audiopolicy/AudioProductStrategy.java13
-rw-r--r--media/java/android/media/musicrecognition/OWNERS1
-rw-r--r--mime/java/Android.bp5
-rw-r--r--native/android/storage_manager.cpp2
-rw-r--r--native/webview/OWNERS4
-rw-r--r--packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java14
-rw-r--r--packages/DynamicSystemInstallationService/src/com/android/dynsystem/VerificationActivity.java9
-rw-r--r--packages/PackageInstaller/Android.bp12
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java12
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java14
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/license/LicenseHtmlGeneratorFromXml.java1
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java6
-rw-r--r--packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java2
-rw-r--r--packages/SystemUI/OWNERS1
-rw-r--r--packages/SystemUI/res/layout/status_bar.xml2
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java2
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/dagger/StatusBarFragmentModule.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/usb/UsbContaminantActivity.java7
-rw-r--r--services/Android.bp7
-rw-r--r--services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java6
-rw-r--r--services/core/Android.bp1
-rw-r--r--services/core/java/com/android/server/DynamicSystemService.java17
-rw-r--r--services/core/java/com/android/server/NetworkManagementService.java74
-rw-r--r--services/core/java/com/android/server/OWNERS3
-rw-r--r--services/core/java/com/android/server/TEST_MAPPING5
-rw-r--r--services/core/java/com/android/server/TelephonyRegistry.java97
-rw-r--r--services/core/java/com/android/server/VpnManagerService.java2
-rw-r--r--services/core/java/com/android/server/am/ActiveServices.java4
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java20
-rw-r--r--services/core/java/com/android/server/am/BaseAppStateTimeSlotEventsTracker.java2
-rw-r--r--services/core/java/com/android/server/am/BatteryExternalStatsWorker.java2
-rw-r--r--services/core/java/com/android/server/am/BatteryStatsService.java26
-rw-r--r--services/core/java/com/android/server/am/OomAdjuster.java6
-rw-r--r--services/core/java/com/android/server/am/ProcessServiceRecord.java3
-rw-r--r--services/core/java/com/android/server/audio/AudioDeviceBroker.java2
-rw-r--r--services/core/java/com/android/server/connectivity/NetdEventListenerService.java23
-rw-r--r--services/core/java/com/android/server/connectivity/Vpn.java93
-rw-r--r--[-rwxr-xr-x]services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java10
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java8
-rw-r--r--services/core/java/com/android/server/net/NetworkPolicyManagerService.java52
-rw-r--r--services/core/java/com/android/server/oemlock/OemLockService.java14
-rw-r--r--services/core/java/com/android/server/oemlock/VendorLockAidl.java115
-rw-r--r--services/core/java/com/android/server/oemlock/VendorLockHidl.java (renamed from services/core/java/com/android/server/oemlock/VendorLock.java)46
-rw-r--r--services/core/java/com/android/server/os/OWNERS3
-rw-r--r--services/core/java/com/android/server/pm/ApkChecksums.java13
-rw-r--r--services/core/java/com/android/server/pm/InstallPackageHelper.java29
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerServiceUtils.java4
-rw-r--r--services/core/java/com/android/server/pm/ShortcutPackage.java99
-rw-r--r--services/core/java/com/android/server/pm/ShortcutService.java25
-rw-r--r--services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java22
-rw-r--r--services/core/java/com/android/server/pm/permission/PermissionManagerServiceImpl.java4
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java4
-rw-r--r--services/core/java/com/android/server/policy/WindowManagerPolicy.java3
-rw-r--r--services/core/java/com/android/server/security/rkp/RemoteProvisioningRegistration.java56
-rw-r--r--services/core/java/com/android/server/security/rkp/RemoteProvisioningService.java4
-rw-r--r--services/core/java/com/android/server/wallpaper/WallpaperManagerService.java71
-rw-r--r--services/core/java/com/android/server/webkit/OWNERS4
-rw-r--r--services/core/java/com/android/server/wm/KeyguardController.java6
-rw-r--r--services/core/java/com/android/server/wm/RemoteDisplayChangeController.java10
-rw-r--r--services/core/xsd/vts/OWNERS2
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java24
-rw-r--r--services/musicrecognition/OWNERS1
-rw-r--r--services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java36
-rw-r--r--services/proguard.flags13
-rw-r--r--services/tests/RemoteProvisioningServiceTests/Android.bp1
-rw-r--r--services/tests/RemoteProvisioningServiceTests/src/com/android/server/security/rkp/RemoteProvisioningRegistrationTest.java35
-rw-r--r--services/tests/RemoteProvisioningServiceTests/src/com/android/server/security/rkp/RemoteProvisioningShellCommandTest.java7
-rw-r--r--services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java23
-rw-r--r--services/tests/servicestests/src/com/android/server/accessibility/magnification/WindowMagnificationManagerTest.java2
-rw-r--r--services/tests/servicestests/src/com/android/server/contentcapture/OWNERS4
-rw-r--r--services/tests/servicestests/src/com/android/server/contentprotection/OWNERS3
-rw-r--r--services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java17
-rw-r--r--services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java70
-rw-r--r--services/tests/servicestests/src/com/android/server/webkit/OWNERS4
-rw-r--r--services/tests/servicestests/utils/com/android/server/testutils/OWNERS1
-rw-r--r--services/tests/uiservicestests/OWNERS1
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java2
-rw-r--r--services/usb/OWNERS4
-rw-r--r--services/usb/java/com/android/server/usb/UsbAlsaManager.java4
-rw-r--r--telecomm/java/android/telecom/PhoneAccount.java19
-rw-r--r--tests/utils/testutils/java/android/os/test/FakePermissionEnforcer.java4
-rw-r--r--tools/aapt2/SdkConstants.cpp4
-rw-r--r--tools/aapt2/cmd/Link.h5
-rw-r--r--tools/aapt2/link/ManifestFixer.cpp5
-rw-r--r--tools/aapt2/link/ManifestFixer.h8
-rw-r--r--tools/aapt2/link/ManifestFixer_test.cpp29
-rw-r--r--tools/incident_section_gen/main.cpp2
-rw-r--r--tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/Constants.kt75
190 files changed, 2079 insertions, 666 deletions
diff --git a/.clang-format b/.clang-format
index 03af56d64062..021d9382d62b 100644
--- a/.clang-format
+++ b/.clang-format
@@ -2,7 +2,7 @@ BasedOnStyle: Google
AccessModifierOffset: -4
AlignOperands: false
-AllowShortFunctionsOnASingleLine: Inline
+AllowShortFunctionsOnASingleLine: Empty
AlwaysBreakBeforeMultilineStrings: false
ColumnLimit: 100
CommentPragmas: NOLINT:.*
diff --git a/Android.bp b/Android.bp
index 93d1e4e5b020..b4e02c0a092f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -532,7 +532,7 @@ filegroup {
"core/java/**/*.logtags",
"**/package.html",
],
- visibility: ["//visibility:private"],
+ visibility: ["//frameworks/base/api"],
}
// Defaults for all stubs that include the non-updatable framework. These defaults do not include
@@ -546,12 +546,10 @@ stubs_defaults {
java_version: "1.8",
arg_files: [":frameworks-base-core-AndroidManifest.xml"],
aidl: {
- local_include_dirs: [
- "media/aidl",
- "telephony/java",
- ],
include_dirs: [
"frameworks/av/aidl",
+ "frameworks/base/media/aidl",
+ "frameworks/base/telephony/java",
"frameworks/native/libs/permission/aidl",
"packages/modules/Bluetooth/framework/aidl-export",
"packages/modules/Connectivity/framework/aidl-export",
@@ -583,7 +581,7 @@ stubs_defaults {
annotations_enabled: true,
previous_api: ":android.api.public.latest",
merge_annotations_dirs: ["metalava-manual"],
- defaults_visibility: ["//visibility:private"],
+ defaults_visibility: ["//frameworks/base/api"],
visibility: ["//frameworks/base/api"],
}
@@ -611,12 +609,9 @@ stubs_defaults {
// NOTE: The below can be removed once the prebuilt stub contains IKE.
"sdk_system_current_android.net.ipsec.ike",
],
- defaults_visibility: ["//visibility:private"],
}
build = [
- "StubLibraries.bp",
- "ApiDocs.bp",
"ProtoLibraries.bp",
"TestProtoLibraries.bp",
]
diff --git a/INTENT_OWNERS b/INTENT_OWNERS
new file mode 100644
index 000000000000..58b5f2a61be0
--- /dev/null
+++ b/INTENT_OWNERS
@@ -0,0 +1,3 @@
+include /PACKAGE_MANAGER_OWNERS
+include /services/core/java/com/android/server/wm/OWNERS
+include /services/core/java/com/android/server/am/OWNERS
diff --git a/OWNERS b/OWNERS
index dad8bfe3340c..4860acc530f8 100644
--- a/OWNERS
+++ b/OWNERS
@@ -38,3 +38,4 @@ per-file TestProtoLibraries.bp = file:platform/platform_testing:/libraries/healt
per-file TestProtoLibraries.bp = file:platform/tools/tradefederation:/OWNERS
per-file ZYGOTE_OWNERS = file:/ZYGOTE_OWNERS
+per-file SQLITE_OWNERS = file:/SQLITE_OWNERS
diff --git a/SQLITE_OWNERS b/SQLITE_OWNERS
new file mode 100644
index 000000000000..1ff72e7689a7
--- /dev/null
+++ b/SQLITE_OWNERS
@@ -0,0 +1,2 @@
+shayba@google.com
+shombert@google.com
diff --git a/apct-tests/perftests/core/OWNERS b/apct-tests/perftests/core/OWNERS
index 6abab6e27f8e..f8fe51c4fde9 100644
--- a/apct-tests/perftests/core/OWNERS
+++ b/apct-tests/perftests/core/OWNERS
@@ -12,3 +12,5 @@ per-file /apct-tests/perftests/core/src/android/content/res/* = file:/core/java/
per-file /apct-tests/perftests/core/src/android/content/om/* = felkachang@google.com
per-file /apct-tests/perftests/core/src/android/content/om/* = file:/core/java/android/content/om/OWNERS
+# Bug component: 44215
+per-file **Accessibility* = file:/core/java/android/view/accessibility/OWNERS \ No newline at end of file
diff --git a/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java
index b995b0688970..3910a0827aad 100644
--- a/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java
+++ b/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java
@@ -52,7 +52,7 @@ public class ExpensiveObjectsPerfTest {
}
}
- @Test
+ @Test(timeout = 900)
public void timeClonedDateFormatTimeInstance() {
DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
diff --git a/api/Android.bp b/api/Android.bp
index 9d20eca75f8f..f40f0c990f72 100644
--- a/api/Android.bp
+++ b/api/Android.bp
@@ -252,3 +252,8 @@ java_genrule {
out: ["api_fingerprint.txt"],
cmd: "cat $(in) | md5sum | cut -d' ' -f1 > $(out)",
}
+
+build = [
+ "ApiDocs.bp",
+ "StubLibraries.bp",
+]
diff --git a/ApiDocs.bp b/api/ApiDocs.bp
index a46ecce5c721..fbcaa52f9bb4 100644
--- a/ApiDocs.bp
+++ b/api/ApiDocs.bp
@@ -182,10 +182,10 @@ droidstubs {
// using droiddoc
/////////////////////////////////////////////////////////////////////
-framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
+framework_docs_only_args = " -android -manifest $(location :frameworks-base-core-AndroidManifest.xml) " +
"-metalavaApiSince " +
"-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
- "-overview $(location core/java/overview.html) " +
+ "-overview $(location :frameworks-base-java-overview) " +
// Federate Support Library references against local API file.
"-federate SupportLib https://developer.android.com " +
"-federationapi SupportLib $(location :current-support-api) " +
@@ -218,16 +218,16 @@ doc_defaults {
"sdk.preview 0",
],
arg_files: [
- "core/res/AndroidManifest.xml",
- "core/java/overview.html",
+ ":frameworks-base-core-AndroidManifest.xml",
+ ":frameworks-base-java-overview",
":current-support-api",
":current-androidx-api",
],
// TODO(b/169090544): remove below aidl includes.
aidl: {
- local_include_dirs: ["media/aidl"],
include_dirs: [
"frameworks/av/aidl",
+ "frameworks/base/media/aidl",
"frameworks/native/libs/permission/aidl",
],
},
diff --git a/StubLibraries.bp b/api/StubLibraries.bp
index b005591980c0..93d20dd199bf 100644
--- a/StubLibraries.bp
+++ b/api/StubLibraries.bp
@@ -213,7 +213,6 @@ java_defaults {
system_modules: "none",
java_version: "1.8",
compile_dex: true,
- defaults_visibility: ["//visibility:private"],
visibility: ["//visibility:public"],
}
@@ -230,8 +229,6 @@ java_defaults {
tag: ".jar",
dest: "android-non-updatable.jar",
},
- defaults_visibility: ["//visibility:private"],
- visibility: ["//visibility:private"],
}
java_library {
@@ -283,6 +280,57 @@ java_library {
}
java_defaults {
+ name: "non_updatable_api_library_defaults",
+ static_libs: ["framework-res-package-jar"],
+ libs: ["stub-annotations"],
+}
+
+java_api_library {
+ name: "android-non-updatable.stubs.from-text",
+ api_surface: "public",
+ api_files: [
+ ":non-updatable-current.txt",
+ ],
+ defaults: ["non_updatable_api_library_defaults"],
+ dep_api_srcs: "android_stubs_current.from-text",
+}
+
+java_api_library {
+ name: "android-non-updatable.stubs.system.from-text",
+ api_surface: "system",
+ api_files: [
+ ":non-updatable-current.txt",
+ ":non-updatable-system-current.txt",
+ ],
+ defaults: ["non_updatable_api_library_defaults"],
+ dep_api_srcs: "android_system_stubs_current.from-text",
+}
+
+java_api_library {
+ name: "android-non-updatable.stubs.test.from-text",
+ api_surface: "test",
+ api_files: [
+ ":non-updatable-current.txt",
+ ":non-updatable-system-current.txt",
+ ":non-updatable-test-current.txt",
+ ],
+ defaults: ["non_updatable_api_library_defaults"],
+ dep_api_srcs: "android_test_stubs_current.from-text",
+}
+
+java_api_library {
+ name: "android-non-updatable.stubs.module_lib.from-text",
+ api_surface: "module_lib",
+ api_files: [
+ ":non-updatable-current.txt",
+ ":non-updatable-system-current.txt",
+ ":non-updatable-module-lib-current.txt",
+ ],
+ defaults: ["non_updatable_api_library_defaults"],
+ dep_api_srcs: "android_module_lib_stubs_current_full.from-text",
+}
+
+java_defaults {
name: "android_stubs_dists_default",
dist: {
targets: ["sdk"],
@@ -402,7 +450,6 @@ java_library {
java_genrule {
name: "android_stubs_private_hjar",
- visibility: ["//visibility:private"],
srcs: [":android_stubs_private_jar{.hjar}"],
out: ["android_stubs_private.jar"],
cmd: "cp $(in) $(out)",
@@ -411,7 +458,6 @@ java_genrule {
java_library {
name: "android_stubs_private",
defaults: ["android_stubs_dists_default"],
- visibility: ["//visibility:private"],
sdk_version: "none",
system_modules: "none",
static_libs: ["android_stubs_private_hjar"],
@@ -422,7 +468,6 @@ java_library {
java_genrule {
name: "android_stubs_private_framework_aidl",
- visibility: ["//visibility:private"],
tools: ["sdkparcelables"],
srcs: [":android_stubs_private"],
out: ["framework.aidl"],
@@ -515,6 +560,7 @@ droidstubs {
],
api_levels_sdk_type: "public",
extensions_info_file: ":sdk-extensions-info",
+ visibility: ["//frameworks/base"],
}
droidstubs {
@@ -585,7 +631,6 @@ droidstubs {
"metalava-manual",
],
args: priv_apps,
- visibility: ["//visibility:private"],
}
java_library {
diff --git a/api/api.go b/api/api.go
index 09c238336a39..af817b5666cd 100644
--- a/api/api.go
+++ b/api/api.go
@@ -15,7 +15,9 @@
package api
import (
+ "fmt"
"sort"
+ "strings"
"github.com/google/blueprint/proptools"
@@ -102,6 +104,13 @@ type fgProps struct {
Visibility []string
}
+type defaultsProps struct {
+ Name *string
+ Api_surface *string
+ Api_contributions []string
+ Defaults_visibility []string
+}
+
type Bazel_module struct {
Bp2build_available *bool
}
@@ -164,26 +173,26 @@ func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) {
}
func createMergedAnnotationsFilegroups(ctx android.LoadHookContext, modules, system_server_modules []string) {
- for _, i := range []struct{
+ for _, i := range []struct {
name string
tag string
modules []string
}{
{
- name: "all-modules-public-annotations",
- tag: "{.public.annotations.zip}",
+ name: "all-modules-public-annotations",
+ tag: "{.public.annotations.zip}",
modules: modules,
}, {
- name: "all-modules-system-annotations",
- tag: "{.system.annotations.zip}",
+ name: "all-modules-system-annotations",
+ tag: "{.system.annotations.zip}",
modules: modules,
}, {
- name: "all-modules-module-lib-annotations",
- tag: "{.module-lib.annotations.zip}",
+ name: "all-modules-module-lib-annotations",
+ tag: "{.module-lib.annotations.zip}",
modules: modules,
}, {
- name: "all-modules-system-server-annotations",
- tag: "{.system-server.annotations.zip}",
+ name: "all-modules-system-server-annotations",
+ tag: "{.system-server.annotations.zip}",
modules: system_server_modules,
},
} {
@@ -329,6 +338,30 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_
}
}
+func createApiContributionDefaults(ctx android.LoadHookContext, modules []string) {
+ defaultsSdkKinds := []android.SdkKind{
+ android.SdkPublic, android.SdkSystem, android.SdkModule,
+ }
+ for _, sdkKind := range defaultsSdkKinds {
+ props := defaultsProps{}
+ props.Name = proptools.StringPtr(
+ sdkKind.DefaultJavaLibraryName() + "_contributions")
+ if sdkKind == android.SdkModule {
+ props.Name = proptools.StringPtr(
+ sdkKind.DefaultJavaLibraryName() + "_contributions_full")
+ }
+ props.Api_surface = proptools.StringPtr(sdkKind.String())
+ apiSuffix := ""
+ if sdkKind != android.SdkPublic {
+ apiSuffix = "." + strings.ReplaceAll(sdkKind.String(), "-", "_")
+ }
+ props.Api_contributions = transformArray(
+ modules, "", fmt.Sprintf(".stubs.source%s.api.contribution", apiSuffix))
+ props.Defaults_visibility = []string{"//visibility:public"}
+ ctx.CreateModule(java.DefaultsFactory, &props)
+ }
+}
+
func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {
bootclasspath := a.properties.Bootclasspath
system_server_classpath := a.properties.System_server_classpath
@@ -347,6 +380,8 @@ func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {
createMergedAnnotationsFilegroups(ctx, bootclasspath, system_server_classpath)
createPublicStubsSourceFilegroup(ctx, bootclasspath)
+
+ createApiContributionDefaults(ctx, bootclasspath)
}
func combinedApisModuleFactory() android.Module {
@@ -374,7 +409,7 @@ func (a *CombinedApis) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
"system-server": "-system-server-current.txt",
}
- for scopeName, suffix := range scopeToSuffix{
+ for scopeName, suffix := range scopeToSuffix {
name := a.Name() + suffix
var scope bazel.StringAttribute
diff --git a/api/docs b/api/docs
new file mode 120000
index 000000000000..a9594bfe4ab6
--- /dev/null
+++ b/api/docs
@@ -0,0 +1 @@
+../docs \ No newline at end of file
diff --git a/cmds/bootanimation/FORMAT.md b/cmds/bootanimation/FORMAT.md
index 64814c8a25e2..4abffd7770c8 100644
--- a/cmds/bootanimation/FORMAT.md
+++ b/cmds/bootanimation/FORMAT.md
@@ -153,14 +153,14 @@ based on animation progression.
To enable it, add the following line as the second line of desc.txt:
- dynamic_colors PATH #RGBHEX0 #RGBHEX1 #RGBHEX2 #RGBHEX3
+ dynamic_colors PATH #RGBHEX1 #RGBHEX2 #RGBHEX3 #RGBHEX4
* **PATH:** file path of the part to apply dynamic color transition to.
Any part before this part will be rendered in the start colors.
Any part after will be rendered in the end colors.
* **RGBHEX1:** the first start color (masked by the R channel), specified as `#RRGGBB`.
* **RGBHEX2:** the second start color (masked by the G channel), specified as `#RRGGBB`.
- * **RGBHEX3:** the thrid start color (masked by the B channel), specified as `#RRGGBB`.
+ * **RGBHEX3:** the third start color (masked by the B channel), specified as `#RRGGBB`.
* **RGBHEX4:** the forth start color (masked by the A channel), specified as `#RRGGBB`.
The end colors will be read from the following system properties:
diff --git a/cmds/incidentd/Android.bp b/cmds/incidentd/Android.bp
index b0b23f569664..bd30404848a3 100644
--- a/cmds/incidentd/Android.bp
+++ b/cmds/incidentd/Android.bp
@@ -82,17 +82,11 @@ cc_binary {
},
},
-
init_rc: ["incidentd.rc"],
}
-// ==============
-// incidentd_test
-// ==============
-
-cc_test {
- name: "incidentd_test",
- test_suites: ["device-tests"],
+cc_defaults {
+ name: "incidentd_test_defaults",
cflags: [
"-Werror",
@@ -110,8 +104,6 @@ cc_test {
generated_headers: ["framework-cppstream-protos"],
srcs: [
- "tests/**/*.cpp",
- "tests/**/*.proto",
"src/FdBuffer.cpp",
"src/Privacy.cpp",
"src/PrivacyFilter.cpp",
@@ -125,13 +117,11 @@ cc_test {
"src/**/*.proto",
],
- data: ["testdata/**/*"],
-
static_libs: [
- "libgmock",
"libincidentcompanion",
"libplatformprotos-test",
],
+
shared_libs: [
"libbase",
"libbinder",
@@ -144,6 +134,30 @@ cc_test {
"libservices",
"libutils",
],
+}
+
+// ==============
+// incidentd_test
+// ==============
+cc_test {
+ name: "incidentd_test",
+
+ defaults: [
+ "incidentd_test_defaults",
+ ],
+
+ test_suites: ["device-tests"],
+
+ srcs: [
+ "tests/**/*.cpp",
+ "tests/**/*.proto",
+ ],
+
+ data: ["testdata/**/*"],
+
+ static_libs: [
+ "libgmock",
+ ],
target: {
android: {
@@ -160,3 +174,27 @@ genrule {
out: ["section_list.cpp"],
cmd: "$(location incident-section-gen) incidentd > $(out)",
}
+
+cc_fuzz {
+ name: "incidentd_service_fuzzer",
+ defaults: [
+ "service_fuzzer_defaults",
+ "fuzzer_disable_leaks",
+ "incidentd_test_defaults",
+ ],
+
+ fuzz_config: {
+ cc: [
+ "yaochen@google.com",
+ "yanmin@google.com",
+ ],
+ triage_assignee: "waghpawan@google.com",
+ },
+
+ srcs: [
+ "fuzzers/IncidentServiceFuzzer.cpp",
+ "src/IncidentService.cpp",
+ "src/Broadcaster.cpp",
+ ":incidentd_section_list",
+ ],
+}
diff --git a/cmds/incidentd/fuzzers/IncidentServiceFuzzer.cpp b/cmds/incidentd/fuzzers/IncidentServiceFuzzer.cpp
new file mode 100644
index 000000000000..14c969b30ee6
--- /dev/null
+++ b/cmds/incidentd/fuzzers/IncidentServiceFuzzer.cpp
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+#include <fuzzbinder/libbinder_driver.h>
+#include <utils/Looper.h>
+
+#include "IncidentService.h"
+
+using ::android::fuzzService;
+using ::android::os::incidentd::IncidentService;
+using ::android::Looper;
+using ::android::sp;
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ sp<Looper> looper(Looper::prepare(0));
+ sp<IncidentService> service = sp<IncidentService>::make(looper);
+ fuzzService(service, FuzzedDataProvider(data, size));
+ return 0;
+}
diff --git a/cmds/incidentd/src/IncidentService.cpp b/cmds/incidentd/src/IncidentService.cpp
index 5af02f405ed9..05a43ad7d936 100644
--- a/cmds/incidentd/src/IncidentService.cpp
+++ b/cmds/incidentd/src/IncidentService.cpp
@@ -513,6 +513,9 @@ status_t IncidentService::onTransact(uint32_t code, const Parcel& data, Parcel*
sp<IShellCallback> shellCallback = IShellCallback::asInterface(data.readStrongBinder());
sp<IResultReceiver> resultReceiver =
IResultReceiver::asInterface(data.readStrongBinder());
+ if (resultReceiver == nullptr) {
+ return BAD_VALUE;
+ }
FILE* fin = fdopen(in, "r");
FILE* fout = fdopen(out, "w");
@@ -533,7 +536,7 @@ status_t IncidentService::onTransact(uint32_t code, const Parcel& data, Parcel*
fflush(fout);
fclose(fout);
}
- if (fout != NULL) {
+ if (ferr != NULL) {
fflush(ferr);
fclose(ferr);
}
diff --git a/core/api/current.txt b/core/api/current.txt
index cf3938ade32d..77a6fec604be 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -31081,6 +31081,7 @@ package android.os {
field public static final int S_V2 = 32; // 0x20
field public static final int TIRAMISU = 33; // 0x21
field public static final int UPSIDE_DOWN_CAKE = 10000; // 0x2710
+ field public static final int VANILLA_ICE_CREAM = 10000; // 0x2710
}
public final class Bundle extends android.os.BaseBundle implements java.lang.Cloneable android.os.Parcelable {
diff --git a/core/api/module-lib-current.txt b/core/api/module-lib-current.txt
index c6c4daf7b0ac..13a48993f68f 100644
--- a/core/api/module-lib-current.txt
+++ b/core/api/module-lib-current.txt
@@ -17,10 +17,19 @@ package android.app {
public class ActivityManager {
method @RequiresPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER) public void addHomeVisibilityListener(@NonNull java.util.concurrent.Executor, @NonNull android.app.HomeVisibilityListener);
+ method @NonNull @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public int[] getUidFrozenState(@NonNull int[]);
+ method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public void registerUidFrozenStateChangedCallback(@NonNull java.util.concurrent.Executor, @NonNull android.app.ActivityManager.UidFrozenStateChangedCallback);
method @RequiresPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER) public void removeHomeVisibilityListener(@NonNull android.app.HomeVisibilityListener);
+ method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public void unregisterUidFrozenStateChangedCallback(@NonNull android.app.ActivityManager.UidFrozenStateChangedCallback);
method @RequiresPermission(android.Manifest.permission.CHANGE_CONFIGURATION) public boolean updateMccMncConfiguration(@NonNull String, @NonNull String);
}
+ public static interface ActivityManager.UidFrozenStateChangedCallback {
+ method public void onUidFrozenStateChanged(@NonNull int[], @NonNull int[]);
+ field public static final int UID_FROZEN_STATE_FROZEN = 1; // 0x1
+ field public static final int UID_FROZEN_STATE_UNFROZEN = 2; // 0x2
+ }
+
public class AppOpsManager {
field public static final String OPSTR_NO_ISOLATED_STORAGE = "android:no_isolated_storage";
}
diff --git a/core/api/system-lint-baseline.txt b/core/api/system-lint-baseline.txt
index 025e8629fc20..0100f0e76285 100644
--- a/core/api/system-lint-baseline.txt
+++ b/core/api/system-lint-baseline.txt
@@ -143,12 +143,16 @@ SamShouldBeLast: android.media.AudioFocusRequest.Builder#setOnAudioFocusChangeLi
SAM-compatible parameters (such as parameter 1, "listener", in android.media.AudioFocusRequest.Builder.setOnAudioFocusChangeListener) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions
SamShouldBeLast: android.media.AudioManager#requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener, int, int):
SAM-compatible parameters (such as parameter 1, "l", in android.media.AudioManager.requestAudioFocus) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions
+SamShouldBeLast: android.media.AudioRecord#addOnRoutingChangedListener(android.media.AudioRecord.OnRoutingChangedListener, android.os.Handler):
+ SAM-compatible parameters (such as parameter 1, "listener", in android.media.AudioRecord.addOnRoutingChangedListener) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions
SamShouldBeLast: android.media.AudioRecord#addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler):
SAM-compatible parameters (such as parameter 1, "listener", in android.media.AudioRecord.addOnRoutingChangedListener) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions
SamShouldBeLast: android.media.AudioRouting#addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler):
SAM-compatible parameters (such as parameter 1, "listener", in android.media.AudioRouting.addOnRoutingChangedListener) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions
SamShouldBeLast: android.media.AudioTrack#addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler):
SAM-compatible parameters (such as parameter 1, "listener", in android.media.AudioTrack.addOnRoutingChangedListener) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions
+SamShouldBeLast: android.media.AudioTrack#addOnRoutingChangedListener(android.media.AudioTrack.OnRoutingChangedListener, android.os.Handler):
+ SAM-compatible parameters (such as parameter 1, "listener", in android.media.AudioTrack.addOnRoutingChangedListener) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions
SamShouldBeLast: android.media.MediaCodec#setOnFrameRenderedListener(android.media.MediaCodec.OnFrameRenderedListener, android.os.Handler):
SAM-compatible parameters (such as parameter 1, "listener", in android.media.MediaCodec.setOnFrameRenderedListener) should be last to improve Kotlin interoperability; see https://kotlinlang.org/docs/reference/java-interop.html#sam-conversions
SamShouldBeLast: android.media.MediaPlayer#addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler):
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 6a5ef3a67488..6e61569a8352 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -122,16 +122,19 @@ package android.app {
method @RequiresPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER) public void addHomeVisibilityListener(@NonNull java.util.concurrent.Executor, @NonNull android.app.HomeVisibilityListener);
method public void alwaysShowUnsupportedCompileSdkWarning(android.content.ComponentName);
method public long getTotalRam();
+ method @NonNull @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public int[] getUidFrozenState(@NonNull int[]);
method @RequiresPermission(allOf={android.Manifest.permission.PACKAGE_USAGE_STATS, android.Manifest.permission.INTERACT_ACROSS_USERS_FULL}, conditional=true) public int getUidProcessCapabilities(int);
method @RequiresPermission(allOf={android.Manifest.permission.PACKAGE_USAGE_STATS, android.Manifest.permission.INTERACT_ACROSS_USERS_FULL}, conditional=true) public int getUidProcessState(int);
method public void holdLock(android.os.IBinder, int);
method public static boolean isHighEndGfx();
+ method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public void registerUidFrozenStateChangedCallback(@NonNull java.util.concurrent.Executor, @NonNull android.app.ActivityManager.UidFrozenStateChangedCallback);
method @RequiresPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER) public void removeHomeVisibilityListener(@NonNull android.app.HomeVisibilityListener);
method @RequiresPermission(android.Manifest.permission.RESET_APP_ERRORS) public void resetAppErrors();
method public static void resumeAppSwitches() throws android.os.RemoteException;
method @RequiresPermission(android.Manifest.permission.CHANGE_CONFIGURATION) public void scheduleApplicationInfoChanged(java.util.List<java.lang.String>, int);
method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.INTERACT_ACROSS_USERS}) public void setStopUserOnSwitch(int);
method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public boolean stopUser(int, boolean);
+ method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public void unregisterUidFrozenStateChangedCallback(@NonNull android.app.ActivityManager.UidFrozenStateChangedCallback);
method @RequiresPermission(android.Manifest.permission.CHANGE_CONFIGURATION) public boolean updateMccMncConfiguration(@NonNull String, @NonNull String);
method @RequiresPermission(android.Manifest.permission.DUMP) public void waitForBroadcastIdle();
field public static final long LOCK_DOWN_CLOSE_SYSTEM_DIALOGS = 174664365L; // 0xa692aadL
@@ -161,6 +164,12 @@ package android.app {
method @Nullable public String getIconResourcePackage();
}
+ public static interface ActivityManager.UidFrozenStateChangedCallback {
+ method public void onUidFrozenStateChanged(@NonNull int[], @NonNull int[]);
+ field public static final int UID_FROZEN_STATE_FROZEN = 1; // 0x1
+ field public static final int UID_FROZEN_STATE_UNFROZEN = 2; // 0x2
+ }
+
public class ActivityOptions {
method public boolean isEligibleForLegacyPermissionPrompt();
method @NonNull public static android.app.ActivityOptions makeCustomAnimation(@NonNull android.content.Context, int, int, int, @Nullable android.os.Handler, @Nullable android.app.ActivityOptions.OnAnimationStartedListener, @Nullable android.app.ActivityOptions.OnAnimationFinishedListener);
@@ -1688,6 +1697,10 @@ package android.net {
package android.os {
+ public class BatteryManager {
+ field public static final int BATTERY_PLUGGED_ANY = 15; // 0xf
+ }
+
public final class BatteryStatsManager {
method @RequiresPermission(android.Manifest.permission.DEVICE_POWER) public void resetBattery(boolean);
method @RequiresPermission(android.Manifest.permission.DEVICE_POWER) public void setBatteryLevel(int, boolean);
@@ -3469,7 +3482,7 @@ package android.window {
public class WindowOrganizer {
ctor public WindowOrganizer();
- method @RequiresPermission(value=android.Manifest.permission.MANAGE_ACTIVITY_TASKS, conditional=true) public int applySyncTransaction(@NonNull android.window.WindowContainerTransaction, @NonNull android.window.WindowContainerTransactionCallback);
+ method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public int applySyncTransaction(@NonNull android.window.WindowContainerTransaction, @NonNull android.window.WindowContainerTransactionCallback);
method @RequiresPermission(value=android.Manifest.permission.MANAGE_ACTIVITY_TASKS, conditional=true) public void applyTransaction(@NonNull android.window.WindowContainerTransaction);
}
diff --git a/core/java/Android.bp b/core/java/Android.bp
index 7df3d1e13aa0..5d7d7ba2379c 100644
--- a/core/java/Android.bp
+++ b/core/java/Android.bp
@@ -31,9 +31,14 @@ filegroup {
srcs: ["android/security/keymaster/IKeyAttestationApplicationIdProvider.aidl"],
}
-filegroup {
- name: "IDropBoxManagerService.aidl",
- srcs: ["com/android/internal/os/IDropBoxManagerService.aidl"],
+aidl_library {
+ name: "IDropBoxManagerService_aidl",
+ srcs: [
+ "com/android/internal/os/IDropBoxManagerService.aidl",
+ ],
+ hdrs: [
+ "android/os/DropBoxManager.aidl",
+ ],
}
filegroup {
@@ -146,7 +151,7 @@ filegroup {
],
}
-filegroup {
+aidl_library {
name: "ILogcatManagerService_aidl",
srcs: ["android/os/logcat/ILogcatManagerService.aidl"],
}
@@ -429,6 +434,11 @@ aidl_interface {
},
}
+filegroup {
+ name: "frameworks-base-java-overview",
+ srcs: ["overview.html"],
+}
+
// Avoid including Parcelable classes as we don't want to have two copies of
// Parcelable cross the libraries. This is used by telephony-common (frameworks/opt/telephony)
// and TeleService app (packages/services/Telephony).
diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java
index c17fbf19516b..dd955406e690 100644
--- a/core/java/android/accessibilityservice/AccessibilityService.java
+++ b/core/java/android/accessibilityservice/AccessibilityService.java
@@ -2523,6 +2523,10 @@ public abstract class AccessibilityService extends Service {
IAccessibilityServiceConnection connection =
AccessibilityInteractionClient.getInstance(this).getConnection(mConnectionId);
if (mInfo != null && connection != null) {
+ if (!mInfo.isWithinParcelableSize()) {
+ throw new IllegalStateException(
+ "Cannot update service info: size is larger than safe parcelable limits.");
+ }
try {
connection.setServiceInfo(mInfo);
mInfo = null;
diff --git a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
index 530de0f3af6b..0cbcdb5a2b62 100644
--- a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
+++ b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
@@ -40,6 +40,7 @@ import android.content.res.XmlResourceParser;
import android.graphics.drawable.Drawable;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Build;
+import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
@@ -1128,6 +1129,15 @@ public class AccessibilityServiceInfo implements Parcelable {
return 0;
}
+ /** @hide */
+ public final boolean isWithinParcelableSize() {
+ final Parcel parcel = Parcel.obtain();
+ writeToParcel(parcel, 0);
+ final boolean result = parcel.dataSize() <= IBinder.MAX_IPC_SIZE;
+ parcel.recycle();
+ return result;
+ }
+
public void writeToParcel(Parcel parcel, int flagz) {
parcel.writeInt(eventTypes);
parcel.writeStringArray(packageNames);
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index e85fa9d46d10..1807fb66da8f 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -5369,8 +5369,8 @@ public class Activity extends ContextThemeWrapper
* result callbacks including {@link #onRequestPermissionsResult(int, String[], int[])}.
* </p>
* <p>
- * The <a href="https://github.com/android/permissions-samples">
- * RuntimePermissions</a> sample apps demonstrate how to use this method to
+ * The <a href="https://github.com/android/platform-samples/tree/main/samples/privacy/permissions">
+ * permissions samples</a> repo demonstrates how to use this method to
* request permissions at run time.
* </p>
*
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index d328b34a2a8f..932866468314 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -231,6 +231,114 @@ public class ActivityManager {
final ArrayMap<OnUidImportanceListener, UidObserver> mImportanceListeners = new ArrayMap<>();
/**
+ * Callback object for {@link #registerUidFrozenStateChangedCallback}
+ *
+ * @hide
+ */
+ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
+ @TestApi
+ public interface UidFrozenStateChangedCallback {
+ /**
+ * Indicates that the UID was frozen.
+ *
+ * @hide
+ */
+ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
+ @TestApi
+ int UID_FROZEN_STATE_FROZEN = 1;
+
+ /**
+ * Indicates that the UID was unfrozen.
+ *
+ * @hide
+ */
+ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
+ @TestApi
+ int UID_FROZEN_STATE_UNFROZEN = 2;
+
+ /**
+ * @hide
+ */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(flag = false, prefix = {"UID_FROZEN_STATE_"}, value = {
+ UID_FROZEN_STATE_FROZEN,
+ UID_FROZEN_STATE_UNFROZEN,
+ })
+ public @interface UidFrozenState {}
+
+ /**
+ * Notify the client that the frozen states of an array of UIDs have changed.
+ *
+ * @param uids The UIDs for which the frozen state has changed
+ * @param frozenStates Frozen state for each UID index, Will be set to
+ * {@link UidFrozenStateChangedCallback#UID_FROZEN_STATE_FROZEN}
+ * when the UID is frozen. When the UID is unfrozen,
+ * {@link UidFrozenStateChangedCallback#UID_FROZEN_STATE_UNFROZEN}
+ * will be set.
+ *
+ * @hide
+ */
+ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
+ @TestApi
+ void onUidFrozenStateChanged(@NonNull int[] uids,
+ @NonNull @UidFrozenState int[] frozenStates);
+ }
+
+ /**
+ * Register a {@link UidFrozenStateChangedCallback} object to receive notification
+ * when a UID is frozen or unfrozen. Will throw an exception if the same
+ * callback object is registered more than once.
+ *
+ * @param executor The executor that the callback will be run from.
+ * @param callback The callback to be registered. Callbacks for previous frozen/unfrozen
+ * UID changes will not be delivered. Only changes in state from the point of
+ * registration onward will be reported.
+ * @throws IllegalStateException if the {@code callback} is already registered.
+ *
+ * @hide
+ */
+ @RequiresPermission(Manifest.permission.PACKAGE_USAGE_STATS)
+ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
+ @TestApi
+ public void registerUidFrozenStateChangedCallback(
+ @NonNull Executor executor,
+ @NonNull UidFrozenStateChangedCallback callback) {
+ }
+
+ /**
+ * Unregister a {@link UidFrozenStateChangedCallback} callback.
+ * @param callback The callback to be unregistered.
+ *
+ * @hide
+ */
+ @RequiresPermission(Manifest.permission.PACKAGE_USAGE_STATS)
+ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
+ @TestApi
+ public void unregisterUidFrozenStateChangedCallback(
+ @NonNull UidFrozenStateChangedCallback callback) {
+ }
+
+ /**
+ * Query the frozen state of a list of UIDs.
+ *
+ * @param uids the array of UIDs which the client would like to know the frozen state of.
+ * @return An array containing the frozen state for each requested UID, by index. Will be set
+ * to {@link UidFrozenStateChangedCallback#UID_FROZEN_STATE_FROZEN}
+ * if the UID is frozen. If the UID is not frozen or not found,
+ * {@link UidFrozenStateChangedCallback#UID_FROZEN_STATE_UNFROZEN}
+ * will be set.
+ *
+ * @hide
+ */
+ @RequiresPermission(Manifest.permission.PACKAGE_USAGE_STATS)
+ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
+ @TestApi
+ public @NonNull @UidFrozenStateChangedCallback.UidFrozenState
+ int[] getUidFrozenState(@NonNull int[] uids) {
+ return new int[uids.length];
+ }
+
+ /**
* <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code
* <meta-data>}</a> name for a 'home' Activity that declares a package that is to be
* uninstalled in lieu of the declaring one. The package named here must be
diff --git a/core/java/android/app/WallpaperInfo.java b/core/java/android/app/WallpaperInfo.java
index 99d406446dae..e563de20d6d6 100644
--- a/core/java/android/app/WallpaperInfo.java
+++ b/core/java/android/app/WallpaperInfo.java
@@ -96,31 +96,30 @@ public final class WallpaperInfo implements Parcelable {
throws XmlPullParserException, IOException {
mService = service;
ServiceInfo si = service.serviceInfo;
-
+
final PackageManager pm = context.getPackageManager();
- XmlResourceParser parser = null;
- try {
- parser = si.loadXmlMetaData(pm, WallpaperService.SERVICE_META_DATA);
+ try (XmlResourceParser parser = si.loadXmlMetaData(pm,
+ WallpaperService.SERVICE_META_DATA)) {
if (parser == null) {
throw new XmlPullParserException("No "
+ WallpaperService.SERVICE_META_DATA + " meta-data");
}
-
+
Resources res = pm.getResourcesForApplication(si.applicationInfo);
-
+
AttributeSet attrs = Xml.asAttributeSet(parser);
-
+
int type;
- while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
+ while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
&& type != XmlPullParser.START_TAG) {
}
-
+
String nodeName = parser.getName();
if (!"wallpaper".equals(nodeName)) {
throw new XmlPullParserException(
"Meta-data does not start with wallpaper tag");
}
-
+
TypedArray sa = res.obtainAttributes(attrs,
com.android.internal.R.styleable.Wallpaper);
mSettingsActivityName = sa.getString(
@@ -159,8 +158,6 @@ public final class WallpaperInfo implements Parcelable {
} catch (NameNotFoundException e) {
throw new XmlPullParserException(
"Unable to create context for: " + si.packageName);
- } finally {
- if (parser != null) parser.close();
}
}
diff --git a/core/java/android/app/assist/OWNERS b/core/java/android/app/assist/OWNERS
index e857c72bb28e..e4ffd7f41aa0 100644
--- a/core/java/android/app/assist/OWNERS
+++ b/core/java/android/app/assist/OWNERS
@@ -1,5 +1,2 @@
-augale@google.com
-joannechung@google.com
-markpun@google.com
-lpeter@google.com
-tymtsai@google.com
+hackz@google.com
+volnov@google.com \ No newline at end of file
diff --git a/core/java/android/content/OWNERS b/core/java/android/content/OWNERS
index 2cde539ab1f8..d984633ab8b4 100644
--- a/core/java/android/content/OWNERS
+++ b/core/java/android/content/OWNERS
@@ -5,9 +5,7 @@ per-file *Content* = file:/services/core/java/com/android/server/am/OWNERS
per-file *Sync* = file:/services/core/java/com/android/server/am/OWNERS
per-file IntentFilter.java = file:/PACKAGE_MANAGER_OWNERS
per-file IntentFilter.java = file:/services/core/java/com/android/server/am/OWNERS
-per-file Intent.java = file:/PACKAGE_MANAGER_OWNERS
-per-file Intent.java = file:/services/core/java/com/android/server/wm/OWNERS
-per-file Intent.java = file:/services/core/java/com/android/server/am/OWNERS
+per-file Intent.java = file:/INTENT_OWNERS
per-file AutofillOptions* = file:/core/java/android/service/autofill/OWNERS
per-file ContentCaptureOptions* = file:/core/java/android/service/contentcapture/OWNERS
per-file LocusId* = file:/core/java/android/service/contentcapture/OWNERS
diff --git a/core/java/android/database/sqlite/OWNERS b/core/java/android/database/sqlite/OWNERS
new file mode 100644
index 000000000000..3bebc7c56f61
--- /dev/null
+++ b/core/java/android/database/sqlite/OWNERS
@@ -0,0 +1 @@
+include /SQLITE_OWNERS
diff --git a/core/java/android/hardware/SensorAdditionalInfo.java b/core/java/android/hardware/SensorAdditionalInfo.java
index 12edc5eb7e33..59def9fb3325 100644
--- a/core/java/android/hardware/SensorAdditionalInfo.java
+++ b/core/java/android/hardware/SensorAdditionalInfo.java
@@ -63,7 +63,7 @@ public class SensorAdditionalInfo {
public final int[] intValues;
/**
- * Typical values of additional infomation type. The set of values is subject to extension in
+ * Typical values of additional information type. The set of values is subject to extension in
* newer versions and vendors have the freedom of define their own custom values.
*
* @hide
diff --git a/core/java/android/hardware/SensorManager.java b/core/java/android/hardware/SensorManager.java
index 6d8c4a93b44e..f05397669b34 100644
--- a/core/java/android/hardware/SensorManager.java
+++ b/core/java/android/hardware/SensorManager.java
@@ -872,9 +872,9 @@ public abstract class SensorManager {
/**
* Flushes the FIFO of all the sensors registered for this listener. If there are events
- * in the FIFO of the sensor, they are returned as if the maxReportLantecy of the FIFO has
+ * in the FIFO of the sensor, they are returned as if the maxReportLatency of the FIFO has
* expired. Events are returned in the usual way through the SensorEventListener.
- * This call doesn't affect the maxReportLantecy for this sensor. This call is asynchronous and
+ * This call doesn't affect the maxReportLatency for this sensor. This call is asynchronous and
* returns immediately.
* {@link android.hardware.SensorEventListener2#onFlushCompleted onFlushCompleted} is called
* after all the events in the batch at the time of calling this method have been delivered
@@ -902,7 +902,7 @@ public abstract class SensorManager {
* Create a sensor direct channel backed by shared memory wrapped in MemoryFile object.
*
* The resulting channel can be used for delivering sensor events to native code, other
- * processes, GPU/DSP or other co-processors without CPU intervention. This is the recommanded
+ * processes, GPU/DSP or other co-processors without CPU intervention. This is the recommended
* for high performance sensor applications that use high sensor rates (e.g. greater than 200Hz)
* and cares about sensor event latency.
*
@@ -924,7 +924,7 @@ public abstract class SensorManager {
* Create a sensor direct channel backed by shared memory wrapped in HardwareBuffer object.
*
* The resulting channel can be used for delivering sensor events to native code, other
- * processes, GPU/DSP or other co-processors without CPU intervention. This is the recommanded
+ * processes, GPU/DSP or other co-processors without CPU intervention. This is the recommended
* for high performance sensor applications that use high sensor rates (e.g. greater than 200Hz)
* and cares about sensor event latency.
*
@@ -1334,11 +1334,11 @@ public abstract class SensorManager {
* returned by {@link #getRotationMatrix}.
*
* @param X
- * defines the axis of the new cooridinate system that coincide with the X axis of the
+ * defines the axis of the new coordinate system that coincide with the X axis of the
* original coordinate system.
*
* @param Y
- * defines the axis of the new cooridinate system that coincide with the Y axis of the
+ * defines the axis of the new coordinate system that coincide with the Y axis of the
* original coordinate system.
*
* @param outR
@@ -1826,7 +1826,7 @@ public abstract class SensorManager {
* This method is used to inject raw sensor data into the HAL. Call {@link
* initDataInjection(boolean)} before this method to set the HAL in data injection mode. This
* method should be called only if a previous call to initDataInjection has been successful and
- * the HAL and SensorService are already opreating in data injection mode.
+ * the HAL and SensorService are already operating in data injection mode.
*
* @param sensor The sensor to inject.
* @param values Sensor values to inject. The length of this
diff --git a/core/java/android/hardware/SystemSensorManager.java b/core/java/android/hardware/SystemSensorManager.java
index 1c4898a4c8d0..3d87fa3f0a94 100644
--- a/core/java/android/hardware/SystemSensorManager.java
+++ b/core/java/android/hardware/SystemSensorManager.java
@@ -453,7 +453,7 @@ public class SystemSensorManager extends SensorManager {
public void onReceive(Context context, Intent intent) {
if (intent.getAction() == Intent.ACTION_DYNAMIC_SENSOR_CHANGED) {
if (DEBUG_DYNAMIC_SENSOR) {
- Log.i(TAG, "DYNS received DYNAMIC_SENSOR_CHANED broadcast");
+ Log.i(TAG, "DYNS received DYNAMIC_SENSOR_CHANGED broadcast");
}
// Dynamic sensors probably changed
mDynamicSensorListDirty = true;
@@ -498,7 +498,7 @@ public class SystemSensorManager extends SensorManager {
protected void unregisterDynamicSensorCallbackImpl(
DynamicSensorCallback callback) {
if (DEBUG_DYNAMIC_SENSOR) {
- Log.i(TAG, "Removing dynamic sensor listerner");
+ Log.i(TAG, "Removing dynamic sensor listener");
}
mDynamicSensorCallbacks.remove(callback);
}
@@ -624,7 +624,7 @@ public class SystemSensorManager extends SensorManager {
}
if (hardwareBuffer.getWidth() < MIN_DIRECT_CHANNEL_BUFFER_SIZE) {
throw new IllegalArgumentException(
- "Width if HaradwareBuffer must be greater than "
+ "Width if HardwareBuffer must be greater than "
+ MIN_DIRECT_CHANNEL_BUFFER_SIZE);
}
if ((hardwareBuffer.getUsage() & HardwareBuffer.USAGE_SENSOR_DIRECT_DATA) == 0) {
@@ -655,7 +655,7 @@ public class SystemSensorManager extends SensorManager {
/*
* BaseEventQueue is the communication channel with the sensor service,
- * SensorEventQueue, TriggerEventQueue are subclases and there is one-to-one mapping between
+ * SensorEventQueue, TriggerEventQueue are subclasses and there is one-to-one mapping between
* the queues and the listeners. InjectEventQueue is also a sub-class which is a special case
* where data is being injected into the sensor HAL through the sensor service. It is not
* associated with any listener and there is one InjectEventQueue associated with a
diff --git a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
index a6c79b3a289f..9179f5de1a4f 100644
--- a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
+++ b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java
@@ -2228,6 +2228,12 @@ public class CameraDeviceImpl extends CameraDevice
} else {
List<CaptureResult> partialResults =
mFrameNumberTracker.popPartialResults(frameNumber);
+ if (mBatchOutputMap.containsKey(requestId)) {
+ int requestCount = mBatchOutputMap.get(requestId);
+ for (int i = 1; i < requestCount; i++) {
+ mFrameNumberTracker.popPartialResults(frameNumber - (requestCount - i));
+ }
+ }
final long sensorTimestamp =
result.get(CaptureResult.SENSOR_TIMESTAMP);
diff --git a/core/java/android/hardware/usb/OWNERS b/core/java/android/hardware/usb/OWNERS
index 8f5c2a025672..a753f9634d0d 100644
--- a/core/java/android/hardware/usb/OWNERS
+++ b/core/java/android/hardware/usb/OWNERS
@@ -1,3 +1,7 @@
# Bug component: 175220
+aprasath@google.com
+kumarashishg@google.com
+sarup@google.com
+anothermark@google.com
badhri@google.com
diff --git a/core/java/android/net/VpnManager.java b/core/java/android/net/VpnManager.java
index 2e64a74a5d67..ff47f3fc30aa 100644
--- a/core/java/android/net/VpnManager.java
+++ b/core/java/android/net/VpnManager.java
@@ -444,7 +444,7 @@ public class VpnManager {
* Retrieve the VpnProfileState for the profile provisioned by the calling package.
*
* @return the VpnProfileState with current information, or null if there was no profile
- * provisioned by the calling package.
+ * provisioned and started by the calling package.
*/
@Nullable
public VpnProfileState getProvisionedVpnProfileState() {
diff --git a/core/java/android/net/metrics/WakeupStats.java b/core/java/android/net/metrics/WakeupStats.java
index bb36536fe2ce..fac747c8f1a3 100644
--- a/core/java/android/net/metrics/WakeupStats.java
+++ b/core/java/android/net/metrics/WakeupStats.java
@@ -80,18 +80,20 @@ public class WakeupStats {
break;
}
- switch (ev.dstHwAddr.getAddressType()) {
- case MacAddress.TYPE_UNICAST:
- l2UnicastCount++;
- break;
- case MacAddress.TYPE_MULTICAST:
- l2MulticastCount++;
- break;
- case MacAddress.TYPE_BROADCAST:
- l2BroadcastCount++;
- break;
- default:
- break;
+ if (ev.dstHwAddr != null) {
+ switch (ev.dstHwAddr.getAddressType()) {
+ case MacAddress.TYPE_UNICAST:
+ l2UnicastCount++;
+ break;
+ case MacAddress.TYPE_MULTICAST:
+ l2MulticastCount++;
+ break;
+ case MacAddress.TYPE_BROADCAST:
+ l2BroadcastCount++;
+ break;
+ default:
+ break;
+ }
}
increment(ethertypes, ev.ethertype);
diff --git a/core/java/android/nfc/NfcAntennaInfo.java b/core/java/android/nfc/NfcAntennaInfo.java
index d54fcd2ed5b3..b002ca21e8e3 100644
--- a/core/java/android/nfc/NfcAntennaInfo.java
+++ b/core/java/android/nfc/NfcAntennaInfo.java
@@ -85,8 +85,8 @@ public final class NfcAntennaInfo implements Parcelable {
this.mDeviceHeight = in.readInt();
this.mDeviceFoldable = in.readByte() != 0;
this.mAvailableNfcAntennas = new ArrayList<>();
- in.readParcelableList(this.mAvailableNfcAntennas,
- AvailableNfcAntenna.class.getClassLoader());
+ in.readTypedList(this.mAvailableNfcAntennas,
+ AvailableNfcAntenna.CREATOR);
}
public static final @NonNull Parcelable.Creator<NfcAntennaInfo> CREATOR =
diff --git a/core/java/android/os/BatteryManager.java b/core/java/android/os/BatteryManager.java
index 6bc0f6ea947c..092923e927a3 100644
--- a/core/java/android/os/BatteryManager.java
+++ b/core/java/android/os/BatteryManager.java
@@ -20,6 +20,7 @@ import android.Manifest.permission;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.SystemService;
+import android.annotation.TestApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.Intent;
@@ -232,6 +233,7 @@ public class BatteryManager {
OsProtoEnums.CHARGING_POLICY_ADAPTIVE_LONGLIFE; // = 4
/** @hide */
+ @TestApi
public static final int BATTERY_PLUGGED_ANY =
BATTERY_PLUGGED_AC | BATTERY_PLUGGED_USB | BATTERY_PLUGGED_WIRELESS
| BATTERY_PLUGGED_DOCK;
diff --git a/core/java/android/os/BatteryStatsManager.java b/core/java/android/os/BatteryStatsManager.java
index 071bdea5e3ac..955fad3d1a48 100644
--- a/core/java/android/os/BatteryStatsManager.java
+++ b/core/java/android/os/BatteryStatsManager.java
@@ -520,14 +520,10 @@ public final class BatteryStatsManager {
* @param uid calling package uid
* @param reason why Bluetooth has been turned on
* @param packageName package responsible for this change
+ * @Deprecated Bluetooth self report its state and no longer call this
*/
@RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
public void reportBluetoothOn(int uid, int reason, @NonNull String packageName) {
- try {
- mBatteryStats.noteBluetoothOn(uid, reason, packageName);
- } catch (RemoteException e) {
- e.rethrowFromSystemServer();
- }
}
/**
@@ -536,14 +532,10 @@ public final class BatteryStatsManager {
* @param uid calling package uid
* @param reason why Bluetooth has been turned on
* @param packageName package responsible for this change
+ * @Deprecated Bluetooth self report its state and no longer call this
*/
@RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
public void reportBluetoothOff(int uid, int reason, @NonNull String packageName) {
- try {
- mBatteryStats.noteBluetoothOff(uid, reason, packageName);
- } catch (RemoteException e) {
- e.rethrowFromSystemServer();
- }
}
/**
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java
index 0cb7df73f9b7..5d0a723241b0 100644
--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -325,7 +325,24 @@ public class Binder implements IBinder {
* @hide
*/
@CriticalNative
- public static final native boolean isDirectlyHandlingTransaction();
+ public static final native boolean isDirectlyHandlingTransactionNative();
+
+ private static boolean sIsHandlingBinderTransaction = false;
+
+ /**
+ * @hide
+ */
+ public static final boolean isDirectlyHandlingTransaction() {
+ return sIsHandlingBinderTransaction || isDirectlyHandlingTransactionNative();
+ }
+
+ /**
+ * This is Test API which will be used to override output of isDirectlyHandlingTransactionNative
+ * @hide
+ */
+ public static void setIsDirectlyHandlingTransactionOverride(boolean isInTransaction) {
+ sIsHandlingBinderTransaction = isInTransaction;
+ }
/**
* Returns {@code true} if the current thread has had its identity
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 244632a87593..2e05b8dc8da3 100755
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -1223,6 +1223,11 @@ public class Build {
* Upside Down Cake.
*/
public static final int UPSIDE_DOWN_CAKE = CUR_DEVELOPMENT;
+
+ /**
+ * Vanilla Ice Cream.
+ */
+ public static final int VANILLA_ICE_CREAM = CUR_DEVELOPMENT;
}
/** The type of build, like "user" or "eng". */
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java
index 0f5fc34bcc21..cdc8268fa7a1 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -63,6 +63,7 @@ import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -363,6 +364,22 @@ public final class Parcel {
// see libbinder's binder/Status.h
private static final int EX_TRANSACTION_FAILED = -129;
+ // Allow limit of 1 MB for allocating arrays
+ private static final int ARRAY_ALLOCATION_LIMIT = 1000000;
+
+ // Following type size are used to determine allocation size while creating arrays
+ private static final int SIZE_BYTE = 1;
+ private static final int SIZE_CHAR = 2;
+ private static final int SIZE_SHORT = 2;
+ private static final int SIZE_BOOLEAN = 4;
+ private static final int SIZE_INT = 4;
+ private static final int SIZE_FLOAT = 4;
+ private static final int SIZE_DOUBLE = 8;
+ private static final int SIZE_LONG = 8;
+
+ // Assume the least possible size for complex objects
+ private static final int SIZE_COMPLEX_TYPE = 1;
+
@CriticalNative
private static native void nativeMarkSensitive(long nativePtr);
@FastNative
@@ -1503,9 +1520,71 @@ public final class Parcel {
}
}
+ private static <T> int getItemTypeSize(@NonNull Class<T> arrayClass) {
+ final Class<?> componentType = arrayClass.getComponentType();
+ // typeSize has been referred from respective create*Array functions
+ if (componentType == boolean.class) {
+ return SIZE_BOOLEAN;
+ } else if (componentType == byte.class) {
+ return SIZE_BYTE;
+ } else if (componentType == char.class) {
+ return SIZE_CHAR;
+ } else if (componentType == int.class) {
+ return SIZE_INT;
+ } else if (componentType == long.class) {
+ return SIZE_LONG;
+ } else if (componentType == float.class) {
+ return SIZE_FLOAT;
+ } else if (componentType == double.class) {
+ return SIZE_DOUBLE;
+ }
+
+ return SIZE_COMPLEX_TYPE;
+ }
+
+ private void ensureWithinMemoryLimit(int typeSize, @NonNull int... dimensions) {
+ // For Multidimensional arrays, Calculate total object
+ // which will be allocated.
+ int totalObjects = 1;
+ try {
+ for (int dimension : dimensions) {
+ totalObjects = Math.multiplyExact(totalObjects, dimension);
+ }
+ } catch (ArithmeticException e) {
+ Log.e(TAG, "ArithmeticException occurred while multiplying dimensions " + e);
+ BadParcelableException badParcelableException = new BadParcelableException("Estimated "
+ + "array length is too large. Array Dimensions:" + Arrays.toString(dimensions));
+ SneakyThrow.sneakyThrow(badParcelableException);
+ }
+ ensureWithinMemoryLimit(typeSize, totalObjects);
+ }
+
+ private void ensureWithinMemoryLimit(int typeSize, @NonNull int length) {
+ int estimatedAllocationSize = 0;
+ try {
+ estimatedAllocationSize = Math.multiplyExact(typeSize, length);
+ } catch (ArithmeticException e) {
+ Log.e(TAG, "ArithmeticException occurred while multiplying values " + typeSize
+ + " and " + length + " Exception: " + e);
+ BadParcelableException badParcelableException = new BadParcelableException("Estimated "
+ + "allocation size is too large. typeSize: " + typeSize + " length: " + length);
+ SneakyThrow.sneakyThrow(badParcelableException);
+ }
+
+ boolean isInBinderTransaction = Binder.isDirectlyHandlingTransaction();
+ if (isInBinderTransaction && (estimatedAllocationSize > ARRAY_ALLOCATION_LIMIT)) {
+ Log.e(TAG, "Trying to Allocate " + estimatedAllocationSize
+ + " memory, In Binder Transaction : " + isInBinderTransaction);
+ BadParcelableException e = new BadParcelableException("Allocation of size "
+ + estimatedAllocationSize + " is above allowed limit of 1MB");
+ SneakyThrow.sneakyThrow(e);
+ }
+ }
+
@Nullable
public final boolean[] createBooleanArray() {
int N = readInt();
+ ensureWithinMemoryLimit(SIZE_BOOLEAN, N);
// >>2 as a fast divide-by-4 works in the create*Array() functions
// because dataAvail() will never return a negative number. 4 is
// the size of a stored boolean in the stream.
@@ -1548,6 +1627,7 @@ public final class Parcel {
@Nullable
public short[] createShortArray() {
int n = readInt();
+ ensureWithinMemoryLimit(SIZE_SHORT, n);
if (n >= 0 && n <= (dataAvail() >> 2)) {
short[] val = new short[n];
for (int i = 0; i < n; i++) {
@@ -1586,6 +1666,7 @@ public final class Parcel {
@Nullable
public final char[] createCharArray() {
int N = readInt();
+ ensureWithinMemoryLimit(SIZE_CHAR, N);
if (N >= 0 && N <= (dataAvail() >> 2)) {
char[] val = new char[N];
for (int i=0; i<N; i++) {
@@ -1623,6 +1704,7 @@ public final class Parcel {
@Nullable
public final int[] createIntArray() {
int N = readInt();
+ ensureWithinMemoryLimit(SIZE_INT, N);
if (N >= 0 && N <= (dataAvail() >> 2)) {
int[] val = new int[N];
for (int i=0; i<N; i++) {
@@ -1660,6 +1742,7 @@ public final class Parcel {
@Nullable
public final long[] createLongArray() {
int N = readInt();
+ ensureWithinMemoryLimit(SIZE_LONG, N);
// >>3 because stored longs are 64 bits
if (N >= 0 && N <= (dataAvail() >> 3)) {
long[] val = new long[N];
@@ -1698,6 +1781,7 @@ public final class Parcel {
@Nullable
public final float[] createFloatArray() {
int N = readInt();
+ ensureWithinMemoryLimit(SIZE_FLOAT, N);
// >>2 because stored floats are 4 bytes
if (N >= 0 && N <= (dataAvail() >> 2)) {
float[] val = new float[N];
@@ -1736,6 +1820,7 @@ public final class Parcel {
@Nullable
public final double[] createDoubleArray() {
int N = readInt();
+ ensureWithinMemoryLimit(SIZE_DOUBLE, N);
// >>3 because stored doubles are 8 bytes
if (N >= 0 && N <= (dataAvail() >> 3)) {
double[] val = new double[N];
@@ -1789,6 +1874,7 @@ public final class Parcel {
@Nullable
public final String[] createString8Array() {
int N = readInt();
+ ensureWithinMemoryLimit(SIZE_COMPLEX_TYPE, N);
if (N >= 0) {
String[] val = new String[N];
for (int i=0; i<N; i++) {
@@ -1829,6 +1915,7 @@ public final class Parcel {
@Nullable
public final String[] createString16Array() {
int N = readInt();
+ ensureWithinMemoryLimit(SIZE_COMPLEX_TYPE, N);
if (N >= 0) {
String[] val = new String[N];
for (int i=0; i<N; i++) {
@@ -1921,6 +2008,7 @@ public final class Parcel {
@Nullable
public final IBinder[] createBinderArray() {
int N = readInt();
+ ensureWithinMemoryLimit(SIZE_COMPLEX_TYPE, N);
if (N >= 0) {
IBinder[] val = new IBinder[N];
for (int i=0; i<N; i++) {
@@ -1955,6 +2043,7 @@ public final class Parcel {
public final <T extends IInterface> T[] createInterfaceArray(
@NonNull IntFunction<T[]> newArray, @NonNull Function<IBinder, T> asInterface) {
int N = readInt();
+ ensureWithinMemoryLimit(SIZE_COMPLEX_TYPE, N);
if (N >= 0) {
T[] val = newArray.apply(N);
for (int i=0; i<N; i++) {
@@ -3201,6 +3290,7 @@ public final class Parcel {
if (N < 0) {
return null;
}
+ ensureWithinMemoryLimit(SIZE_COMPLEX_TYPE, N);
FileDescriptor[] f = new FileDescriptor[N];
for (int i = 0; i < N; i++) {
f[i] = readRawFileDescriptor();
@@ -3667,6 +3757,7 @@ public final class Parcel {
if (N < 0) {
return null;
}
+ ensureWithinMemoryLimit(SIZE_COMPLEX_TYPE, N);
ArrayList<T> l = new ArrayList<T>(N);
while (N > 0) {
l.add(readTypedObject(c));
@@ -3721,6 +3812,7 @@ public final class Parcel {
if (count < 0) {
return null;
}
+ ensureWithinMemoryLimit(SIZE_COMPLEX_TYPE, count);
final SparseArray<T> array = new SparseArray<>(count);
for (int i = 0; i < count; i++) {
final int index = readInt();
@@ -3749,6 +3841,7 @@ public final class Parcel {
if (count < 0) {
return null;
}
+ ensureWithinMemoryLimit(SIZE_COMPLEX_TYPE, count);
final ArrayMap<String, T> map = new ArrayMap<>(count);
for (int i = 0; i < count; i++) {
final String key = readString();
@@ -3775,6 +3868,7 @@ public final class Parcel {
if (N < 0) {
return null;
}
+ ensureWithinMemoryLimit(SIZE_COMPLEX_TYPE, N);
ArrayList<String> l = new ArrayList<String>(N);
while (N > 0) {
l.add(readString());
@@ -3800,6 +3894,7 @@ public final class Parcel {
if (N < 0) {
return null;
}
+ ensureWithinMemoryLimit(SIZE_COMPLEX_TYPE, N);
ArrayList<IBinder> l = new ArrayList<IBinder>(N);
while (N > 0) {
l.add(readStrongBinder());
@@ -3826,6 +3921,7 @@ public final class Parcel {
if (N < 0) {
return null;
}
+ ensureWithinMemoryLimit(SIZE_COMPLEX_TYPE, N);
ArrayList<T> l = new ArrayList<T>(N);
while (N > 0) {
l.add(asInterface.apply(readStrongBinder()));
@@ -3985,6 +4081,7 @@ public final class Parcel {
if (N < 0) {
return null;
}
+ ensureWithinMemoryLimit(SIZE_COMPLEX_TYPE, N);
T[] l = c.newArray(N);
for (int i=0; i<N; i++) {
l[i] = readTypedObject(c);
@@ -4213,6 +4310,10 @@ public final class Parcel {
while (innermost.isArray()) {
innermost = innermost.getComponentType();
}
+
+ int typeSize = getItemTypeSize(innermost);
+ ensureWithinMemoryLimit(typeSize, dimensions);
+
val = (T) Array.newInstance(innermost, dimensions);
for (int i = 0; i < length; i++) {
readFixedArray(Array.get(val, i));
@@ -4269,6 +4370,10 @@ public final class Parcel {
while (innermost.isArray()) {
innermost = innermost.getComponentType();
}
+
+ int typeSize = getItemTypeSize(innermost);
+ ensureWithinMemoryLimit(typeSize, dimensions);
+
val = (T) Array.newInstance(innermost, dimensions);
for (int i = 0; i < length; i++) {
readFixedArray(Array.get(val, i), asInterface);
@@ -4324,6 +4429,10 @@ public final class Parcel {
while (innermost.isArray()) {
innermost = innermost.getComponentType();
}
+
+ int typeSize = getItemTypeSize(innermost);
+ ensureWithinMemoryLimit(typeSize, dimensions);
+
val = (T) Array.newInstance(innermost, dimensions);
for (int i = 0; i < length; i++) {
readFixedArray(Array.get(val, i), c);
@@ -5069,6 +5178,7 @@ public final class Parcel {
if (n < 0) {
return null;
}
+ ensureWithinMemoryLimit(SIZE_COMPLEX_TYPE, n);
T[] p = (T[]) ((clazz == null) ? new Parcelable[n] : Array.newInstance(clazz, n));
for (int i = 0; i < n; i++) {
p[i] = readParcelableInternal(loader, clazz);
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index bb74e1983510..89da45b045a3 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -1360,7 +1360,7 @@ public class Process {
String formatSize = MemoryProperties.memory_ddr_size().orElse("0KB");
long memSize = FileUtils.parseSize(formatSize);
- if (memSize == Long.MIN_VALUE) {
+ if (memSize <= 0) {
return FileUtils.roundStorageSize(getTotalMemory());
}
diff --git a/core/java/android/os/image/DynamicSystemClient.java b/core/java/android/os/image/DynamicSystemClient.java
index 7cdaecddbd70..d5364dff4156 100644
--- a/core/java/android/os/image/DynamicSystemClient.java
+++ b/core/java/android/os/image/DynamicSystemClient.java
@@ -209,6 +209,13 @@ public class DynamicSystemClient {
public static final String ACTION_HIDE_NOTIFICATION =
"android.os.image.action.HIDE_NOTIFICATION";
+ /**
+ * Intent action: notify the service to post a status update when keyguard is dismissed.
+ * @hide
+ */
+ public static final String ACTION_NOTIFY_KEYGUARD_DISMISSED =
+ "android.os.image.action.NOTIFY_KEYGUARD_DISMISSED";
+
/*
* Intent Keys
*/
diff --git a/core/java/android/os/image/DynamicSystemManager.java b/core/java/android/os/image/DynamicSystemManager.java
index 9610b16a312c..536795bafb1c 100644
--- a/core/java/android/os/image/DynamicSystemManager.java
+++ b/core/java/android/os/image/DynamicSystemManager.java
@@ -285,4 +285,16 @@ public class DynamicSystemManager {
throw new RuntimeException(e.toString());
}
}
+
+ /**
+ * Returns the active DSU slot
+ */
+ @RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
+ public String getActiveDsuSlot() {
+ try {
+ return mService.getActiveDsuSlot();
+ } catch (RemoteException e) {
+ throw new RuntimeException(e.toString());
+ }
+ }
}
diff --git a/core/java/android/os/image/IDynamicSystemService.aidl b/core/java/android/os/image/IDynamicSystemService.aidl
index 755368a85c40..0280ebbd87ab 100644
--- a/core/java/android/os/image/IDynamicSystemService.aidl
+++ b/core/java/android/os/image/IDynamicSystemService.aidl
@@ -145,4 +145,10 @@ interface IDynamicSystemService
*/
@EnforcePermission("MANAGE_DYNAMIC_SYSTEM")
long suggestScratchSize();
+
+ /**
+ * Get the active DSU slot
+ */
+ @EnforcePermission("MANAGE_DYNAMIC_SYSTEM")
+ String getActiveDsuSlot();
}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index fe0c1dd65bef..038beabcf22f 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -14615,18 +14615,6 @@ public final class Settings {
public static final String ANGLE_EGL_FEATURES = "angle_egl_features";
/**
- * Comma-separated list of package names that ANGLE may have issues with
- * @hide
- */
- public static final String ANGLE_DEFERLIST = "angle_deferlist";
-
- /**
- * Integer mode of the logic for applying `angle_deferlist`
- * @hide
- */
- public static final String ANGLE_DEFERLIST_MODE = "angle_deferlist_mode";
-
- /**
* Show the "ANGLE In Use" dialog box to the user when ANGLE is the OpenGL driver.
* The value is a boolean (1 or 0).
* @hide
diff --git a/core/java/android/security/keymaster/KeymasterDefs.java b/core/java/android/security/keymaster/KeymasterDefs.java
index 4d6422c670c2..9088a7790db4 100644
--- a/core/java/android/security/keymaster/KeymasterDefs.java
+++ b/core/java/android/security/keymaster/KeymasterDefs.java
@@ -337,8 +337,22 @@ public final class KeymasterDefs {
ErrorCode.ROLLBACK_RESISTANCE_UNAVAILABLE; // -67;
public static final int KM_ERROR_HARDWARE_TYPE_UNAVAILABLE =
ErrorCode.HARDWARE_TYPE_UNAVAILABLE; // -68;
+ public static final int KM_ERROR_PROOF_OF_PRESENCE_REQUIRED =
+ ErrorCode.PROOF_OF_PRESENCE_REQUIRED; // -69;
+ public static final int KM_ERROR_CONCURRENT_PROOF_OF_PRESENCE_REQUESTED =
+ ErrorCode.CONCURRENT_PROOF_OF_PRESENCE_REQUESTED; // -70;
+ public static final int KM_ERROR_NO_USER_CONFIRMATION =
+ ErrorCode.NO_USER_CONFIRMATION; // -71;
public static final int KM_ERROR_DEVICE_LOCKED =
ErrorCode.DEVICE_LOCKED; // -72;
+ public static final int KM_ERROR_EARLY_BOOT_ENDED =
+ ErrorCode.EARLY_BOOT_ENDED; // -73;
+ public static final int KM_ERROR_ATTESTATION_KEYS_NOT_PROVISIONED =
+ ErrorCode.ATTESTATION_KEYS_NOT_PROVISIONED; // -74;
+ public static final int KM_ERROR_ATTESTATION_IDS_NOT_PROVISIONED =
+ ErrorCode.ATTESTATION_IDS_NOT_PROVISIONED; // -75;
+ public static final int KM_ERROR_INVALID_OPERATION =
+ ErrorCode.INVALID_OPERATION; // -76;
public static final int KM_ERROR_STORAGE_KEY_UNSUPPORTED =
ErrorCode.STORAGE_KEY_UNSUPPORTED; // -77,
public static final int KM_ERROR_INCOMPATIBLE_MGF_DIGEST =
@@ -348,7 +362,13 @@ public final class KeymasterDefs {
public static final int KM_ERROR_MISSING_NOT_BEFORE =
ErrorCode.MISSING_NOT_BEFORE; // -80;
public static final int KM_ERROR_MISSING_NOT_AFTER =
- ErrorCode.MISSING_NOT_AFTER; // -80;
+ ErrorCode.MISSING_NOT_AFTER; // -81;
+ public static final int KM_ERROR_MISSING_ISSUER_SUBJECT =
+ ErrorCode.MISSING_ISSUER_SUBJECT; // -82;
+ public static final int KM_ERROR_INVALID_ISSUER_SUBJECT =
+ ErrorCode.INVALID_ISSUER_SUBJECT; // -83;
+ public static final int KM_ERROR_BOOT_LEVEL_EXCEEDED =
+ ErrorCode.BOOT_LEVEL_EXCEEDED; // -84;
public static final int KM_ERROR_HARDWARE_NOT_YET_AVAILABLE =
ErrorCode.HARDWARE_NOT_YET_AVAILABLE; // -85
public static final int KM_ERROR_UNIMPLEMENTED =
diff --git a/core/java/android/speech/OWNERS b/core/java/android/speech/OWNERS
index 462d8bed743c..162e02904075 100644
--- a/core/java/android/speech/OWNERS
+++ b/core/java/android/speech/OWNERS
@@ -2,3 +2,4 @@ volnov@google.com
eugeniom@google.com
schfan@google.com
andreaambu@google.com
+hackz@google.com \ No newline at end of file
diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java
index 7ac6ae186cc3..c4ae963c1312 100644
--- a/core/java/android/text/TextUtils.java
+++ b/core/java/android/text/TextUtils.java
@@ -871,126 +871,128 @@ public class TextUtils {
if (kind == 0)
break;
+ final Object span;
switch (kind) {
case ALIGNMENT_SPAN:
- readSpan(p, sp, new AlignmentSpan.Standard(p));
+ span = new AlignmentSpan.Standard(p);
break;
case FOREGROUND_COLOR_SPAN:
- readSpan(p, sp, new ForegroundColorSpan(p));
+ span = new ForegroundColorSpan(p);
break;
case RELATIVE_SIZE_SPAN:
- readSpan(p, sp, new RelativeSizeSpan(p));
+ span = new RelativeSizeSpan(p);
break;
case SCALE_X_SPAN:
- readSpan(p, sp, new ScaleXSpan(p));
+ span = new ScaleXSpan(p);
break;
case STRIKETHROUGH_SPAN:
- readSpan(p, sp, new StrikethroughSpan(p));
+ span = new StrikethroughSpan(p);
break;
case UNDERLINE_SPAN:
- readSpan(p, sp, new UnderlineSpan(p));
+ span = new UnderlineSpan(p);
break;
case STYLE_SPAN:
- readSpan(p, sp, new StyleSpan(p));
+ span = new StyleSpan(p);
break;
case BULLET_SPAN:
- readSpan(p, sp, new BulletSpan(p));
+ span = new BulletSpan(p);
break;
case QUOTE_SPAN:
- readSpan(p, sp, new QuoteSpan(p));
+ span = new QuoteSpan(p);
break;
case LEADING_MARGIN_SPAN:
- readSpan(p, sp, new LeadingMarginSpan.Standard(p));
+ span = new LeadingMarginSpan.Standard(p);
break;
case URL_SPAN:
- readSpan(p, sp, new URLSpan(p));
+ span = new URLSpan(p);
break;
case BACKGROUND_COLOR_SPAN:
- readSpan(p, sp, new BackgroundColorSpan(p));
+ span = new BackgroundColorSpan(p);
break;
case TYPEFACE_SPAN:
- readSpan(p, sp, new TypefaceSpan(p));
+ span = new TypefaceSpan(p);
break;
case SUPERSCRIPT_SPAN:
- readSpan(p, sp, new SuperscriptSpan(p));
+ span = new SuperscriptSpan(p);
break;
case SUBSCRIPT_SPAN:
- readSpan(p, sp, new SubscriptSpan(p));
+ span = new SubscriptSpan(p);
break;
case ABSOLUTE_SIZE_SPAN:
- readSpan(p, sp, new AbsoluteSizeSpan(p));
+ span = new AbsoluteSizeSpan(p);
break;
case TEXT_APPEARANCE_SPAN:
- readSpan(p, sp, new TextAppearanceSpan(p));
+ span = new TextAppearanceSpan(p);
break;
case ANNOTATION:
- readSpan(p, sp, new Annotation(p));
+ span = new Annotation(p);
break;
case SUGGESTION_SPAN:
- readSpan(p, sp, new SuggestionSpan(p));
+ span = new SuggestionSpan(p);
break;
case SPELL_CHECK_SPAN:
- readSpan(p, sp, new SpellCheckSpan(p));
+ span = new SpellCheckSpan(p);
break;
case SUGGESTION_RANGE_SPAN:
- readSpan(p, sp, new SuggestionRangeSpan(p));
+ span = new SuggestionRangeSpan(p);
break;
case EASY_EDIT_SPAN:
- readSpan(p, sp, new EasyEditSpan(p));
+ span = new EasyEditSpan(p);
break;
case LOCALE_SPAN:
- readSpan(p, sp, new LocaleSpan(p));
+ span = new LocaleSpan(p);
break;
case TTS_SPAN:
- readSpan(p, sp, new TtsSpan(p));
+ span = new TtsSpan(p);
break;
case ACCESSIBILITY_CLICKABLE_SPAN:
- readSpan(p, sp, new AccessibilityClickableSpan(p));
+ span = new AccessibilityClickableSpan(p);
break;
case ACCESSIBILITY_URL_SPAN:
- readSpan(p, sp, new AccessibilityURLSpan(p));
+ span = new AccessibilityURLSpan(p);
break;
case LINE_BACKGROUND_SPAN:
- readSpan(p, sp, new LineBackgroundSpan.Standard(p));
+ span = new LineBackgroundSpan.Standard(p);
break;
case LINE_HEIGHT_SPAN:
- readSpan(p, sp, new LineHeightSpan.Standard(p));
+ span = new LineHeightSpan.Standard(p);
break;
case ACCESSIBILITY_REPLACEMENT_SPAN:
- readSpan(p, sp, new AccessibilityReplacementSpan(p));
+ span = new AccessibilityReplacementSpan(p);
break;
default:
throw new RuntimeException("bogus span encoding " + kind);
}
+ readSpan(p, sp, span);
}
return sp;
diff --git a/core/java/android/text/util/Linkify.java b/core/java/android/text/util/Linkify.java
index 946fc30eecb3..fb6de56b0952 100644
--- a/core/java/android/text/util/Linkify.java
+++ b/core/java/android/text/util/Linkify.java
@@ -31,6 +31,7 @@ import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.text.method.MovementMethod;
import android.text.style.URLSpan;
+import android.text.TextUtils;
import android.util.Log;
import android.util.Patterns;
import android.webkit.WebView;
@@ -672,8 +673,15 @@ public class Linkify {
@Nullable Context context) {
PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
final Context ctx = (context != null) ? context : ActivityThread.currentApplication();
- final String regionCode = (ctx != null) ? ctx.getSystemService(TelephonyManager.class).
- getSimCountryIso().toUpperCase(Locale.US) : Locale.getDefault().getCountry();
+ String regionCode = Locale.getDefault().getCountry();
+ if (ctx != null) {
+ String simCountryIso = ctx.getSystemService(TelephonyManager.class).getSimCountryIso();
+ if (!TextUtils.isEmpty(simCountryIso)) {
+ // Assign simCountryIso if it is available
+ regionCode = simCountryIso.toUpperCase(Locale.US);
+ }
+ }
+
Iterable<PhoneNumberMatch> matches = phoneUtil.findNumbers(s.toString(),
regionCode, Leniency.POSSIBLE, Long.MAX_VALUE);
for (PhoneNumberMatch match : matches) {
diff --git a/core/java/android/view/GestureDetector.java b/core/java/android/view/GestureDetector.java
index 57ba7e9e816f..0b21e3d500a1 100644
--- a/core/java/android/view/GestureDetector.java
+++ b/core/java/android/view/GestureDetector.java
@@ -839,8 +839,10 @@ public class GestureDetector {
mHandler.removeMessages(SHOW_PRESS);
mHandler.removeMessages(LONG_PRESS);
mHandler.removeMessages(TAP);
- mVelocityTracker.recycle();
- mVelocityTracker = null;
+ if (mVelocityTracker != null) {
+ mVelocityTracker.recycle();
+ mVelocityTracker = null;
+ }
mIsDoubleTapping = false;
mStillDown = false;
mAlwaysInTapRegion = false;
diff --git a/core/java/android/view/contentcapture/OWNERS b/core/java/android/view/contentcapture/OWNERS
index 1a5cb1e4ca4a..e4b09524ede7 100644
--- a/core/java/android/view/contentcapture/OWNERS
+++ b/core/java/android/view/contentcapture/OWNERS
@@ -1,7 +1,5 @@
# Bug component: 544200
-augale@google.com
-joannechung@google.com
-markpun@google.com
-lpeter@google.com
-tymtsai@google.com
+hackz@google.com
+shivanker@google.com
+volnov@google.com
diff --git a/core/java/android/view/contentprotection/OWNERS b/core/java/android/view/contentprotection/OWNERS
new file mode 100644
index 000000000000..b3583a7f6ab1
--- /dev/null
+++ b/core/java/android/view/contentprotection/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 544200
+
+include /core/java/android/view/contentcapture/OWNERS
+
diff --git a/core/java/android/webkit/OWNERS b/core/java/android/webkit/OWNERS
index b33da57c42e3..e7fd7a5d1096 100644
--- a/core/java/android/webkit/OWNERS
+++ b/core/java/android/webkit/OWNERS
@@ -1,4 +1,3 @@
-changwan@google.com
+# Bug component: 76427
ntfschr@google.com
-tobiasjs@google.com
torne@google.com
diff --git a/core/java/android/widget/Toast.java b/core/java/android/widget/Toast.java
index fceee4e01799..f00ac1d1e063 100644
--- a/core/java/android/widget/Toast.java
+++ b/core/java/android/widget/Toast.java
@@ -154,8 +154,7 @@ public class Toast {
* Construct an empty Toast object. You must call {@link #setView} before you
* can call {@link #show}.
*
- * @param context The context to use. Usually your {@link android.app.Application}
- * or {@link android.app.Activity} object.
+ * @param context The context to use. Usually your {@link android.app.Activity} object.
*/
public Toast(Context context) {
this(context, null);
@@ -479,8 +478,7 @@ public class Toast {
/**
* Make a standard toast that just contains text.
*
- * @param context The context to use. Usually your {@link android.app.Application}
- * or {@link android.app.Activity} object.
+ * @param context The context to use. Usually your {@link android.app.Activity} object.
* @param text The text to show. Can be formatted text.
* @param duration How long to display the message. Either {@link #LENGTH_SHORT} or
* {@link #LENGTH_LONG}
@@ -536,8 +534,7 @@ public class Toast {
/**
* Make a standard toast that just contains text from a resource.
*
- * @param context The context to use. Usually your {@link android.app.Application}
- * or {@link android.app.Activity} object.
+ * @param context The context to use. Usually your {@link android.app.Activity} object.
* @param resId The resource id of the string resource to use. Can be formatted text.
* @param duration How long to display the message. Either {@link #LENGTH_SHORT} or
* {@link #LENGTH_LONG}
diff --git a/core/java/android/window/WindowOrganizer.java b/core/java/android/window/WindowOrganizer.java
index 2a80d021abd6..740fbacbbfcc 100644
--- a/core/java/android/window/WindowOrganizer.java
+++ b/core/java/android/window/WindowOrganizer.java
@@ -61,9 +61,7 @@ public class WindowOrganizer {
* Apply multiple WindowContainer operations at once.
*
* Note that using this API requires the caller to hold
- * {@link android.Manifest.permission#MANAGE_ACTIVITY_TASKS}, unless the caller is using
- * {@link TaskFragmentOrganizer}, in which case it is allowed to change TaskFragment that is
- * created by itself.
+ * {@link android.Manifest.permission#MANAGE_ACTIVITY_TASKS}.
*
* @param t The transaction to apply.
* @param callback This transaction will use the synchronization scheme described in
@@ -72,8 +70,7 @@ public class WindowOrganizer {
* @return An ID for the sync operation which will later be passed to transactionReady callback.
* This lets the caller differentiate overlapping sync operations.
*/
- @RequiresPermission(value = android.Manifest.permission.MANAGE_ACTIVITY_TASKS,
- conditional = true)
+ @RequiresPermission(value = android.Manifest.permission.MANAGE_ACTIVITY_TASKS)
public int applySyncTransaction(@NonNull WindowContainerTransaction t,
@NonNull WindowContainerTransactionCallback callback) {
try {
diff --git a/core/java/com/android/internal/app/IBatteryStats.aidl b/core/java/com/android/internal/app/IBatteryStats.aidl
index 629a1b36b9e6..ee2084722cc5 100644
--- a/core/java/com/android/internal/app/IBatteryStats.aidl
+++ b/core/java/com/android/internal/app/IBatteryStats.aidl
@@ -145,8 +145,6 @@ interface IBatteryStats {
long getAwakeTimeBattery();
long getAwakeTimePlugged();
- void noteBluetoothOn(int uid, int reason, String packageName);
- void noteBluetoothOff(int uid, int reason, String packageName);
void noteBleScanStarted(in WorkSource ws, boolean isUnoptimized);
void noteBleScanStopped(in WorkSource ws, boolean isUnoptimized);
void noteBleScanReset();
diff --git a/core/java/com/android/internal/jank/OWNERS b/core/java/com/android/internal/jank/OWNERS
index 352c132fda4f..2f3bbeef0d77 100644
--- a/core/java/com/android/internal/jank/OWNERS
+++ b/core/java/com/android/internal/jank/OWNERS
@@ -3,4 +3,5 @@ include /services/core/java/com/android/server/wm/OWNERS
# Jank people
ahanwu@google.com
vadimt@google.com
-marcinoc@google.com \ No newline at end of file
+marcinoc@google.com
+pmuetschard@google.com \ No newline at end of file
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 6919a76b84ba..7c8ea93894a5 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -646,9 +646,7 @@ 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 profileMinFirstSaveOptsBuf[sizeof("-Xps-min-first-save-ms:") - 1 + PROPERTY_VALUE_MAX];
char madviseWillNeedFileSizeVdex[
sizeof("-XMadviseWillNeedVdexFileSize:")-1 + PROPERTY_VALUE_MAX];
char madviseWillNeedFileSizeOdex[
@@ -861,13 +859,8 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote, bool p
jitprithreadweightOptBuf,
"-Xjitprithreadweight:");
- parseRuntimeOption("dalvik.vm.jittransitionweight",
- jittransitionweightOptBuf,
+ parseRuntimeOption("dalvik.vm.jittransitionweight", jittransitionweightOptBuf,
"-Xjittransitionweight:");
- /*
- * Madvise related options.
- */
- parseRuntimeOption("dalvik.vm.madvise-random", madviseRandomOptsBuf, "-XX:MadviseRandomAccess:");
/*
* Use default platform configuration as limits for madvising,
diff --git a/core/jni/OWNERS b/core/jni/OWNERS
index 84b050cdfbdb..a17048c27763 100644
--- a/core/jni/OWNERS
+++ b/core/jni/OWNERS
@@ -102,3 +102,6 @@ per-file com_android_internal_os_*MultiStateCounter* = file:/BATTERY_STATS_OWNER
# PM
per-file com_android_internal_content_* = file:/PACKAGE_MANAGER_OWNERS
+
+# SQLite
+per-file android_database_SQLite* = file:/SQLITE_OWNERS
diff --git a/core/jni/android_media_AudioProductStrategies.cpp b/core/jni/android_media_AudioProductStrategies.cpp
index 34be2a52344d..4b563d7f3bd8 100644
--- a/core/jni/android_media_AudioProductStrategies.cpp
+++ b/core/jni/android_media_AudioProductStrategies.cpp
@@ -86,8 +86,8 @@ static jint convertAudioProductStrategiesFromNative(
// Audio Attributes Group array
int attrGroupIndex = 0;
- std::map<int /**attributesGroupIndex*/, std::vector<AudioAttributes> > groups;
- for (const auto &attr : strategy.getAudioAttributes()) {
+ std::map<int /**attributesGroupIndex*/, std::vector<VolumeGroupAttributes> > groups;
+ for (const auto &attr : strategy.getVolumeGroupAttributes()) {
int groupId = attr.getGroupId();
int streamType = attr.getStreamType();
const auto &iter = std::find_if(begin(groups), end(groups),
@@ -108,17 +108,17 @@ static jint convertAudioProductStrategiesFromNative(
jAudioAttributesGroups = env->NewObjectArray(numAttributesGroups, gAudioAttributesGroupClass, NULL);
for (const auto &iter : groups) {
- std::vector<AudioAttributes> audioAttributesGroups = iter.second;
- jint numAttributes = audioAttributesGroups.size();
- jint jGroupId = audioAttributesGroups.front().getGroupId();
- jint jLegacyStreamType = audioAttributesGroups.front().getStreamType();
+ std::vector<VolumeGroupAttributes> volumeGroupAttributes = iter.second;
+ jint numAttributes = volumeGroupAttributes.size();
+ jint jGroupId = volumeGroupAttributes.front().getGroupId();
+ jint jLegacyStreamType = volumeGroupAttributes.front().getStreamType();
jStatus = JNIAudioAttributeHelper::getJavaArray(env, &jAudioAttributes, numAttributes);
if (jStatus != (jint)AUDIO_JAVA_SUCCESS) {
goto exit;
}
for (size_t j = 0; j < static_cast<size_t>(numAttributes); j++) {
- auto attributes = audioAttributesGroups[j].getAttributes();
+ auto attributes = volumeGroupAttributes[j].getAttributes();
jStatus = JNIAudioAttributeHelper::nativeToJava(env, &jAudioAttribute, attributes);
if (jStatus != AUDIO_JAVA_SUCCESS) {
diff --git a/core/jni/android_media_AudioVolumeGroups.cpp b/core/jni/android_media_AudioVolumeGroups.cpp
index 7098451901c4..1252e89935e5 100644
--- a/core/jni/android_media_AudioVolumeGroups.cpp
+++ b/core/jni/android_media_AudioVolumeGroups.cpp
@@ -94,6 +94,11 @@ static jint convertAudioVolumeGroupsFromNative(
for (size_t j = 0; j < static_cast<size_t>(numAttributes); j++) {
auto attributes = group.getAudioAttributes()[j];
+ // Native & Java audio attributes default initializers are not aligned for the source.
+ // Given the volume group class concerns only playback, this field must be equal to the
+ // default java initializer.
+ attributes.source = AUDIO_SOURCE_INVALID;
+
jStatus = JNIAudioAttributeHelper::nativeToJava(env, &jAudioAttribute, attributes);
if (jStatus != AUDIO_JAVA_SUCCESS) {
goto exit;
diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp
index b24dc8a9e63b..8bc52b874ae0 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -974,7 +974,7 @@ static jint android_os_Binder_getCallingUid()
return IPCThreadState::self()->getCallingUid();
}
-static jboolean android_os_Binder_isDirectlyHandlingTransaction() {
+static jboolean android_os_Binder_isDirectlyHandlingTransactionNative() {
return getCurrentServingCall() == BinderCallType::BINDER;
}
@@ -1082,7 +1082,8 @@ static const JNINativeMethod gBinderMethods[] = {
// @CriticalNative
{ "getCallingUid", "()I", (void*)android_os_Binder_getCallingUid },
// @CriticalNative
- { "isDirectlyHandlingTransaction", "()Z", (void*)android_os_Binder_isDirectlyHandlingTransaction },
+ { "isDirectlyHandlingTransactionNative", "()Z",
+ (void*)android_os_Binder_isDirectlyHandlingTransactionNative },
// @CriticalNative
{ "clearCallingIdentity", "()J", (void*)android_os_Binder_clearCallingIdentity },
// @CriticalNative
diff --git a/core/jni/com_android_internal_os_ZygoteInit.cpp b/core/jni/com_android_internal_os_ZygoteInit.cpp
index a5152b6e689c..56c01ba2c3a3 100644
--- a/core/jni/com_android_internal_os_ZygoteInit.cpp
+++ b/core/jni/com_android_internal_os_ZygoteInit.cpp
@@ -23,43 +23,13 @@
namespace {
-// Shadow call stack (SCS) is a security mitigation that uses a separate stack
-// (the SCS) for return addresses. In versions of Android newer than P, the
-// compiler cooperates with the system to ensure that the SCS address is always
-// stored in register x18, as long as the app was compiled with a new enough
-// compiler and does not use features that rely on SP-HALs (this restriction is
-// because the SP-HALs might not preserve x18 due to potentially having been
-// compiled with an old compiler as a consequence of Treble; it generally means
-// that the app must be a system app without a UI). This struct is used to
-// temporarily store the address on the stack while preloading the SP-HALs, so
-// that such apps can use the same zygote as everything else.
-struct ScopedSCSExit {
-#ifdef __aarch64__
- void* scs;
-
- ScopedSCSExit() {
- __asm__ __volatile__("str x18, [%0]" ::"r"(&scs));
- }
-
- ~ScopedSCSExit() {
- __asm__ __volatile__("ldr x18, [%0]; str xzr, [%0]" ::"r"(&scs));
- }
-#else
- // Silence unused variable warnings in non-SCS builds.
- ScopedSCSExit() {}
- ~ScopedSCSExit() {}
-#endif
-};
-
void android_internal_os_ZygoteInit_nativePreloadAppProcessHALs(JNIEnv* env, jclass) {
- ScopedSCSExit x;
android::GraphicBufferMapper::preloadHal();
// Add preloading here for other HALs that are (a) always passthrough, and
// (b) loaded by most app processes.
}
void android_internal_os_ZygoteInit_nativePreloadGraphicsDriver(JNIEnv* env, jclass) {
- ScopedSCSExit x;
zygote_preload_graphics();
}
diff --git a/core/jni/com_android_internal_security_VerityUtils.cpp b/core/jni/com_android_internal_security_VerityUtils.cpp
index 5553d28db066..6eab12b0eb42 100644
--- a/core/jni/com_android_internal_security_VerityUtils.cpp
+++ b/core/jni/com_android_internal_security_VerityUtils.cpp
@@ -79,7 +79,11 @@ int enableFsverity(JNIEnv *env, jobject /* clazz */, jstring filePath, jbyteArra
int statxForFsverity(JNIEnv *env, jobject /* clazz */, jstring filePath) {
ScopedUtfChars path(env, filePath);
- // Call statx and check STATX_ATTR_VERITY.
+ // There are two ways to check whether a file has fs-verity enabled: statx() and FS_IOC_GETFLAGS
+ // (See https://www.kernel.org/doc/html/latest/filesystems/fsverity.html#statx and
+ // https://www.kernel.org/doc/html/latest/filesystems/fsverity.html#fs-ioc-getflags.)
+ // We try statx() first, since it doesn't require opening the file.
+
struct statx out = {};
if (statx(AT_FDCWD, path.c_str(), 0 /* flags */, STATX_ALL, &out) != 0) {
return -errno;
@@ -89,8 +93,12 @@ int statxForFsverity(JNIEnv *env, jobject /* clazz */, jstring filePath) {
return (out.stx_attributes & STATX_ATTR_VERITY) != 0;
}
- // STATX_ATTR_VERITY is not supported for the file path.
- // In this case, call ioctl(FS_IOC_GETFLAGS) and check FS_VERITY_FL.
+ // The filesystem doesn't support STATX_ATTR_VERITY. This normally means that it doesn't
+ // support fs-verity, in which case we should simply return 0. Unfortunately, virtio-fs is an
+ // exception, since it doesn't support STATX_ATTR_VERITY but does support querying FS_VERITY_FL
+ // via FS_IOC_GETFLAGS. So we have to fall back to FS_IOC_GETFLAGS. Note: despite being an
+ // ioctl, FS_IOC_GETFLAGS doesn't require the "ioctl" SELinux permission but rather "getattr".
+
::android::base::unique_fd rfd(open(path.c_str(), O_RDONLY | O_CLOEXEC));
if (rfd.get() < 0) {
ALOGE("open failed at %s", path.c_str());
@@ -99,6 +107,11 @@ int statxForFsverity(JNIEnv *env, jobject /* clazz */, jstring filePath) {
unsigned int flags;
if (ioctl(rfd.get(), FS_IOC_GETFLAGS, &flags) < 0) {
+ if (errno == ENOTTY) {
+ // If the filesystem supports neither STATX_ATTR_VERITY nor FS_IOC_GETFLAGS, then assume
+ // that it doesn't support fs-verity.
+ return 0;
+ }
ALOGE("ioctl(FS_IOC_GETFLAGS) failed at %s", path.c_str());
return -errno;
}
diff --git a/core/proto/android/input/OWNERS b/core/proto/android/input/OWNERS
new file mode 100644
index 000000000000..4c20c4dc9d35
--- /dev/null
+++ b/core/proto/android/input/OWNERS
@@ -0,0 +1 @@
+include /INPUT_OWNERS
diff --git a/core/proto/android/os/system_properties.proto b/core/proto/android/os/system_properties.proto
index 84c82e094dd4..3cedba0632aa 100644
--- a/core/proto/android/os/system_properties.proto
+++ b/core/proto/android/os/system_properties.proto
@@ -434,9 +434,8 @@ message SystemPropertiesProto {
optional string vibrator = 37;
optional string virtual_device = 38;
optional string vulkan = 39;
- optional string egl_legacy = 40;
- // Next Tag: 41
+ // Next Tag: 40
}
optional Hardware hardware = 27;
@@ -559,3 +558,4 @@ message SystemPropertiesProto {
// Next Tag: 32
}
+
diff --git a/core/proto/android/providers/settings/global.proto b/core/proto/android/providers/settings/global.proto
index e165b079f450..3c2a48a51b09 100644
--- a/core/proto/android/providers/settings/global.proto
+++ b/core/proto/android/providers/settings/global.proto
@@ -468,10 +468,6 @@ message GlobalSettingsProto {
optional SettingProto updatable_driver_prerelease_opt_in_apps = 18;
optional SettingProto angle_egl_features = 19;
- // ANGLE - List of Apps that ANGLE may have issues with
- optional SettingProto angle_deferlist = 20;
- // ANGLE - Integer mode of the logic for applying `angle_deferlist`
- optional SettingProto angle_deferlist_mode = 21;
}
optional Gpu gpu = 59;
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 277bdf388188..35dc8e37aaab 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2328,6 +2328,8 @@
<p>Protection level: normal
-->
<permission android:name="android.permission.NFC_TRANSACTION_EVENT"
+ android:description="@string/permdesc_nfcTransactionEvent"
+ android:label="@string/permlab_nfcTransactionEvent"
android:protectionLevel="normal" />
<!-- Allows applications to receive NFC preferred payment service information.
@@ -4237,11 +4239,11 @@
android:protectionLevel="internal|preinstalled" />
<!-- Allows an application to subscribe to keyguard locked (i.e., showing) state.
- <p>Protection level: internal|role
- <p>Intended for use by ROLE_ASSISTANT only.
+ <p>Protection level: signature|role
+ <p>Intended for use by ROLE_ASSISTANT and signature apps only.
-->
<permission android:name="android.permission.SUBSCRIBE_TO_KEYGUARD_LOCKED_STATE"
- android:protectionLevel="internal|role"/>
+ android:protectionLevel="signature|role"/>
<!-- Must be required by a {@link android.service.autofill.AutofillService},
to ensure that only the system can bind to it.
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 4b05f99f8242..031a6669a3c6 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -4475,6 +4475,9 @@
<!-- Whether or not we should show the option to show battery percentage -->
<bool name="config_battery_percentage_setting_available">true</bool>
+ <!-- Default value set for battery percentage in status bar false = disabled, true = enabled -->
+ <bool name="config_defaultBatteryPercentageSetting">false</bool>
+
<!-- Whether or not battery saver should be "sticky" when manually enabled. -->
<bool name="config_batterySaverStickyBehaviourDisabled">false</bool>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 8a1b74d33065..5a1e0e8d6d47 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1604,6 +1604,12 @@
with Near Field Communication (NFC) tags, cards, and readers.</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_nfcTransactionEvent">Secure Element transaction event</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_nfcTransactionEvent">Allows the app to receive information about
+ transactions happening on a Secure Element.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_disableKeyguard">disable your screen lock</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_disableKeyguard">Allows the app to disable the
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index ba1030b7a99c..716d1bd89182 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2359,6 +2359,7 @@
<java-symbol type="style" name="Animation.RecentApplications" />
<java-symbol type="integer" name="dock_enter_exit_duration" />
<java-symbol type="bool" name="config_battery_percentage_setting_available" />
+ <java-symbol type="bool" name="config_defaultBatteryPercentageSetting" />
<java-symbol type="string" name="nas_upgrade_notification_title" />
<java-symbol type="string" name="nas_upgrade_notification_content" />
<java-symbol type="string" name="nas_upgrade_notification_enable_action" />
diff --git a/core/tests/coretests/OWNERS b/core/tests/coretests/OWNERS
index e8c9fe70272d..b7e008b196ff 100644
--- a/core/tests/coretests/OWNERS
+++ b/core/tests/coretests/OWNERS
@@ -2,3 +2,4 @@ include platform/frameworks/base:/services/core/java/com/android/server/am/OWNER
per-file BinderTest.java = file:platform/frameworks/native:/libs/binder/OWNERS
per-file ParcelTest.java = file:platform/frameworks/native:/libs/binder/OWNERS
+per-file SurfaceControlRegistryTests.java = file:/services/core/java/com/android/server/wm/OWNERS
diff --git a/core/tests/coretests/src/android/content/OWNERS b/core/tests/coretests/src/android/content/OWNERS
index a69c6ffef8d8..6f38b848853b 100644
--- a/core/tests/coretests/src/android/content/OWNERS
+++ b/core/tests/coretests/src/android/content/OWNERS
@@ -5,3 +5,5 @@ per-file *Launcher* = file:/core/java/android/content/pm/LAUNCHER_OWNERS
per-file *Shortcut* = file:/core/java/android/content/pm/SHORTCUT_OWNERS
per-file *ComponentCallbacks* = file:/services/core/java/com/android/server/wm/OWNERS
per-file *ComponentCallbacks* = charlesccchen@google.com
+per-file ContentCaptureOptions* = file:/core/java/android/view/contentcapture/OWNERS
+
diff --git a/core/tests/coretests/src/android/database/sqlite/OWNERS b/core/tests/coretests/src/android/database/sqlite/OWNERS
new file mode 100644
index 000000000000..3bebc7c56f61
--- /dev/null
+++ b/core/tests/coretests/src/android/database/sqlite/OWNERS
@@ -0,0 +1 @@
+include /SQLITE_OWNERS
diff --git a/core/tests/coretests/src/android/os/ParcelTest.java b/core/tests/coretests/src/android/os/ParcelTest.java
index e2fe87b4cfe3..4b993fadc1e0 100644
--- a/core/tests/coretests/src/android/os/ParcelTest.java
+++ b/core/tests/coretests/src/android/os/ParcelTest.java
@@ -246,4 +246,93 @@ public class ParcelTest {
assertThrows(IllegalArgumentException.class, () -> Parcel.compareData(pA, -1, pB, iB, 0));
assertThrows(IllegalArgumentException.class, () -> Parcel.compareData(pA, 0, pB, -1, 0));
}
+
+ /***
+ * Tests for b/205282403
+ * This test checks if allocations made over limit of 1MB for primitive types
+ * and 1M length for complex objects are not allowed.
+ */
+ @Test
+ public void testAllocationsOverLimit_whenOverLimit_throws() {
+ Binder.setIsDirectlyHandlingTransactionOverride(true);
+ Parcel p = Parcel.obtain();
+ p.setDataPosition(0);
+ p.writeInt(Integer.MAX_VALUE);
+
+ p.setDataPosition(0);
+ assertThrows(BadParcelableException.class, () ->p.createBooleanArray());
+
+ p.setDataPosition(0);
+ assertThrows(BadParcelableException.class, () ->p.createCharArray());
+
+ p.setDataPosition(0);
+ assertThrows(BadParcelableException.class, () ->p.createIntArray());
+
+ p.setDataPosition(0);
+ assertThrows(BadParcelableException.class, () ->p.createLongArray());
+
+ p.setDataPosition(0);
+ assertThrows(BadParcelableException.class, () ->p.createBinderArray());
+
+ int[] dimensions = new int[]{Integer.MAX_VALUE, 100, 100};
+ p.setDataPosition(0);
+ assertThrows(BadParcelableException.class,
+ () -> p.createFixedArray(int[][][].class, dimensions));
+
+ p.setDataPosition(0);
+ assertThrows(BadParcelableException.class,
+ () -> p.createFixedArray(String[][][].class, dimensions));
+
+ p.setDataPosition(0);
+ assertThrows(BadParcelableException.class,
+ () -> p.createFixedArray(IBinder[][][].class, dimensions));
+
+ p.recycle();
+ Binder.setIsDirectlyHandlingTransactionOverride(false);
+ }
+
+ /***
+ * Tests for b/205282403
+ * This test checks if allocations made under limit of 1MB for primitive types
+ * and 1M length for complex objects are allowed.
+ */
+ @Test
+ public void testAllocations_whenWithinLimit() {
+ Binder.setIsDirectlyHandlingTransactionOverride(true);
+ Parcel p = Parcel.obtain();
+ p.setDataPosition(0);
+ p.writeInt(100000);
+
+ p.setDataPosition(0);
+ p.createByteArray();
+
+ p.setDataPosition(0);
+ p.createCharArray();
+
+ p.setDataPosition(0);
+ p.createIntArray();
+
+ p.setDataPosition(0);
+ p.createLongArray();
+
+ p.setDataPosition(0);
+ p.createBinderArray();
+
+ int[] dimensions = new int[]{ 100, 100, 100 };
+
+ p.setDataPosition(0);
+ int[][][] data = new int[100][100][100];
+ p.writeFixedArray(data, 0, dimensions);
+ p.setDataPosition(0);
+ p.createFixedArray(int[][][].class, dimensions);
+
+ p.setDataPosition(0);
+ IBinder[][][] parcelables = new IBinder[100][100][100];
+ p.writeFixedArray(parcelables, 0, dimensions);
+ p.setDataPosition(0);
+ p.createFixedArray(IBinder[][][].class, dimensions);
+
+ p.recycle();
+ Binder.setIsDirectlyHandlingTransactionOverride(false);
+ }
}
diff --git a/core/tests/coretests/src/android/os/ProcessTest.java b/core/tests/coretests/src/android/os/ProcessTest.java
index 52846dfbb14b..b2ffdc035e8b 100644
--- a/core/tests/coretests/src/android/os/ProcessTest.java
+++ b/core/tests/coretests/src/android/os/ProcessTest.java
@@ -73,6 +73,7 @@ public class ProcessTest extends TestCase {
}
public void testGetAdvertisedMem() {
+ assertTrue(Process.getAdvertisedMem() > 0);
assertTrue(Process.getTotalMemory() <= Process.getAdvertisedMem());
}
}
diff --git a/core/tests/coretests/src/android/view/contentprotection/OWNERS b/core/tests/coretests/src/android/view/contentprotection/OWNERS
new file mode 100644
index 000000000000..b3583a7f6ab1
--- /dev/null
+++ b/core/tests/coretests/src/android/view/contentprotection/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 544200
+
+include /core/java/android/view/contentcapture/OWNERS
+
diff --git a/core/tests/fuzzers/ParcelFuzzer/Android.bp b/core/tests/fuzzers/ParcelFuzzer/Android.bp
index b71a06e3572e..eff19853fc7e 100644
--- a/core/tests/fuzzers/ParcelFuzzer/Android.bp
+++ b/core/tests/fuzzers/ParcelFuzzer/Android.bp
@@ -34,6 +34,7 @@ java_fuzz {
"smoreland@google.com",
"waghpawan@google.com",
],
+ triage_assignee: "cobark@google.com", // TODO(b/280770893)
// Adds bugs to hotlist "AIDL fuzzers bugs" on buganizer
hotlists: ["4637097"],
},
diff --git a/core/tests/fuzzers/java_service_fuzzer/Android.bp b/core/tests/fuzzers/java_service_fuzzer/Android.bp
index 6acb19852210..97538a5035f3 100644
--- a/core/tests/fuzzers/java_service_fuzzer/Android.bp
+++ b/core/tests/fuzzers/java_service_fuzzer/Android.bp
@@ -42,6 +42,7 @@ java_fuzz {
"smoreland@google.com",
"waghpawan@google.com",
],
+ triage_assignee: "cobark@google.com", // TODO(b/261539788)
// Adds bugs to hotlist "AIDL fuzzers bugs" on buganizer
hotlists: ["4637097"],
},
diff --git a/core/xsd/vts/OWNERS b/core/xsd/vts/OWNERS
new file mode 100644
index 000000000000..9af2ebaba437
--- /dev/null
+++ b/core/xsd/vts/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 151862
+sundongahn@google.com
diff --git a/data/etc/com.android.networkstack.xml b/data/etc/com.android.networkstack.xml
index 06fec1cdab1e..003ca53b03b0 100644
--- a/data/etc/com.android.networkstack.xml
+++ b/data/etc/com.android.networkstack.xml
@@ -25,6 +25,7 @@
<permission name="android.permission.LOCAL_MAC_ADDRESS"/>
<permission name="android.permission.MANAGE_SUBSCRIPTION_PLANS"/>
<permission name="android.permission.MANAGE_USB"/>
+ <permission name="android.permission.MANAGE_USERS"/>
<permission name="android.permission.NETWORK_BYPASS_PRIVATE_DNS"/>
<permission name="android.permission.PACKET_KEEPALIVE_OFFLOAD"/>
<permission name="android.permission.READ_NETWORK_USAGE_HISTORY"/>
diff --git a/keystore/java/android/security/KeyStoreException.java b/keystore/java/android/security/KeyStoreException.java
index cb757794a11d..253d70465720 100644
--- a/keystore/java/android/security/KeyStoreException.java
+++ b/keystore/java/android/security/KeyStoreException.java
@@ -614,9 +614,23 @@ public class KeyStoreException extends Exception {
KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_HARDWARE_TYPE_UNAVAILABLE,
KEYMINT_UNIMPLEMENTED_ERROR);
+ sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_PROOF_OF_PRESENCE_REQUIRED,
+ KEYMINT_INCORRECT_USAGE_ERROR);
+ sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_CONCURRENT_PROOF_OF_PRESENCE_REQUESTED,
+ KEYMINT_INCORRECT_USAGE_ERROR);
+ sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_NO_USER_CONFIRMATION,
+ KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_DEVICE_LOCKED,
new PublicErrorInformation(IS_SYSTEM_ERROR | REQUIRES_USER_AUTHENTICATION,
ERROR_USER_AUTHENTICATION_REQUIRED));
+ sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_EARLY_BOOT_ENDED,
+ GENERAL_KEYMINT_ERROR);
+ sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_ATTESTATION_KEYS_NOT_PROVISIONED,
+ GENERAL_KEYMINT_ERROR);
+ sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_ATTESTATION_IDS_NOT_PROVISIONED,
+ GENERAL_KEYMINT_ERROR);
+ sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_OPERATION,
+ GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_STORAGE_KEY_UNSUPPORTED,
KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_MGF_DIGEST,
@@ -627,6 +641,12 @@ public class KeyStoreException extends Exception {
KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MISSING_NOT_AFTER,
KEYMINT_INCORRECT_USAGE_ERROR);
+ sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MISSING_ISSUER_SUBJECT,
+ KEYMINT_INCORRECT_USAGE_ERROR);
+ sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_ISSUER_SUBJECT,
+ KEYMINT_INCORRECT_USAGE_ERROR);
+ sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_BOOT_LEVEL_EXCEEDED,
+ KEYMINT_INCORRECT_USAGE_ERROR);
// This should not be exposed to apps as it's handled by Keystore.
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_HARDWARE_NOT_YET_AVAILABLE,
GENERAL_KEYMINT_ERROR);
diff --git a/keystore/java/android/security/keystore2/AndroidKeyStoreCipherSpiBase.java b/keystore/java/android/security/keystore2/AndroidKeyStoreCipherSpiBase.java
index 7571e44a7713..d12989187281 100644
--- a/keystore/java/android/security/keystore2/AndroidKeyStoreCipherSpiBase.java
+++ b/keystore/java/android/security/keystore2/AndroidKeyStoreCipherSpiBase.java
@@ -24,6 +24,7 @@ import android.security.KeyStoreException;
import android.security.KeyStoreOperation;
import android.security.keymaster.KeymasterDefs;
import android.security.keystore.KeyStoreCryptoOperation;
+import android.system.keystore2.Authorization;
import libcore.util.EmptyArray;
@@ -119,6 +120,14 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
mCipher = null;
}
+ private Authorization[] getKeyCharacteristics(Key key) {
+ if (!(key instanceof AndroidKeyStoreKey)) {
+ return new Authorization[] {};
+ }
+
+ return ((AndroidKeyStoreKey) key).getAuthorizations();
+ }
+
@Override
protected final void engineInit(int opmode, Key key, SecureRandom random)
throws InvalidKeyException {
@@ -173,7 +182,7 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
init(opmode, key, random);
initAlgorithmSpecificParameters();
try {
- ensureKeystoreOperationInitialized();
+ ensureKeystoreOperationInitialized(getKeyCharacteristics(key));
} catch (InvalidAlgorithmParameterException e) {
throw new InvalidKeyException(e);
}
@@ -206,7 +215,7 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
try {
init(opmode, key, random);
initAlgorithmSpecificParameters(params);
- ensureKeystoreOperationInitialized();
+ ensureKeystoreOperationInitialized(getKeyCharacteristics(key));
success = true;
} finally {
if (!success) {
@@ -236,7 +245,7 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
try {
init(opmode, key, random);
initAlgorithmSpecificParameters(params);
- ensureKeystoreOperationInitialized();
+ ensureKeystoreOperationInitialized(getKeyCharacteristics(key));
success = true;
} finally {
if (!success) {
@@ -310,7 +319,8 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
mCachedException = null;
}
- private void ensureKeystoreOperationInitialized() throws InvalidKeyException,
+ private void ensureKeystoreOperationInitialized(Authorization[] keyCharacteristics)
+ throws InvalidKeyException,
InvalidAlgorithmParameterException {
if (mMainDataStreamer != null) {
return;
@@ -323,7 +333,7 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
}
List<KeyParameter> parameters = new ArrayList<>();
- addAlgorithmSpecificParametersToBegin(parameters);
+ addAlgorithmSpecificParametersToBegin(parameters, keyCharacteristics);
int purpose;
if (mKeymasterPurposeOverride != -1) {
@@ -404,7 +414,7 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
return null;
}
try {
- ensureKeystoreOperationInitialized();
+ ensureKeystoreOperationInitialized(getKeyCharacteristics(mKey));
} catch (InvalidKeyException | InvalidAlgorithmParameterException e) {
mCachedException = e;
return null;
@@ -520,7 +530,7 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
}
try {
- ensureKeystoreOperationInitialized();
+ ensureKeystoreOperationInitialized(getKeyCharacteristics(mKey));
} catch (InvalidKeyException | InvalidAlgorithmParameterException e) {
mCachedException = e;
return;
@@ -597,7 +607,7 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
}
try {
- ensureKeystoreOperationInitialized();
+ ensureKeystoreOperationInitialized(getKeyCharacteristics(mKey));
} catch (InvalidKeyException | InvalidAlgorithmParameterException e) {
throw (IllegalBlockSizeException) new IllegalBlockSizeException().initCause(e);
}
@@ -1012,6 +1022,22 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
@NonNull List<KeyParameter> parameters);
/**
+ * Invoked to add algorithm-specific parameters for the KeyStore's {@code begin} operation,
+ * including the key characteristics. This is useful in case the parameters to {@code begin}
+ * depend on how the key was generated.
+ * The default implementation provided here simply ignores these key characteristics because
+ * they are not be needed for most engines.
+ *
+ * @param parameters keystore/keymaster arguments to be populated with algorithm-specific
+ * parameters.
+ * @param keyCharacteristics The key's characteristics.
+ */
+ protected void addAlgorithmSpecificParametersToBegin(
+ @NonNull List<KeyParameter> parameters, Authorization[] keyCharacteristics) {
+ addAlgorithmSpecificParametersToBegin(parameters);
+ }
+
+ /**
* Invoked to obtain algorithm-specific parameters from the result of the KeyStore's
* {@code begin} operation.
*
diff --git a/keystore/java/android/security/keystore2/AndroidKeyStoreRSACipherSpi.java b/keystore/java/android/security/keystore2/AndroidKeyStoreRSACipherSpi.java
index e9b66aafc262..3bb2564807b6 100644
--- a/keystore/java/android/security/keystore2/AndroidKeyStoreRSACipherSpi.java
+++ b/keystore/java/android/security/keystore2/AndroidKeyStoreRSACipherSpi.java
@@ -288,16 +288,34 @@ abstract class AndroidKeyStoreRSACipherSpi extends AndroidKeyStoreCipherSpiBase
}
}
+ private static boolean isMgfDigestTagPresentInKeyProperties(
+ Authorization[] keyCharacteristics) {
+ for (Authorization authorization : keyCharacteristics) {
+ if (authorization.keyParameter.tag == KeymasterDefs.KM_TAG_RSA_OAEP_MGF_DIGEST) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
@Override
protected final void addAlgorithmSpecificParametersToBegin(
- @NonNull List<KeyParameter> parameters) {
- super.addAlgorithmSpecificParametersToBegin(parameters);
+ @NonNull List<KeyParameter> parameters, Authorization[] keyCharacteristics) {
+ super.addAlgorithmSpecificParametersToBegin(parameters, keyCharacteristics);
parameters.add(KeyStore2ParameterUtils.makeEnum(
KeymasterDefs.KM_TAG_DIGEST, mKeymasterDigest
));
- parameters.add(KeyStore2ParameterUtils.makeEnum(
- KeymasterDefs.KM_TAG_RSA_OAEP_MGF_DIGEST, mKeymasterMgf1Digest
- ));
+ // Only add the KM_TAG_RSA_OAEP_MGF_DIGEST tag to begin() if the MGF Digest is
+ // present in the key properties. Keys generated prior to Android 14 did not have
+ // this tag (Keystore didn't add it) so specifying any MGF digest tag would cause
+ // a begin() operation (on an Android 14 device) to fail (with a key that was generated
+ // on Android 13 or below).
+ if (isMgfDigestTagPresentInKeyProperties(keyCharacteristics)) {
+ parameters.add(KeyStore2ParameterUtils.makeEnum(
+ KeymasterDefs.KM_TAG_RSA_OAEP_MGF_DIGEST, mKeymasterMgf1Digest
+ ));
+ }
}
@Override
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/OWNERS b/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/OWNERS
index ccbb9cf298a2..a3803ed82844 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/OWNERS
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/OWNERS
@@ -1,3 +1,4 @@
# WM shell sub-module freeform owners
atsjenk@google.com
+jorgegil@google.com
madym@google.com
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java
index 83bc7c0e6e7d..889652950389 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java
@@ -597,6 +597,13 @@ public class PipTouchHandler {
return true;
}
+ // Ignore the motion event When the entry animation is waiting to be started
+ if (!mTouchState.isUserInteracting() && mPipTaskOrganizer.isEntryScheduled()) {
+ ProtoLog.wtf(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
+ "%s: Waiting to start the entry animation, skip the motion event.", TAG);
+ return true;
+ }
+
// Update the touch state
mTouchState.onTouchEvent(ev);
diff --git a/libs/WindowManager/Shell/tests/OWNERS b/libs/WindowManager/Shell/tests/OWNERS
index 64dfc3ef845d..deebad545c5e 100644
--- a/libs/WindowManager/Shell/tests/OWNERS
+++ b/libs/WindowManager/Shell/tests/OWNERS
@@ -8,3 +8,4 @@ madym@google.com
hwwang@google.com
chenghsiuchang@google.com
atsjenk@google.com
+jorgegil@google.com
diff --git a/libs/androidfw/include/androidfw/ObbFile.h b/libs/androidfw/include/androidfw/ObbFile.h
index 3dbf997dc367..38ece5c1546f 100644
--- a/libs/androidfw/include/androidfw/ObbFile.h
+++ b/libs/androidfw/include/androidfw/ObbFile.h
@@ -43,10 +43,6 @@ public:
bool removeFrom(const char* filename);
bool removeFrom(int fd);
- const char* getFileName() const {
- return mFileName;
- }
-
const String8 getPackageName() const {
return mPackageName;
}
@@ -127,8 +123,6 @@ private:
/* The encryption salt. */
unsigned char mSalt[8];
- const char* mFileName;
-
size_t mFooterStart;
bool parseObbFile(int fd);
diff --git a/libs/hwui/AndroidTest.xml b/libs/hwui/AndroidTest.xml
index 911315f81a8a..75f61f5f7f9d 100644
--- a/libs/hwui/AndroidTest.xml
+++ b/libs/hwui/AndroidTest.xml
@@ -21,6 +21,7 @@
<option name="push" value="hwuimacro->/data/local/tmp/benchmarktest/hwuimacro" />
</target_preparer>
<option name="test-suite-tag" value="apct" />
+ <option name="not-shardable" value="true" />
<test class="com.android.tradefed.testtype.GTest" >
<option name="native-test-device-path" value="/data/local/tmp/nativetest" />
<option name="module-name" value="hwui_unit_tests" />
diff --git a/libs/hwui/jni/FontFamily.cpp b/libs/hwui/jni/FontFamily.cpp
index ce5ac382aeff..f632d093d9f3 100644
--- a/libs/hwui/jni/FontFamily.cpp
+++ b/libs/hwui/jni/FontFamily.cpp
@@ -44,6 +44,7 @@
namespace android {
+namespace {
struct NativeFamilyBuilder {
NativeFamilyBuilder(uint32_t langId, int variant)
: langId(langId), variant(static_cast<minikin::FamilyVariant>(variant)) {}
@@ -52,6 +53,7 @@ struct NativeFamilyBuilder {
std::vector<std::shared_ptr<minikin::Font>> fonts;
std::vector<minikin::FontVariation> axes;
};
+} // namespace
static inline NativeFamilyBuilder* toNativeBuilder(jlong ptr) {
return reinterpret_cast<NativeFamilyBuilder*>(ptr);
diff --git a/libs/hwui/jni/fonts/FontFamily.cpp b/libs/hwui/jni/fonts/FontFamily.cpp
index b68213549938..ac1c05ed6afe 100644
--- a/libs/hwui/jni/fonts/FontFamily.cpp
+++ b/libs/hwui/jni/fonts/FontFamily.cpp
@@ -29,9 +29,11 @@
namespace android {
+namespace {
struct NativeFamilyBuilder {
std::vector<std::shared_ptr<minikin::Font>> fonts;
};
+} // namespace
static inline NativeFamilyBuilder* toBuilder(jlong ptr) {
return reinterpret_cast<NativeFamilyBuilder*>(ptr);
diff --git a/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp b/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp
index 63c36f85be20..b5c1b490182f 100644
--- a/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp
+++ b/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp
@@ -66,12 +66,15 @@ MakeCurrentResult SkiaOpenGLPipeline::makeCurrent() {
return MakeCurrentResult::AlreadyCurrent;
}
- // Make sure read/draw buffer state of default framebuffer is GL_BACK. Vendor implementations
+ EGLint majorVersion = 0;
+ eglQueryContext(eglGetCurrentDisplay(), eglGetCurrentContext(), EGL_CONTEXT_CLIENT_VERSION, &majorVersion);
+
+ // Make sure read/draw buffer state of default framebuffer is GL_BACK for ES 3.X. Vendor implementations
// disagree on the draw/read buffer state if the default framebuffer transitions from a surface
// to EGL_NO_SURFACE and vice-versa. There was a related discussion within Khronos on this topic.
// See https://cvs.khronos.org/bugzilla/show_bug.cgi?id=13534.
// The discussion was not resolved with a clear consensus
- if (error == 0 && wasSurfaceless && mEglSurface != EGL_NO_SURFACE) {
+ if (error == 0 && (majorVersion > 2) && wasSurfaceless && mEglSurface != EGL_NO_SURFACE) {
GLint curReadFB = 0;
GLint curDrawFB = 0;
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &curReadFB);
diff --git a/libs/incident/src/IncidentReportArgs.cpp b/libs/incident/src/IncidentReportArgs.cpp
index db495cfbf7e1..d344a981ecea 100644
--- a/libs/incident/src/IncidentReportArgs.cpp
+++ b/libs/incident/src/IncidentReportArgs.cpp
@@ -133,13 +133,12 @@ IncidentReportArgs::readFromParcel(const Parcel* in)
mSections.insert(section);
}
- int32_t headerCount;
- err = in->readInt32(&headerCount);
+ err = in->resizeOutVector<vector<uint8_t>>(&mHeaders);
if (err != NO_ERROR) {
return err;
}
- mHeaders.resize(headerCount);
- for (int i=0; i<headerCount; i++) {
+
+ for (int i=0; i<mHeaders.size(); i++) {
err = in->readByteVector(&mHeaders[i]);
if (err != NO_ERROR) {
return err;
diff --git a/libs/services/Android.bp b/libs/services/Android.bp
index f656ebfc3b77..0b7e7d37718d 100644
--- a/libs/services/Android.bp
+++ b/libs/services/Android.bp
@@ -26,8 +26,6 @@ package {
cc_library_shared {
name: "libservices",
srcs: [
- ":IDropBoxManagerService.aidl",
- ":ILogcatManagerService_aidl",
"src/content/ComponentName.cpp",
"src/os/DropBoxManager.cpp",
],
@@ -42,7 +40,10 @@ cc_library_shared {
"libbase_headers",
],
aidl: {
- include_dirs: ["frameworks/base/core/java/"],
+ libs: [
+ "ILogcatManagerService_aidl",
+ "IDropBoxManagerService_aidl",
+ ],
},
export_include_dirs: ["include"],
diff --git a/media/java/android/media/AudioAttributes.java b/media/java/android/media/AudioAttributes.java
index 546f0c665a98..dea6097ad89c 100644
--- a/media/java/android/media/AudioAttributes.java
+++ b/media/java/android/media/AudioAttributes.java
@@ -1433,6 +1433,8 @@ public final class AudioAttributes implements Parcelable {
return new String("AudioAttributes:"
+ " usage=" + usageToString()
+ " content=" + contentTypeToString()
+ + (mSource != MediaRecorder.AudioSource.AUDIO_SOURCE_INVALID
+ ? " source=" + MediaRecorder.toLogFriendlyAudioSource(mSource) : "")
+ " flags=0x" + Integer.toHexString(mFlags).toUpperCase()
+ " tags=" + mFormattedTags
+ " bundle=" + (mBundle == null ? "null" : mBundle.toString()));
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index 8e8ed6c7acec..5c3aa96925f5 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -3089,7 +3089,10 @@ final public class MediaCodec {
mValid = false;
mNativeContext = 0;
}
- sPool.offer(this);
+
+ if (!mInternal) {
+ sPool.offer(this);
+ }
}
private native void native_recycle();
@@ -3153,6 +3156,7 @@ final public class MediaCodec {
mNativeContext = context;
mMappable = isMappable;
mValid = (context != 0);
+ mInternal = true;
}
private static final BlockingQueue<LinearBlock> sPool =
@@ -3163,6 +3167,7 @@ final public class MediaCodec {
private boolean mMappable = false;
private ByteBuffer mMapped = null;
private long mNativeContext = 0;
+ private boolean mInternal = false;
}
/**
diff --git a/media/java/android/media/audiopolicy/AudioMix.java b/media/java/android/media/audiopolicy/AudioMix.java
index f85bdee18967..094a33f3f2ba 100644
--- a/media/java/android/media/audiopolicy/AudioMix.java
+++ b/media/java/android/media/audiopolicy/AudioMix.java
@@ -25,6 +25,8 @@ import android.media.AudioFormat;
import android.media.AudioSystem;
import android.os.Build;
+import com.android.internal.annotations.VisibleForTesting;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Objects;
@@ -252,10 +254,10 @@ public class AudioMix {
if (o == null || getClass() != o.getClass()) return false;
final AudioMix that = (AudioMix) o;
- return (this.mRouteFlags == that.mRouteFlags)
- && (this.mRule == that.mRule)
- && (this.mMixType == that.mMixType)
- && (this.mFormat == that.mFormat);
+ return Objects.equals(this.mRouteFlags, that.mRouteFlags)
+ && Objects.equals(this.mRule, that.mRule)
+ && Objects.equals(this.mMixType, that.mMixType)
+ && Objects.equals(this.mFormat, that.mFormat);
}
/** @hide */
@@ -340,7 +342,8 @@ public class AudioMix {
* @param address
* @return the same Builder instance.
*/
- Builder setDevice(int deviceType, String address) {
+ @VisibleForTesting
+ public Builder setDevice(int deviceType, String address) {
mDeviceSystemType = deviceType;
mDeviceAddress = address;
return this;
diff --git a/media/java/android/media/audiopolicy/AudioProductStrategy.java b/media/java/android/media/audiopolicy/AudioProductStrategy.java
index f957498237a8..98819a3582a6 100644
--- a/media/java/android/media/audiopolicy/AudioProductStrategy.java
+++ b/media/java/android/media/audiopolicy/AudioProductStrategy.java
@@ -22,7 +22,6 @@ import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.media.AudioAttributes;
import android.media.AudioSystem;
-import android.media.MediaRecorder;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
@@ -130,9 +129,7 @@ public final class AudioProductStrategy implements Parcelable {
return aa;
}
}
- return new AudioAttributes.Builder()
- .setContentType(AudioAttributes.CONTENT_TYPE_UNKNOWN)
- .setUsage(AudioAttributes.USAGE_UNKNOWN).build();
+ return DEFAULT_ATTRIBUTES;
}
/**
@@ -217,7 +214,7 @@ public final class AudioProductStrategy implements Parcelable {
@SystemApi
public @NonNull AudioAttributes getAudioAttributes() {
// We need a choice, so take the first one
- return mAudioAttributesGroups.length == 0 ? (new AudioAttributes.Builder().build())
+ return mAudioAttributesGroups.length == 0 ? DEFAULT_ATTRIBUTES
: mAudioAttributesGroups[0].getAudioAttributes();
}
@@ -358,8 +355,7 @@ public final class AudioProductStrategy implements Parcelable {
* Default attributes, with default source to be aligned with native.
*/
private static final @NonNull AudioAttributes DEFAULT_ATTRIBUTES =
- new AudioAttributes.Builder().setCapturePreset(MediaRecorder.AudioSource.DEFAULT)
- .build();
+ new AudioAttributes.Builder().build();
/**
* @hide
@@ -429,8 +425,7 @@ public final class AudioProductStrategy implements Parcelable {
public @NonNull AudioAttributes getAudioAttributes() {
// We need a choice, so take the first one
- return mAudioAttributes.length == 0 ? (new AudioAttributes.Builder().build())
- : mAudioAttributes[0];
+ return mAudioAttributes.length == 0 ? DEFAULT_ATTRIBUTES : mAudioAttributes[0];
}
/**
diff --git a/media/java/android/media/musicrecognition/OWNERS b/media/java/android/media/musicrecognition/OWNERS
index 58f5d40dd8c3..037b04831260 100644
--- a/media/java/android/media/musicrecognition/OWNERS
+++ b/media/java/android/media/musicrecognition/OWNERS
@@ -1,6 +1,5 @@
# Bug component: 830636
-joannechung@google.com
oni@google.com
volnov@google.com
diff --git a/mime/java/Android.bp b/mime/java/Android.bp
index 07cada8e1372..a267d6593f65 100644
--- a/mime/java/Android.bp
+++ b/mime/java/Android.bp
@@ -10,5 +10,8 @@ package {
filegroup {
name: "framework-mime-sources",
srcs: ["**/*.java"],
- visibility: ["//frameworks/base"],
+ visibility: [
+ "//frameworks/base",
+ "//frameworks/base/api",
+ ],
}
diff --git a/native/android/storage_manager.cpp b/native/android/storage_manager.cpp
index 9e0a6eb476d3..294ca9cfd3b4 100644
--- a/native/android/storage_manager.cpp
+++ b/native/android/storage_manager.cpp
@@ -86,7 +86,7 @@ protected:
return nullptr;
}
- String16 fileName(obbFile->getFileName());
+ String16 fileName(canonicalPath);
String16 packageName(obbFile->getPackageName());
size_t length;
const unsigned char* salt = obbFile->getSalt(&length);
diff --git a/native/webview/OWNERS b/native/webview/OWNERS
index 580bb0fe8273..7e27dc8831a6 100644
--- a/native/webview/OWNERS
+++ b/native/webview/OWNERS
@@ -1,4 +1,4 @@
+# Bug component: 76427
boliu@google.com
-changwan@google.com
-tobiasjs@google.com
+ntfschr@google.com
torne@google.com
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
index 5e42f705cf4b..3b56016f4718 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
@@ -16,11 +16,10 @@
package com.android.dynsystem;
-import static android.os.AsyncTask.Status.FINISHED;
-import static android.os.AsyncTask.Status.PENDING;
import static android.os.AsyncTask.Status.RUNNING;
import static android.os.image.DynamicSystemClient.ACTION_HIDE_NOTIFICATION;
import static android.os.image.DynamicSystemClient.ACTION_NOTIFY_IF_IN_USE;
+import static android.os.image.DynamicSystemClient.ACTION_NOTIFY_KEYGUARD_DISMISSED;
import static android.os.image.DynamicSystemClient.ACTION_START_INSTALL;
import static android.os.image.DynamicSystemClient.CAUSE_ERROR_EXCEPTION;
import static android.os.image.DynamicSystemClient.CAUSE_ERROR_INVALID_URL;
@@ -234,6 +233,8 @@ public class DynamicSystemInstallationService extends Service
executeNotifyIfInUseCommand();
} else if (ACTION_HIDE_NOTIFICATION.equals(action)) {
executeHideNotificationCommand();
+ } else if (ACTION_NOTIFY_KEYGUARD_DISMISSED.equals(action)) {
+ executeNotifyKeyguardDismissed();
}
return Service.START_NOT_STICKY;
@@ -423,7 +424,10 @@ public class DynamicSystemInstallationService extends Service
Log.e(TAG, "It's already running in normal system.");
return;
}
-
+ if (mDynSystem.getActiveDsuSlot().endsWith(".lock")) {
+ Log.e(TAG, "Ignore the reboot intent for a locked DSU slot");
+ return;
+ }
if (!mDynSystem.setEnable(/* enable = */ false, /* oneShot = */ false)) {
Log.e(TAG, "Failed to disable DynamicSystem.");
@@ -474,6 +478,10 @@ public class DynamicSystemInstallationService extends Service
}
}
+ private void executeNotifyKeyguardDismissed() {
+ postStatus(STATUS_NOT_STARTED, CAUSE_INSTALL_CANCELLED, null);
+ }
+
private void resetTaskAndStop() {
resetTaskAndStop(/* removeNotification= */ false);
}
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/VerificationActivity.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/VerificationActivity.java
index b52272961e4b..7401691cd59e 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/VerificationActivity.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/VerificationActivity.java
@@ -16,6 +16,7 @@
package com.android.dynsystem;
+import static android.os.image.DynamicSystemClient.ACTION_NOTIFY_KEYGUARD_DISMISSED;
import static android.os.image.DynamicSystemClient.KEY_KEYGUARD_USE_DEFAULT_STRINGS;
import android.app.Activity;
@@ -83,11 +84,19 @@ public class VerificationActivity extends Activity {
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
startInstallationService();
+ } else {
+ notifyKeyguardDismissed();
}
finish();
}
+ private void notifyKeyguardDismissed() {
+ Intent intent = new Intent(this, DynamicSystemInstallationService.class);
+ intent.setAction(ACTION_NOTIFY_KEYGUARD_DISMISSED);
+ startServiceAsUser(intent, UserHandle.SYSTEM);
+ }
+
private void startInstallationService() {
// retrieve data from calling intent
Intent callingIntent = getIntent();
diff --git a/packages/PackageInstaller/Android.bp b/packages/PackageInstaller/Android.bp
index 47575137558a..565a51ff6aae 100644
--- a/packages/PackageInstaller/Android.bp
+++ b/packages/PackageInstaller/Android.bp
@@ -46,6 +46,10 @@ android_app {
"xz-java",
"androidx.leanback_leanback",
],
+
+ lint: {
+ error_checks: ["Recycle"],
+ },
}
android_app {
@@ -64,6 +68,10 @@ android_app {
"androidx.leanback_leanback",
],
aaptflags: ["--product tablet"],
+
+ lint: {
+ error_checks: ["Recycle"],
+ },
}
android_app {
@@ -82,4 +90,8 @@ android_app {
"androidx.leanback_leanback",
],
aaptflags: ["--product tv"],
+
+ lint: {
+ error_checks: ["Recycle"],
+ },
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java
index 879181f0fbd6..2d958a919793 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java
@@ -6,6 +6,7 @@ import android.annotation.SuppressLint;
import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
+import android.bluetooth.BluetoothCsipSetCoordinator;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
@@ -162,14 +163,21 @@ public class BluetoothUtils {
resources, ((BitmapDrawable) pair.first).getBitmap()), pair.second);
}
+ int hashCode;
+ if ((cachedDevice.getGroupId() != BluetoothCsipSetCoordinator.GROUP_ID_INVALID)) {
+ hashCode = new Integer(cachedDevice.getGroupId()).hashCode();
+ } else {
+ hashCode = cachedDevice.getAddress().hashCode();
+ }
+
return new Pair<>(buildBtRainbowDrawable(context,
- pair.first, cachedDevice.getAddress().hashCode()), pair.second);
+ pair.first, hashCode), pair.second);
}
/**
* Build Bluetooth device icon with rainbow
*/
- public static Drawable buildBtRainbowDrawable(Context context, Drawable drawable,
+ private static Drawable buildBtRainbowDrawable(Context context, Drawable drawable,
int hashCode) {
final Resources resources = context.getResources();
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
index fe448fccae3a..6ef5d7347d31 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
@@ -576,9 +576,14 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
*/
public void setName(String name) {
// Prevent getName() to be set to null if setName(null) is called
- if (name != null && !TextUtils.equals(name, getName())) {
- mDevice.setAlias(name);
- dispatchAttributesChanged();
+ if (name == null || TextUtils.equals(name, getName())) {
+ return;
+ }
+ mDevice.setAlias(name);
+ dispatchAttributesChanged();
+
+ for (CachedBluetoothDevice cbd : mMemberDevices) {
+ cbd.setName(name);
}
}
@@ -1497,8 +1502,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
refresh();
}
- return new Pair<>(BluetoothUtils.buildBtRainbowDrawable(
- mContext, pair.first, getAddress().hashCode()), pair.second);
+ return BluetoothUtils.getBtRainbowDrawableWithDescription(mContext, this);
}
void releaseLruCache() {
diff --git a/packages/SettingsLib/src/com/android/settingslib/license/LicenseHtmlGeneratorFromXml.java b/packages/SettingsLib/src/com/android/settingslib/license/LicenseHtmlGeneratorFromXml.java
index fb3f382af192..e91d697d4b86 100644
--- a/packages/SettingsLib/src/com/android/settingslib/license/LicenseHtmlGeneratorFromXml.java
+++ b/packages/SettingsLib/src/com/android/settingslib/license/LicenseHtmlGeneratorFromXml.java
@@ -324,6 +324,7 @@ class LicenseHtmlGeneratorFromXml {
if (!TextUtils.isEmpty(noticeHeader)) {
writer.println(noticeHeader);
+ writer.println("<br/>");
}
int count = 0;
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index 17078c4c81f2..a78faaf90c37 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -771,12 +771,6 @@ class SettingsProtoDumpUtil {
Settings.Global.ANGLE_EGL_FEATURES,
GlobalSettingsProto.Gpu.ANGLE_EGL_FEATURES);
dumpSetting(s, p,
- Settings.Global.ANGLE_DEFERLIST,
- GlobalSettingsProto.Gpu.ANGLE_DEFERLIST);
- dumpSetting(s, p,
- Settings.Global.ANGLE_DEFERLIST_MODE,
- GlobalSettingsProto.Gpu.ANGLE_DEFERLIST_MODE);
- dumpSetting(s, p,
Settings.Global.SHOW_ANGLE_IN_USE_DIALOG_BOX,
GlobalSettingsProto.Gpu.SHOW_ANGLE_IN_USE_DIALOG);
dumpSetting(s, p,
diff --git a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
index 22d629422e62..3c2aefdaa8fb 100644
--- a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
+++ b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
@@ -515,8 +515,6 @@ public class SettingsBackupTest {
Settings.Global.ANGLE_GL_DRIVER_SELECTION_PKGS,
Settings.Global.ANGLE_GL_DRIVER_SELECTION_VALUES,
Settings.Global.ANGLE_EGL_FEATURES,
- Settings.Global.ANGLE_DEFERLIST,
- Settings.Global.ANGLE_DEFERLIST_MODE,
Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS,
Settings.Global.UPDATABLE_DRIVER_PRERELEASE_OPT_IN_APPS,
diff --git a/packages/SystemUI/OWNERS b/packages/SystemUI/OWNERS
index 402d73c443a3..811b40943661 100644
--- a/packages/SystemUI/OWNERS
+++ b/packages/SystemUI/OWNERS
@@ -55,6 +55,7 @@ lynhan@google.com
madym@google.com
mankoff@google.com
mateuszc@google.com
+mgalhardo@google.com
michaelmikhil@google.com
michschn@google.com
mkephart@google.com
diff --git a/packages/SystemUI/res/layout/status_bar.xml b/packages/SystemUI/res/layout/status_bar.xml
index 3b71dc32b256..d10332bcbffb 100644
--- a/packages/SystemUI/res/layout/status_bar.xml
+++ b/packages/SystemUI/res/layout/status_bar.xml
@@ -78,7 +78,7 @@
android:layout_width="match_parent"
android:clipChildren="false">
<ViewStub
- android:id="@+id/operator_name"
+ android:id="@+id/operator_name_stub"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout="@layout/operator_name" />
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java
index a16f30475654..8658c64e7993 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinViewController.java
@@ -52,7 +52,7 @@ public class KeyguardSimPinViewController
private ProgressDialog mSimUnlockProgressDialog;
private CheckSimPin mCheckSimPinThread;
- private int mRemainingAttempts;
+ private int mRemainingAttempts = -1;
// Below flag is set to true during power-up or when a new SIM card inserted on device.
// When this is true and when SIM card is PIN locked state, on PIN lock screen, message would
// be displayed to inform user about the number of remaining PIN attempts left.
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index e7aa176e5d68..92054b317637 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -1840,6 +1840,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
state = TelephonyManager.SIM_STATE_PIN_REQUIRED;
} else if (Intent.SIM_LOCKED_ON_PUK.equals(lockedReason)) {
state = TelephonyManager.SIM_STATE_PUK_REQUIRED;
+ } else if (Intent.SIM_ABSENT_ON_PERM_DISABLED.equals(lockedReason)) {
+ state = TelephonyManager.SIM_STATE_PERM_DISABLED;
} else {
state = TelephonyManager.SIM_STATE_UNKNOWN;
}
diff --git a/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java
index 03d999f697d0..9f948a7f92ff 100644
--- a/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java
+++ b/packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java
@@ -325,7 +325,9 @@ public class BatteryMeterView extends LinearLayout implements DarkReceiver {
// TODO(b/140051051)
final boolean systemSetting = 0 != whitelistIpcs(() -> Settings.System
.getIntForUser(getContext().getContentResolver(),
- SHOW_BATTERY_PERCENT, 0, UserHandle.USER_CURRENT));
+ SHOW_BATTERY_PERCENT, getContext().getResources().getBoolean(
+ com.android.internal.R.bool.config_defaultBatteryPercentageSetting)
+ ? 1 : 0, UserHandle.USER_CURRENT));
boolean shouldShow =
(mShowPercentAvailable && systemSetting && mShowPercentMode != MODE_OFF)
|| mShowPercentMode == MODE_ON
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java
index 9f3fd727be24..5ca7ba013bbc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java
@@ -636,9 +636,9 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
private void initOperatorName() {
int subId = SubscriptionManager.getDefaultDataSubscriptionId();
if (mCarrierConfigTracker.getShowOperatorNameInStatusBarConfig(subId)) {
- ViewStub stub = mStatusBar.findViewById(R.id.operator_name);
+ View view = mStatusBar.findViewById(R.id.operator_name);
mOperatorNameViewController =
- mOperatorNameViewControllerFactory.create((OperatorNameView) stub.inflate());
+ mOperatorNameViewControllerFactory.create((OperatorNameView) view);
mOperatorNameViewController.init();
// This view should not be visible on lock-screen
if (mKeyguardStateController.isShowing()) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/dagger/StatusBarFragmentModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/dagger/StatusBarFragmentModule.java
index 730ecded58e2..8f9f0196abfa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/dagger/StatusBarFragmentModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/dagger/StatusBarFragmentModule.java
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.phone.fragment.dagger;
import android.view.View;
+import android.view.ViewStub;
import com.android.systemui.R;
import com.android.systemui.battery.BatteryMeterView;
@@ -95,7 +96,7 @@ public interface StatusBarFragmentModule {
@StatusBarFragmentScope
@Named(OPERATOR_NAME_VIEW)
static View provideOperatorNameView(@RootView PhoneStatusBarView view) {
- return view.findViewById(R.id.operator_name);
+ return ((ViewStub) view.findViewById(R.id.operator_name_stub)).inflate();
}
/** */
diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbContaminantActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbContaminantActivity.java
index d10e890f3c02..534049b65cb4 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/UsbContaminantActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/UsbContaminantActivity.java
@@ -75,7 +75,12 @@ public class UsbContaminantActivity extends Activity implements View.OnClickList
mLearnMore.setVisibility(View.VISIBLE);
}
- mEnableUsb.setOnClickListener(this);
+ if (!mUsbPort.supportsEnableContaminantPresenceDetection()) {
+ mEnableUsb.setVisibility(View.GONE);
+ } else {
+ mEnableUsb.setOnClickListener(this);
+ }
+
mGotIt.setOnClickListener(this);
mLearnMore.setOnClickListener(this);
}
diff --git a/services/Android.bp b/services/Android.bp
index 1750b6731888..eb56c250e224 100644
--- a/services/Android.bp
+++ b/services/Android.bp
@@ -59,7 +59,12 @@ system_optimized_java_defaults {
optimize: false,
shrink: true,
ignore_warnings: false,
- proguard_flags_files: ["proguard.flags"],
+ proguard_flags_files: [
+ "proguard.flags",
+ // Ensure classes referenced in the framework-res manifest
+ // and implemented in system_server are kept.
+ ":framework-res{.aapt.proguardOptionsFile}",
+ ],
},
// Note: Optimizations are disabled by default if unspecified in
// the java_library rule.
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 1e9c3b72f57c..c7a7959c915d 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -1842,6 +1842,12 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
AccessibilityServiceInfo accessibilityServiceInfo;
try {
accessibilityServiceInfo = new AccessibilityServiceInfo(resolveInfo, mContext);
+ if (!accessibilityServiceInfo.isWithinParcelableSize()) {
+ Slog.e(LOG_TAG, "Skipping service "
+ + accessibilityServiceInfo.getResolveInfo().getComponentInfo()
+ + " because service info size is larger than safe parcelable limits.");
+ continue;
+ }
if (userState.mCrashedServices.contains(serviceInfo.getComponentName())) {
// Restore the crashed attribute.
accessibilityServiceInfo.crashed = true;
diff --git a/services/core/Android.bp b/services/core/Android.bp
index d885cd197387..81f600e80c45 100644
--- a/services/core/Android.bp
+++ b/services/core/Android.bp
@@ -164,6 +164,7 @@ java_library_static {
"android.hardware.biometrics.fingerprint-V2.3-java",
"android.hardware.biometrics.fingerprint-V2-java",
"android.hardware.oemlock-V1.0-java",
+ "android.hardware.oemlock-V1-java",
"android.hardware.configstore-V1.1-java",
"android.hardware.ir-V1-java",
"android.hardware.rebootescrow-V1-java",
diff --git a/services/core/java/com/android/server/DynamicSystemService.java b/services/core/java/com/android/server/DynamicSystemService.java
index 27215b2fbf30..cbacee6ba72c 100644
--- a/services/core/java/com/android/server/DynamicSystemService.java
+++ b/services/core/java/com/android/server/DynamicSystemService.java
@@ -44,7 +44,7 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {
private static final String TAG = "DynamicSystemService";
private static final long MINIMUM_SD_MB = (30L << 10);
private static final int GSID_ROUGH_TIMEOUT_MS = 8192;
- private static final String PATH_DEFAULT = "/data/gsi/";
+ private static final String PATH_DEFAULT = "/data/gsi/dsu/";
private Context mContext;
private String mInstallPath, mDsuSlot;
private volatile IGsiService mGsiService;
@@ -226,9 +226,7 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {
IGsiService gsiService = getGsiService();
if (enable) {
try {
- if (mDsuSlot == null) {
- mDsuSlot = gsiService.getActiveDsuSlot();
- }
+ getActiveDsuSlot();
GsiServiceCallback callback = new GsiServiceCallback();
synchronized (callback) {
gsiService.enableGsiAsync(oneShot, mDsuSlot, callback);
@@ -287,4 +285,15 @@ public class DynamicSystemService extends IDynamicSystemService.Stub {
return getGsiService().suggestScratchSize();
}
+
+ @Override
+ @EnforcePermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
+ public String getActiveDsuSlot() throws RemoteException {
+ super.getActiveDsuSlot_enforcePermission();
+
+ if (mDsuSlot == null) {
+ mDsuSlot = getGsiService().getActiveDsuSlot();
+ }
+ return mDsuSlot;
+ }
}
diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java
index 2aa93783c501..17cdfdb29b98 100644
--- a/services/core/java/com/android/server/NetworkManagementService.java
+++ b/services/core/java/com/android/server/NetworkManagementService.java
@@ -56,7 +56,6 @@ import android.net.NetworkPolicyManager;
import android.net.NetworkStack;
import android.net.NetworkStats;
import android.net.RouteInfo;
-import android.net.UidRangeParcel;
import android.net.util.NetdService;
import android.os.BatteryStats;
import android.os.Binder;
@@ -97,7 +96,6 @@ import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.InterfaceAddress;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -1346,70 +1344,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
}
}
- private void closeSocketsForFirewallChainLocked(int chain, String chainName) {
- // UID ranges to close sockets on.
- UidRangeParcel[] ranges;
- // UID ranges whose sockets we won't touch.
- int[] exemptUids;
-
- int numUids = 0;
- if (DBG) Slog.d(TAG, "Closing sockets after enabling chain " + chainName);
- if (getFirewallType(chain) == FIREWALL_ALLOWLIST) {
- // Close all sockets on all non-system UIDs...
- ranges = new UidRangeParcel[] {
- // TODO: is there a better way of finding all existing users? If so, we could
- // specify their ranges here.
- new UidRangeParcel(Process.FIRST_APPLICATION_UID, Integer.MAX_VALUE),
- };
- // ... except for the UIDs that have allow rules.
- synchronized (mRulesLock) {
- final SparseIntArray rules = getUidFirewallRulesLR(chain);
- exemptUids = new int[rules.size()];
- for (int i = 0; i < exemptUids.length; i++) {
- if (rules.valueAt(i) == FIREWALL_RULE_ALLOW) {
- exemptUids[numUids] = rules.keyAt(i);
- numUids++;
- }
- }
- }
- // Normally, allowlist chains only contain deny rules, so numUids == exemptUids.length.
- // But the code does not guarantee this in any way, and at least in one case - if we add
- // a UID rule to the firewall, and then disable the firewall - the chains can contain
- // the wrong type of rule. In this case, don't close connections that we shouldn't.
- //
- // TODO: tighten up this code by ensuring we never set the wrong type of rule, and
- // fix setFirewallEnabled to grab mQuotaLock and clear rules.
- if (numUids != exemptUids.length) {
- exemptUids = Arrays.copyOf(exemptUids, numUids);
- }
- } else {
- // Close sockets for every UID that has a deny rule...
- synchronized (mRulesLock) {
- final SparseIntArray rules = getUidFirewallRulesLR(chain);
- ranges = new UidRangeParcel[rules.size()];
- for (int i = 0; i < ranges.length; i++) {
- if (rules.valueAt(i) == FIREWALL_RULE_DENY) {
- int uid = rules.keyAt(i);
- ranges[numUids] = new UidRangeParcel(uid, uid);
- numUids++;
- }
- }
- }
- // As above; usually numUids == ranges.length, but not always.
- if (numUids != ranges.length) {
- ranges = Arrays.copyOf(ranges, numUids);
- }
- // ... with no exceptions.
- exemptUids = new int[0];
- }
-
- try {
- mNetdService.socketDestroy(ranges, exemptUids);
- } catch(RemoteException | ServiceSpecificException e) {
- Slog.e(TAG, "Error closing sockets after enabling chain " + chainName + ": " + e);
- }
- }
-
@Override
public void setFirewallChainEnabled(int chain, boolean enable) {
enforceSystemUid();
@@ -1434,14 +1368,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
} catch (RuntimeException e) {
throw new IllegalStateException(e);
}
-
- // Close any sockets that were opened by the affected UIDs. This has to be done after
- // disabling network connectivity, in case they react to the socket close by reopening
- // the connection and race with the iptables commands that enable the firewall. All
- // allowlist and denylist chains allow RSTs through.
- if (enable) {
- closeSocketsForFirewallChainLocked(chain, chainName);
- }
}
}
diff --git a/services/core/java/com/android/server/OWNERS b/services/core/java/com/android/server/OWNERS
index 123cd3288343..55130e4cbbe6 100644
--- a/services/core/java/com/android/server/OWNERS
+++ b/services/core/java/com/android/server/OWNERS
@@ -1,3 +1,6 @@
+# BootReceiver
+per-file BootReceiver.java = gaillard@google.com
+
# Connectivity / Networking
per-file ConnectivityService.java,ConnectivityServiceInitializer.java,NetworkManagementService.java,NsdService.java,VpnManagerService.java = file:/services/core/java/com/android/server/net/OWNERS
diff --git a/services/core/java/com/android/server/TEST_MAPPING b/services/core/java/com/android/server/TEST_MAPPING
index d9da1c7999df..a317d23457be 100644
--- a/services/core/java/com/android/server/TEST_MAPPING
+++ b/services/core/java/com/android/server/TEST_MAPPING
@@ -48,6 +48,11 @@
}
],
"file_patterns": ["BinaryTransparencyService\\.java"]
+ },
+ {
+ // GWP-ASan's CTS test ensures that recoverable tombstones work,
+ // which is emitted by the NativeTombstoneManager.
+ "name": "CtsGwpAsanTestCases"
}
],
"presubmit-large": [
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 77a54a568859..1afda6572a21 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -1578,57 +1578,62 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
return;
}
- synchronized (mRecords) {
- String str = "notifyServiceStateForSubscriber: subId=" + subId + " phoneId=" + phoneId
- + " state=" + state;
- if (VDBG) {
- log(str);
- }
- mLocalLog.log(str);
- // for service state updates, don't notify clients when subId is invalid. This prevents
- // us from sending incorrect notifications like b/133140128
- // In the future, we can remove this logic for every notification here and add a
- // callback so listeners know when their PhoneStateListener's subId becomes invalid, but
- // for now we use the simplest fix.
- if (validatePhoneId(phoneId) && SubscriptionManager.isValidSubscriptionId(subId)) {
- mServiceState[phoneId] = state;
+ final long callingIdentity = Binder.clearCallingIdentity();
+ try {
+ synchronized (mRecords) {
+ String str = "notifyServiceStateForSubscriber: subId=" + subId + " phoneId="
+ + phoneId + " state=" + state;
+ if (VDBG) {
+ log(str);
+ }
+ mLocalLog.log(str);
+ // for service state updates, don't notify clients when subId is invalid. This
+ // prevents us from sending incorrect notifications like b/133140128
+ // In the future, we can remove this logic for every notification here and add a
+ // callback so listeners know when their PhoneStateListener's subId becomes invalid,
+ // but for now we use the simplest fix.
+ if (validatePhoneId(phoneId) && SubscriptionManager.isValidSubscriptionId(subId)) {
+ mServiceState[phoneId] = state;
- for (Record r : mRecords) {
- if (VDBG) {
- log("notifyServiceStateForSubscriber: r=" + r + " subId=" + subId
- + " phoneId=" + phoneId + " state=" + state);
- }
- if (r.matchTelephonyCallbackEvent(
- TelephonyCallback.EVENT_SERVICE_STATE_CHANGED)
- && idMatch(r, subId, phoneId)) {
+ for (Record r : mRecords) {
+ if (VDBG) {
+ log("notifyServiceStateForSubscriber: r=" + r + " subId=" + subId
+ + " phoneId=" + phoneId + " state=" + state);
+ }
+ if (r.matchTelephonyCallbackEvent(
+ TelephonyCallback.EVENT_SERVICE_STATE_CHANGED)
+ && idMatch(r, subId, phoneId)) {
- try {
- ServiceState stateToSend;
- if (checkFineLocationAccess(r, Build.VERSION_CODES.Q)) {
- stateToSend = new ServiceState(state);
- } else if (checkCoarseLocationAccess(r, Build.VERSION_CODES.Q)) {
- stateToSend = state.createLocationInfoSanitizedCopy(false);
- } else {
- stateToSend = state.createLocationInfoSanitizedCopy(true);
- }
- if (DBG) {
- log("notifyServiceStateForSubscriber: callback.onSSC r=" + r
- + " subId=" + subId + " phoneId=" + phoneId
- + " state=" + state);
+ try {
+ ServiceState stateToSend;
+ if (checkFineLocationAccess(r, Build.VERSION_CODES.Q)) {
+ stateToSend = new ServiceState(state);
+ } else if (checkCoarseLocationAccess(r, Build.VERSION_CODES.Q)) {
+ stateToSend = state.createLocationInfoSanitizedCopy(false);
+ } else {
+ stateToSend = state.createLocationInfoSanitizedCopy(true);
+ }
+ if (DBG) {
+ log("notifyServiceStateForSubscriber: callback.onSSC r=" + r
+ + " subId=" + subId + " phoneId=" + phoneId
+ + " state=" + stateToSend);
+ }
+ r.callback.onServiceStateChanged(stateToSend);
+ } catch (RemoteException ex) {
+ mRemoveList.add(r.binder);
}
- r.callback.onServiceStateChanged(stateToSend);
- } catch (RemoteException ex) {
- mRemoveList.add(r.binder);
}
}
+ } else {
+ log("notifyServiceStateForSubscriber: INVALID phoneId=" + phoneId
+ + " or subId=" + subId);
}
- } else {
- log("notifyServiceStateForSubscriber: INVALID phoneId=" + phoneId
- + " or subId=" + subId);
+ handleRemoveListLocked();
}
- handleRemoveListLocked();
+ broadcastServiceStateChanged(state, phoneId, subId);
+ } finally {
+ Binder.restoreCallingIdentity(callingIdentity);
}
- broadcastServiceStateChanged(state, phoneId, subId);
}
public void notifySimActivationStateChangedForPhoneId(int phoneId, int subId,
@@ -3161,13 +3166,10 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
public static final String ACTION_SIGNAL_STRENGTH_CHANGED = "android.intent.action.SIG_STR";
private void broadcastServiceStateChanged(ServiceState state, int phoneId, int subId) {
- final long ident = Binder.clearCallingIdentity();
try {
mBatteryStats.notePhoneState(state.getState());
} catch (RemoteException re) {
// Can't do much
- } finally {
- Binder.restoreCallingIdentity(ident);
}
// Send the broadcast exactly once to all possible disjoint sets of apps.
@@ -3184,8 +3186,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
// - Sanitized ServiceState sent to all other apps with READ_PHONE_STATE
// - Sanitized ServiceState sent to all other apps with READ_PRIVILEGED_PHONE_STATE but not
// READ_PHONE_STATE
- if (Binder.withCleanCallingIdentity(() ->
- LocationAccessPolicy.isLocationModeEnabled(mContext, mContext.getUserId()))) {
+ if (LocationAccessPolicy.isLocationModeEnabled(mContext, mContext.getUserId())) {
Intent fullIntent = createServiceStateIntent(state, subId, phoneId, false);
mContext.createContextAsUser(UserHandle.ALL, 0).sendBroadcastMultiplePermissions(
fullIntent,
diff --git a/services/core/java/com/android/server/VpnManagerService.java b/services/core/java/com/android/server/VpnManagerService.java
index 2b43ef48b922..9b4f9683d550 100644
--- a/services/core/java/com/android/server/VpnManagerService.java
+++ b/services/core/java/com/android/server/VpnManagerService.java
@@ -406,7 +406,7 @@ public class VpnManagerService extends IVpnManager.Stub {
* Retrieve the VpnProfileState for the profile provisioned by the given package.
*
* @return the VpnProfileState with current information, or null if there was no profile
- * provisioned by the given package.
+ * provisioned and started by the given package.
* @hide
*/
@Override
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index c36e0700c723..7aef89452c78 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -2928,7 +2928,9 @@ public final class ActiveServices {
final ProcessServiceRecord clientPsr = b.client.mServices;
clientPsr.addConnection(c);
c.startAssociationIfNeeded();
- if ((c.flags&Context.BIND_ABOVE_CLIENT) != 0) {
+ // Don't set hasAboveClient if binding to self to prevent modifyRawOomAdj() from
+ // dropping the process' adjustment level.
+ if (b.client != s.app && (c.flags & Context.BIND_ABOVE_CLIENT) != 0) {
clientPsr.setHasAboveClient(true);
}
if ((c.flags&Context.BIND_ALLOW_WHITELIST_MANAGEMENT) != 0) {
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 0eda49e6b874..148688fc4aa5 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -10784,6 +10784,13 @@ public class ActivityManagerService extends IActivityManager.Stub
pw.println("\n\n** Cache info for pid " + pid + " [" + r.processName + "] **");
pw.flush();
try {
+ if (pid == Process.myPid()) {
+ // Directly dump to target fd for local dump to avoid hang.
+ try (ParcelFileDescriptor pfd = ParcelFileDescriptor.fromFd(fd.getInt$())) {
+ thread.dumpCacheInfo(pfd, args);
+ }
+ continue;
+ }
TransferPipe tp = new TransferPipe();
try {
thread.dumpCacheInfo(tp.getWriteFd(), args);
@@ -13100,12 +13107,17 @@ public class ActivityManagerService extends IActivityManager.Stub
public Intent registerReceiverWithFeature(IApplicationThread caller, String callerPackage,
String callerFeatureId, String receiverId, IIntentReceiver receiver,
IntentFilter filter, String permission, int userId, int flags) {
+ enforceNotIsolatedCaller("registerReceiver");
+
// Allow Sandbox process to register only unexported receivers.
- if ((flags & Context.RECEIVER_NOT_EXPORTED) != 0) {
- enforceNotIsolatedCaller("registerReceiver");
- } else if (mSdkSandboxSettings.isBroadcastReceiverRestrictionsEnforced()) {
- enforceNotIsolatedOrSdkSandboxCaller("registerReceiver");
+ boolean unexported = (flags & Context.RECEIVER_NOT_EXPORTED) != 0;
+ if (mSdkSandboxSettings.isBroadcastReceiverRestrictionsEnforced()
+ && Process.isSdkSandboxUid(Binder.getCallingUid())
+ && !unexported) {
+ throw new SecurityException("SDK sandbox process not allowed to call "
+ + "registerReceiver");
}
+
ArrayList<Intent> stickyIntents = null;
ProcessRecord callerApp = null;
final boolean visibleToInstantApps
diff --git a/services/core/java/com/android/server/am/BaseAppStateTimeSlotEventsTracker.java b/services/core/java/com/android/server/am/BaseAppStateTimeSlotEventsTracker.java
index ff78355121d5..62680823588d 100644
--- a/services/core/java/com/android/server/am/BaseAppStateTimeSlotEventsTracker.java
+++ b/services/core/java/com/android/server/am/BaseAppStateTimeSlotEventsTracker.java
@@ -338,7 +338,7 @@ abstract class BaseAppStateTimeSlotEventsTracker
pw.print(prefix);
pw.print(mKeyNumOfEventsThreshold);
pw.print('=');
- pw.println(mDefaultNumOfEventsThreshold);
+ pw.println(mNumOfEventsThreshold);
}
pw.print(prefix);
pw.print("event_time_slot_size=");
diff --git a/services/core/java/com/android/server/am/BatteryExternalStatsWorker.java b/services/core/java/com/android/server/am/BatteryExternalStatsWorker.java
index 702526a4beab..1a0d291d375c 100644
--- a/services/core/java/com/android/server/am/BatteryExternalStatsWorker.java
+++ b/services/core/java/com/android/server/am/BatteryExternalStatsWorker.java
@@ -399,7 +399,7 @@ class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStatsSync {
}
}
- public void shutdown() {
+ public synchronized void shutdown() {
mExecutorService.shutdownNow();
}
diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java
index 8439a7d9b743..5ae06c065204 100644
--- a/services/core/java/com/android/server/am/BatteryStatsService.java
+++ b/services/core/java/com/android/server/am/BatteryStatsService.java
@@ -1982,32 +1982,6 @@ public final class BatteryStatsService extends IBatteryStats.Stub
}
}
- /**
- * Bluetooth on stat logging
- */
- public void noteBluetoothOn(int uid, int reason, String packageName) {
- if (Binder.getCallingPid() != Process.myPid()) {
- mContext.enforcePermission(android.Manifest.permission.BLUETOOTH_CONNECT,
- Binder.getCallingPid(), uid, null);
- }
- FrameworkStatsLog.write_non_chained(FrameworkStatsLog.BLUETOOTH_ENABLED_STATE_CHANGED,
- uid, null, FrameworkStatsLog.BLUETOOTH_ENABLED_STATE_CHANGED__STATE__ENABLED,
- reason, packageName);
- }
-
- /**
- * Bluetooth off stat logging
- */
- public void noteBluetoothOff(int uid, int reason, String packageName) {
- if (Binder.getCallingPid() != Process.myPid()) {
- mContext.enforcePermission(android.Manifest.permission.BLUETOOTH_CONNECT,
- Binder.getCallingPid(), uid, null);
- }
- FrameworkStatsLog.write_non_chained(FrameworkStatsLog.BLUETOOTH_ENABLED_STATE_CHANGED,
- uid, null, FrameworkStatsLog.BLUETOOTH_ENABLED_STATE_CHANGED__STATE__DISABLED,
- reason, packageName);
- }
-
@Override
public void noteBleScanStarted(final WorkSource ws, final boolean isUnoptimized) {
enforceCallingPermission();
diff --git a/services/core/java/com/android/server/am/OomAdjuster.java b/services/core/java/com/android/server/am/OomAdjuster.java
index 54718c9b9865..7caac2f6228b 100644
--- a/services/core/java/com/android/server/am/OomAdjuster.java
+++ b/services/core/java/com/android/server/am/OomAdjuster.java
@@ -2900,7 +2900,11 @@ public class OomAdjuster {
// {@link ProcessList.SCHED_GROUP_TOP_APP}. We don't check render thread because it
// is not ready when attaching.
app.getWindowProcessController().onTopProcChanged();
- setThreadPriority(app.getPid(), THREAD_PRIORITY_TOP_APP_BOOST);
+ if (mService.mUseFifoUiScheduling) {
+ mService.scheduleAsFifoPriority(app.getPid(), true);
+ } else {
+ setThreadPriority(app.getPid(), THREAD_PRIORITY_TOP_APP_BOOST);
+ }
initialSchedGroup = ProcessList.SCHED_GROUP_TOP_APP;
} catch (Exception e) {
Slog.w(TAG, "Failed to pre-set top priority to " + app + " " + e);
diff --git a/services/core/java/com/android/server/am/ProcessServiceRecord.java b/services/core/java/com/android/server/am/ProcessServiceRecord.java
index 67eb675503ad..31830c5f6ee3 100644
--- a/services/core/java/com/android/server/am/ProcessServiceRecord.java
+++ b/services/core/java/com/android/server/am/ProcessServiceRecord.java
@@ -258,7 +258,8 @@ final class ProcessServiceRecord {
mHasAboveClient = false;
for (int i = mConnections.size() - 1; i >= 0; i--) {
ConnectionRecord cr = mConnections.valueAt(i);
- if ((cr.flags & Context.BIND_ABOVE_CLIENT) != 0) {
+ if (cr.binding.service.app.mServices != this
+ && (cr.flags & Context.BIND_ABOVE_CLIENT) != 0) {
mHasAboveClient = true;
break;
}
diff --git a/services/core/java/com/android/server/audio/AudioDeviceBroker.java b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
index e1ae8d93e091..c161d8d472bd 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceBroker.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
@@ -1787,7 +1787,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
try {
mCb.unlinkToDeath(this, 0);
} catch (NoSuchElementException e) {
- Log.w(TAG, "CommunicationRouteClient could not not unregistered to binder");
+ Log.w(TAG, "CommunicationRouteClient could not unlink to " + mCb + " binder death");
}
}
diff --git a/services/core/java/com/android/server/connectivity/NetdEventListenerService.java b/services/core/java/com/android/server/connectivity/NetdEventListenerService.java
index 1f82961efd22..6d4306198aa2 100644
--- a/services/core/java/com/android/server/connectivity/NetdEventListenerService.java
+++ b/services/core/java/com/android/server/connectivity/NetdEventListenerService.java
@@ -41,6 +41,7 @@ import android.util.SparseArray;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.util.ArrayUtils;
import com.android.internal.util.BitUtils;
import com.android.internal.util.FrameworkStatsLog;
import com.android.internal.util.RingBuffer;
@@ -278,6 +279,11 @@ public class NetdEventListenerService extends BaseNetdEventListener {
}
}
+ private boolean hasWifiTransport(Network network) {
+ final NetworkCapabilities nc = mCm.getNetworkCapabilities(network);
+ return nc.hasTransport(NetworkCapabilities.TRANSPORT_WIFI);
+ }
+
@Override
public synchronized void onWakeupEvent(String prefix, int uid, int ethertype, int ipNextHeader,
byte[] dstHw, String srcIp, String dstIp, int srcPort, int dstPort, long timestampNs) {
@@ -286,12 +292,21 @@ public class NetdEventListenerService extends BaseNetdEventListener {
throw new IllegalArgumentException("Prefix " + prefix
+ " required in format <nethandle>:<interface>");
}
+ final long netHandle = Long.parseLong(prefixParts[0]);
+ final Network network = Network.fromNetworkHandle(netHandle);
final WakeupEvent event = new WakeupEvent();
event.iface = prefixParts[1];
event.uid = uid;
event.ethertype = ethertype;
- event.dstHwAddr = MacAddress.fromBytes(dstHw);
+ if (ArrayUtils.isEmpty(dstHw)) {
+ if (hasWifiTransport(network)) {
+ Log.e(TAG, "Empty mac address on WiFi transport, network: " + network);
+ }
+ event.dstHwAddr = null;
+ } else {
+ event.dstHwAddr = MacAddress.fromBytes(dstHw);
+ }
event.srcIp = srcIp;
event.dstIp = dstIp;
event.ipNextHeader = ipNextHeader;
@@ -306,14 +321,12 @@ public class NetdEventListenerService extends BaseNetdEventListener {
final BatteryStatsInternal bsi = LocalServices.getService(BatteryStatsInternal.class);
if (bsi != null) {
- final long netHandle = Long.parseLong(prefixParts[0]);
final long elapsedMs = SystemClock.elapsedRealtime() + event.timestampMs
- System.currentTimeMillis();
- bsi.noteCpuWakingNetworkPacket(Network.fromNetworkHandle(netHandle), elapsedMs,
- event.uid);
+ bsi.noteCpuWakingNetworkPacket(network, elapsedMs, event.uid);
}
- final String dstMac = event.dstHwAddr.toString();
+ final String dstMac = String.valueOf(event.dstHwAddr);
FrameworkStatsLog.write(FrameworkStatsLog.PACKET_WAKEUP_OCCURRED,
uid, event.iface, ethertype, dstMac, srcIp, dstIp, ipNextHeader, srcPort, dstPort);
}
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index 1dc2725feb1b..e85eee817d29 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -85,6 +85,7 @@ import android.net.NetworkScore;
import android.net.NetworkSpecifier;
import android.net.RouteInfo;
import android.net.TelephonyNetworkSpecifier;
+import android.net.TransportInfo;
import android.net.UidRangeParcel;
import android.net.UnderlyingNetworkInfo;
import android.net.Uri;
@@ -107,6 +108,8 @@ import android.net.ipsec.ike.exceptions.IkeNetworkLostException;
import android.net.ipsec.ike.exceptions.IkeNonProtocolException;
import android.net.ipsec.ike.exceptions.IkeProtocolException;
import android.net.ipsec.ike.exceptions.IkeTimeoutException;
+import android.net.vcn.VcnGatewayConnectionConfig;
+import android.net.vcn.VcnTransportInfo;
import android.os.Binder;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
@@ -306,6 +309,8 @@ public class Vpn {
*/
@VisibleForTesting
static final int DEFAULT_LONG_LIVED_TCP_CONNS_EXPENSIVE_TIMEOUT_SEC = 60;
+
+ private static final int PREFERRED_IKE_PROTOCOL_UNKNOWN = -1;
/**
* Prefer using {@link IkeSessionParams.ESP_IP_VERSION_AUTO} and
* {@link IkeSessionParams.ESP_ENCAP_TYPE_AUTO} for ESP packets.
@@ -453,22 +458,22 @@ public class Vpn {
private static class CarrierConfigInfo {
public final String mccMnc;
- public final int keepaliveDelayMs;
+ public final int keepaliveDelaySec;
public final int encapType;
public final int ipVersion;
- CarrierConfigInfo(String mccMnc, int keepaliveDelayMs,
+ CarrierConfigInfo(String mccMnc, int keepaliveDelaySec,
int encapType,
int ipVersion) {
this.mccMnc = mccMnc;
- this.keepaliveDelayMs = keepaliveDelayMs;
+ this.keepaliveDelaySec = keepaliveDelaySec;
this.encapType = encapType;
this.ipVersion = ipVersion;
}
@Override
public String toString() {
- return "CarrierConfigInfo(" + mccMnc + ") [keepaliveDelayMs=" + keepaliveDelayMs
+ return "CarrierConfigInfo(" + mccMnc + ") [keepaliveDelaySec=" + keepaliveDelaySec
+ ", encapType=" + encapType + ", ipVersion=" + ipVersion + "]";
}
}
@@ -3556,39 +3561,63 @@ public class Vpn {
}
private int guessEspIpVersionForNetwork() {
- final CarrierConfigInfo carrierconfig = getCarrierConfig();
+ if (mUnderlyingNetworkCapabilities.getTransportInfo() instanceof VcnTransportInfo) {
+ Log.d(TAG, "Running over VCN, esp IP version is auto");
+ return ESP_IP_VERSION_AUTO;
+ }
+ final CarrierConfigInfo carrierconfig = getCarrierConfigForUnderlyingNetwork();
final int ipVersion = (carrierconfig != null)
? carrierconfig.ipVersion : ESP_IP_VERSION_AUTO;
if (carrierconfig != null) {
- Log.d(TAG, "Get customized IP version(" + ipVersion + ") on SIM("
+ Log.d(TAG, "Get customized IP version (" + ipVersion + ") on SIM (mccmnc="
+ carrierconfig.mccMnc + ")");
}
return ipVersion;
}
private int guessEspEncapTypeForNetwork() {
- final CarrierConfigInfo carrierconfig = getCarrierConfig();
+ if (mUnderlyingNetworkCapabilities.getTransportInfo() instanceof VcnTransportInfo) {
+ Log.d(TAG, "Running over VCN, encap type is auto");
+ return ESP_ENCAP_TYPE_AUTO;
+ }
+ final CarrierConfigInfo carrierconfig = getCarrierConfigForUnderlyingNetwork();
final int encapType = (carrierconfig != null)
? carrierconfig.encapType : ESP_ENCAP_TYPE_AUTO;
if (carrierconfig != null) {
- Log.d(TAG, "Get customized encap type(" + encapType + ") on SIM("
+ Log.d(TAG, "Get customized encap type (" + encapType + ") on SIM (mccmnc="
+ carrierconfig.mccMnc + ")");
}
return encapType;
}
+
private int guessNattKeepaliveTimerForNetwork() {
- final CarrierConfigInfo carrierconfig = getCarrierConfig();
- final int natKeepalive = (carrierconfig != null)
- ? carrierconfig.keepaliveDelayMs : AUTOMATIC_KEEPALIVE_DELAY_SECONDS;
+ final TransportInfo transportInfo = mUnderlyingNetworkCapabilities.getTransportInfo();
+ if (transportInfo instanceof VcnTransportInfo) {
+ final int nattKeepaliveSec =
+ ((VcnTransportInfo) transportInfo).getMinUdpPort4500NatTimeoutSeconds();
+ Log.d(TAG, "Running over VCN, keepalive timer : " + nattKeepaliveSec + "s");
+ if (VcnGatewayConnectionConfig.MIN_UDP_PORT_4500_NAT_TIMEOUT_UNSET
+ != nattKeepaliveSec) {
+ return nattKeepaliveSec;
+ }
+ // else fall back to carrier config, if any
+ }
+ final CarrierConfigInfo carrierconfig = getCarrierConfigForUnderlyingNetwork();
+ final int nattKeepaliveSec = (carrierconfig != null)
+ ? carrierconfig.keepaliveDelaySec : AUTOMATIC_KEEPALIVE_DELAY_SECONDS;
if (carrierconfig != null) {
- Log.d(TAG, "Get customized keepalive(" + natKeepalive + ") on SIM("
+ Log.d(TAG, "Get customized keepalive (" + nattKeepaliveSec + "s) on SIM (mccmnc="
+ carrierconfig.mccMnc + ")");
}
- return natKeepalive;
+ return nattKeepaliveSec;
}
- private CarrierConfigInfo getCarrierConfig() {
+ /**
+ * Returns the carrier config for the underlying network, or null if not a cell network.
+ */
+ @Nullable
+ private CarrierConfigInfo getCarrierConfigForUnderlyingNetwork() {
final int subId = getCellSubIdForNetworkCapabilities(mUnderlyingNetworkCapabilities);
if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
Log.d(TAG, "Underlying network is not a cellular network");
@@ -3616,11 +3645,11 @@ public class Vpn {
final int natKeepalive =
carrierConfig.getInt(KEY_MIN_UDP_PORT_4500_NAT_TIMEOUT_SEC_INT);
- final int preferredIpPortocol =
- carrierConfig.getInt(KEY_PREFERRED_IKE_PROTOCOL_INT);
+ final int preferredIpProtocol = carrierConfig.getInt(
+ KEY_PREFERRED_IKE_PROTOCOL_INT, PREFERRED_IKE_PROTOCOL_UNKNOWN);
final String mccMnc = perSubTm.getSimOperator(subId);
final CarrierConfigInfo info =
- buildCarrierConfigInfo(mccMnc, natKeepalive, preferredIpPortocol);
+ buildCarrierConfigInfo(mccMnc, natKeepalive, preferredIpProtocol);
synchronized (Vpn.this) {
mCachedCarrierConfigInfoPerSubId.put(subId, info);
}
@@ -3650,8 +3679,11 @@ public class Vpn {
encapType = IkeSessionParams.ESP_ENCAP_TYPE_NONE;
break;
default:
- ipVersion = IkeSessionParams.ESP_IP_VERSION_AUTO;
- encapType = IkeSessionParams.ESP_ENCAP_TYPE_AUTO;
+ // By default, PREFERRED_IKE_PROTOCOL_IPV4_UDP is used for safety. This is
+ // because some carriers' networks do not support IPv6 very well, and using
+ // IPv4 can help to prevent problems.
+ ipVersion = IkeSessionParams.ESP_IP_VERSION_IPV4;
+ encapType = IkeSessionParams.ESP_ENCAP_TYPE_UDP;
break;
}
return new CarrierConfigInfo(mccMnc, natKeepalive, encapType, ipVersion);
@@ -3798,10 +3830,27 @@ public class Vpn {
}, retryDelayMs, TimeUnit.MILLISECONDS);
}
+ private boolean significantCapsChange(@Nullable final NetworkCapabilities left,
+ @Nullable final NetworkCapabilities right) {
+ if (left == right) return false;
+ return null == left
+ || null == right
+ || !Arrays.equals(left.getTransportTypes(), right.getTransportTypes())
+ || !Arrays.equals(left.getCapabilities(), right.getCapabilities())
+ || !Arrays.equals(left.getEnterpriseIds(), right.getEnterpriseIds())
+ || !Objects.equals(left.getTransportInfo(), right.getTransportInfo())
+ || !Objects.equals(left.getAllowedUids(), right.getAllowedUids())
+ || !Objects.equals(left.getUnderlyingNetworks(), right.getUnderlyingNetworks())
+ || !Objects.equals(left.getNetworkSpecifier(), right.getNetworkSpecifier());
+ }
+
/** Called when the NetworkCapabilities of underlying network is changed */
public void onDefaultNetworkCapabilitiesChanged(@NonNull NetworkCapabilities nc) {
- mEventChanges.log("[UnderlyingNW] Cap changed from "
- + mUnderlyingNetworkCapabilities + " to " + nc);
+ if (significantCapsChange(mUnderlyingNetworkCapabilities, nc)) {
+ // TODO : make this log terser
+ mEventChanges.log("[UnderlyingNW] Cap changed from "
+ + mUnderlyingNetworkCapabilities + " to " + nc);
+ }
final NetworkCapabilities oldNc = mUnderlyingNetworkCapabilities;
mUnderlyingNetworkCapabilities = nc;
if (oldNc == null || !nc.getSubscriptionIds().equals(oldNc.getSubscriptionIds())) {
@@ -4963,7 +5012,7 @@ public class Vpn {
* Retrieve the VpnProfileState for the profile provisioned by the given package.
*
* @return the VpnProfileState with current information, or null if there was no profile
- * provisioned by the given package.
+ * provisioned and started by the given package.
*/
@Nullable
public synchronized VpnProfileState getProvisionedVpnProfileState(
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
index fb2d2ee08cbd..84868f58d922 100755..100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
@@ -1125,6 +1125,16 @@ abstract class HdmiCecLocalDevice {
removeActionExcept(clazz, null);
}
+ // Remove all running actions.
+ @ServiceThreadOnly
+ void removeAllActions() {
+ assertRunOnServiceThread();
+ for (HdmiCecFeatureAction action : mActions) {
+ action.finish(false);
+ }
+ mActions.clear();
+ }
+
// Remove all actions matched with the given Class type besides |exception|.
@ServiceThreadOnly
<T extends HdmiCecFeatureAction> void removeActionExcept(
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java
index 32ff5e220825..a46dd0460d3b 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java
@@ -229,6 +229,14 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
super.disableDevice(initiatedByCec, callback);
assertRunOnServiceThread();
mService.unregisterTvInputCallback(mTvInputCallback);
+ // Removing actions and invoking the callback is similar to
+ // HdmiCecLocalDevicePlayback#disableDevice and HdmiCecLocalDeviceTv#disableDevice,
+ // with the difference that in those classes only specific actions are removed and
+ // here we remove all actions. We don't expect any issues with removing all actions
+ // at this time, but we have to pay attention in the future.
+ removeAllActions();
+ // Call the callback instantly or else it will be called 5 seconds later.
+ checkIfPendingActionsCleared();
}
@Override
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index dcf19062834c..d2853370fa69 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -220,6 +220,7 @@ import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
import android.telephony.SubscriptionPlan;
+import android.telephony.TelephonyCallback;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.text.format.DateUtils;
@@ -801,6 +802,16 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
}
return buckets;
}
+
+ /** Require IPC call. Don't call when holding a lock. */
+ int getDefaultDataSubId() {
+ return SubscriptionManager.getDefaultDataSubscriptionId();
+ }
+
+ /** Require IPC call. Don't call when holding a lock. */
+ int getActivateDataSubId() {
+ return SubscriptionManager.getActiveDataSubscriptionId();
+ }
}
@VisibleForTesting
@@ -828,7 +839,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
mSuppressDefaultPolicy = suppressDefaultPolicy;
mDeps = Objects.requireNonNull(deps, "missing Dependencies");
-
+ mActiveDataSubIdListener = new ActiveDataSubIdListener();
mPolicyFile = new AtomicFile(new File(systemDir, "netpolicy.xml"), "net-policy");
mAppOps = context.getSystemService(AppOpsManager.class);
@@ -1088,6 +1099,10 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
}
});
+ // Listen for active data sub Id change, upon which data notifications is shown/hidden.
+ mContext.getSystemService(TelephonyManager.class).registerTelephonyCallback(executor,
+ mActiveDataSubIdListener);
+
// tell systemReady() that the service has been initialized
initCompleteSignal.countDown();
} finally {
@@ -1257,6 +1272,38 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
};
/**
+ * Listener that watches for active data sub Id change, upon which data notifications are
+ * shown/hidden.
+ */
+ private final ActiveDataSubIdListener mActiveDataSubIdListener;
+ private class ActiveDataSubIdListener extends TelephonyCallback implements
+ TelephonyCallback.ActiveDataSubscriptionIdListener {
+ /**
+ * In most cases active data sub is the same as the default data sub, but if user enabled
+ * auto data switch {@link TelephonyManager#MOBILE_DATA_POLICY_AUTO_DATA_SWITCH},
+ * active data sub could be the non-default data sub.
+ *
+ * If the listener is initialized before the phone process is up, the IPC call to the
+ * static method of SubscriptionManager lead to INVALID_SUBSCRIPTION_ID to be returned,
+ * indicating the phone process is unable to determine a valid data sub Id at this point, in
+ * which case no data notifications should be shown anyway. Later on when an active data
+ * sub is known, notifications will be re-evaluated by this callback.
+ */
+ private int mDefaultDataSubId = mDeps.getDefaultDataSubId();
+ private int mActiveDataSubId = mDeps.getActivateDataSubId();
+ // Only listen to active data sub change is sufficient because default data sub change
+ // leads to active data sub change as well.
+ @Override
+ public void onActiveDataSubscriptionIdChanged(int subId) {
+ mActiveDataSubId = subId;
+ mDefaultDataSubId = mDeps.getDefaultDataSubId();
+ synchronized (mNetworkPoliciesSecondLock) {
+ updateNotificationsNL();
+ }
+ }
+ }
+
+ /**
* Listener that watches for {@link NetworkStatsManager} updates, which
* NetworkPolicyManagerService uses to check against {@link NetworkPolicy#warningBytes}.
*/
@@ -1445,6 +1492,9 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
// ignore policies that aren't relevant to user
if (subId == INVALID_SUBSCRIPTION_ID) continue;
+ // ignore if the data sub is neither default nor active for data at the moment.
+ if (subId != mActiveDataSubIdListener.mDefaultDataSubId
+ && subId != mActiveDataSubIdListener.mActiveDataSubId) continue;
if (!policy.hasCycle()) continue;
final Pair<ZonedDateTime, ZonedDateTime> cycle = NetworkPolicyManager
diff --git a/services/core/java/com/android/server/oemlock/OemLockService.java b/services/core/java/com/android/server/oemlock/OemLockService.java
index f19d353a1f7b..ef23a448be00 100644
--- a/services/core/java/com/android/server/oemlock/OemLockService.java
+++ b/services/core/java/com/android/server/oemlock/OemLockService.java
@@ -21,7 +21,6 @@ import android.annotation.Nullable;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.PackageManager;
-import android.hardware.oemlock.V1_0.IOemLock;
import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
@@ -54,15 +53,18 @@ public class OemLockService extends SystemService {
private OemLock mOemLock;
public static boolean isHalPresent() {
- return VendorLock.getOemLockHalService() != null;
+ return (VendorLockHidl.getOemLockHalService() != null)
+ || (VendorLockAidl.getOemLockHalService() != null);
}
/** Select the OEM lock implementation */
private static OemLock getOemLock(Context context) {
- final IOemLock oemLockHal = VendorLock.getOemLockHalService();
- if (oemLockHal != null) {
- Slog.i(TAG, "Using vendor lock via the HAL");
- return new VendorLock(context, oemLockHal);
+ if (VendorLockAidl.getOemLockHalService() != null) {
+ Slog.i(TAG, "Using vendor lock via the HAL(aidl)");
+ return new VendorLockAidl(context);
+ } else if (VendorLockHidl.getOemLockHalService() != null) {
+ Slog.i(TAG, "Using vendor lock via the HAL(hidl)");
+ return new VendorLockHidl(context);
} else {
Slog.i(TAG, "Using persistent data block based lock");
return new PersistentDataBlockLock(context);
diff --git a/services/core/java/com/android/server/oemlock/VendorLockAidl.java b/services/core/java/com/android/server/oemlock/VendorLockAidl.java
new file mode 100644
index 000000000000..82d45ab7c49c
--- /dev/null
+++ b/services/core/java/com/android/server/oemlock/VendorLockAidl.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+package com.android.server.oemlock;
+
+import android.annotation.Nullable;
+import android.content.Context;
+import android.hardware.oemlock.IOemLock;
+import android.hardware.oemlock.OemLockSecureStatus;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.util.Slog;
+
+/** Uses the OEM lock HAL. */
+class VendorLockAidl extends OemLock {
+ private static final String TAG = "OemLock";
+ private IOemLock mOemLock;
+
+ static IOemLock getOemLockHalService() {
+ return IOemLock.Stub.asInterface(
+ ServiceManager.waitForDeclaredService(IOemLock.DESCRIPTOR + "/default"));
+ }
+
+ VendorLockAidl(Context context) {
+ mOemLock = getOemLockHalService();
+ }
+
+ @Override
+ @Nullable
+ String getLockName() {
+ try {
+ return mOemLock.getName();
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Failed to get name from HAL", e);
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ @Override
+ void setOemUnlockAllowedByCarrier(boolean allowed, @Nullable byte[] signature) {
+ try {
+ final int status;
+ if (signature == null) {
+ status = mOemLock.setOemUnlockAllowedByCarrier(allowed, new byte[0]);
+ } else {
+ status = mOemLock.setOemUnlockAllowedByCarrier(allowed, signature);
+ }
+ switch (status) {
+ case OemLockSecureStatus.OK:
+ Slog.i(TAG, "Updated carrier allows OEM lock state to: " + allowed);
+ return;
+
+ case OemLockSecureStatus.INVALID_SIGNATURE:
+ if (signature == null) {
+ throw new IllegalArgumentException("Signature required for carrier unlock");
+ }
+ throw new SecurityException(
+ "Invalid signature used in attempt to carrier unlock");
+
+ default:
+ Slog.e(TAG, "Unknown return value indicates code is out of sync with HAL");
+ // Fallthrough
+ case OemLockSecureStatus.FAILED:
+ throw new RuntimeException("Failed to set carrier OEM unlock state");
+ }
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Failed to set carrier state with HAL", e);
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ @Override
+ boolean isOemUnlockAllowedByCarrier() {
+ try {
+ return mOemLock.isOemUnlockAllowedByCarrier();
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Failed to get carrier state from HAL");
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ @Override
+ void setOemUnlockAllowedByDevice(boolean allowedByDevice) {
+ try {
+ mOemLock.setOemUnlockAllowedByDevice(allowedByDevice);
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Failed to set device state with HAL", e);
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ @Override
+ boolean isOemUnlockAllowedByDevice() {
+
+ try {
+ return mOemLock.isOemUnlockAllowedByDevice();
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Failed to get devie state from HAL");
+ throw e.rethrowFromSystemServer();
+ }
+ }
+}
diff --git a/services/core/java/com/android/server/oemlock/VendorLock.java b/services/core/java/com/android/server/oemlock/VendorLockHidl.java
index 9c876da320a9..fe76787e8bd8 100644
--- a/services/core/java/com/android/server/oemlock/VendorLock.java
+++ b/services/core/java/com/android/server/oemlock/VendorLockHidl.java
@@ -27,10 +27,8 @@ import android.util.Slog;
import java.util.ArrayList;
import java.util.NoSuchElementException;
-/**
- * Uses the OEM lock HAL.
- */
-class VendorLock extends OemLock {
+/** Uses the OEM lock HAL. */
+class VendorLockHidl extends OemLock {
private static final String TAG = "OemLock";
private Context mContext;
@@ -40,29 +38,30 @@ class VendorLock extends OemLock {
try {
return IOemLock.getService(/* retry */ true);
} catch (NoSuchElementException e) {
- Slog.i(TAG, "OemLock HAL not present on device");
+ Slog.i(TAG, "OemLock Hidl HAL not present on device");
return null;
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
- VendorLock(Context context, IOemLock oemLock) {
+ VendorLockHidl(Context context) {
mContext = context;
- mOemLock = oemLock;
+ mOemLock = getOemLockHalService();
}
@Override
@Nullable
String getLockName() {
- final Integer[] requestStatus = new Integer[1];
final String[] lockName = new String[1];
+ final Integer[] requestStatus = new Integer[1];
try {
- mOemLock.getName((status, name) -> {
- requestStatus[0] = status;
- lockName[0] = name;
- });
+ mOemLock.getName(
+ (status, name) -> {
+ requestStatus[0] = status;
+ lockName[0] = name;
+ });
} catch (RemoteException e) {
Slog.e(TAG, "Failed to get name from HAL", e);
throw e.rethrowFromSystemServer();
@@ -113,14 +112,14 @@ class VendorLock extends OemLock {
@Override
boolean isOemUnlockAllowedByCarrier() {
- final Integer[] requestStatus = new Integer[1];
final Boolean[] allowedByCarrier = new Boolean[1];
-
+ final Integer[] requestStatus = new Integer[1];
try {
- mOemLock.isOemUnlockAllowedByCarrier((status, allowed) -> {
- requestStatus[0] = status;
- allowedByCarrier[0] = allowed;
- });
+ mOemLock.isOemUnlockAllowedByCarrier(
+ (status, allowed) -> {
+ requestStatus[0] = status;
+ allowedByCarrier[0] = allowed;
+ });
} catch (RemoteException e) {
Slog.e(TAG, "Failed to get carrier state from HAL");
throw e.rethrowFromSystemServer();
@@ -161,14 +160,15 @@ class VendorLock extends OemLock {
@Override
boolean isOemUnlockAllowedByDevice() {
- final Integer[] requestStatus = new Integer[1];
final Boolean[] allowedByDevice = new Boolean[1];
+ final Integer[] requestStatus = new Integer[1];
try {
- mOemLock.isOemUnlockAllowedByDevice((status, allowed) -> {
- requestStatus[0] = status;
- allowedByDevice[0] = allowed;
- });
+ mOemLock.isOemUnlockAllowedByDevice(
+ (status, allowed) -> {
+ requestStatus[0] = status;
+ allowedByDevice[0] = allowed;
+ });
} catch (RemoteException e) {
Slog.e(TAG, "Failed to get devie state from HAL");
throw e.rethrowFromSystemServer();
diff --git a/services/core/java/com/android/server/os/OWNERS b/services/core/java/com/android/server/os/OWNERS
index 19573323e5ad..70be161ba9a8 100644
--- a/services/core/java/com/android/server/os/OWNERS
+++ b/services/core/java/com/android/server/os/OWNERS
@@ -1,2 +1,5 @@
# Bugreporting
per-file Bugreport* = file:/platform/frameworks/native:/cmds/dumpstate/OWNERS
+
+# NativeTombstone
+per-file NativeTombstone* = gaillard@google.com
diff --git a/services/core/java/com/android/server/pm/ApkChecksums.java b/services/core/java/com/android/server/pm/ApkChecksums.java
index ffe0ca003817..b00cc1acee34 100644
--- a/services/core/java/com/android/server/pm/ApkChecksums.java
+++ b/services/core/java/com/android/server/pm/ApkChecksums.java
@@ -40,8 +40,6 @@ import android.content.pm.SigningDetails.SignatureSchemeVersion;
import android.content.pm.parsing.ApkLiteParseUtils;
import android.content.pm.parsing.result.ParseResult;
import android.content.pm.parsing.result.ParseTypeImpl;
-import android.os.Environment;
-import android.os.FileUtils;
import android.os.Handler;
import android.os.RemoteException;
import android.os.SystemClock;
@@ -638,18 +636,9 @@ public class ApkChecksums {
return null;
}
- private static boolean containsFile(File dir, String filePath) {
- if (dir == null) {
- return false;
- }
- return FileUtils.contains(dir.getAbsolutePath(), filePath);
- }
-
private static ApkChecksum extractHashFromFS(String split, String filePath) {
// verity first
- // Skip /product folder.
- // TODO(b/231354111): remove this hack once we are allowed to change SELinux rules.
- if (!containsFile(Environment.getProductDirectory(), filePath)) {
+ if (VerityUtils.hasFsverity(filePath)) {
byte[] verityHash = VerityUtils.getFsverityDigest(filePath);
if (verityHash != null) {
return new ApkChecksum(split, TYPE_WHOLE_MERKLE_ROOT_4K_SHA256, verityHash);
diff --git a/services/core/java/com/android/server/pm/InstallPackageHelper.java b/services/core/java/com/android/server/pm/InstallPackageHelper.java
index 6a40a3efd30f..3dac305cef5b 100644
--- a/services/core/java/com/android/server/pm/InstallPackageHelper.java
+++ b/services/core/java/com/android/server/pm/InstallPackageHelper.java
@@ -2429,10 +2429,10 @@ final class InstallPackageHelper {
// will be null whereas dataOwnerPkg will contain information about the package
// which was uninstalled while keeping its data.
AndroidPackage dataOwnerPkg = mPm.mPackages.get(packageName);
+ PackageSetting dataOwnerPs = mPm.mSettings.getPackageLPr(packageName);
if (dataOwnerPkg == null) {
- PackageSetting ps = mPm.mSettings.getPackageLPr(packageName);
- if (ps != null) {
- dataOwnerPkg = ps.getPkg();
+ if (dataOwnerPs != null) {
+ dataOwnerPkg = dataOwnerPs.getPkg();
}
}
@@ -2460,6 +2460,7 @@ final class InstallPackageHelper {
if (dataOwnerPkg != null && !dataOwnerPkg.isSdkLibrary()) {
if (!PackageManagerServiceUtils.isDowngradePermitted(installFlags,
dataOwnerPkg.isDebuggable())) {
+ // Downgrade is not permitted; a lower version of the app will not be allowed
try {
PackageManagerServiceUtils.checkDowngrade(dataOwnerPkg, pkgLite);
} catch (PackageManagerException e) {
@@ -2468,6 +2469,28 @@ final class InstallPackageHelper {
return Pair.create(
PackageManager.INSTALL_FAILED_VERSION_DOWNGRADE, errorMsg);
}
+ } else if (dataOwnerPs.isSystem()) {
+ // Downgrade is permitted, but system apps can't be downgraded below
+ // the version preloaded onto the system image
+ final PackageSetting disabledPs = mPm.mSettings.getDisabledSystemPkgLPr(
+ dataOwnerPs);
+ if (disabledPs != null) {
+ dataOwnerPkg = disabledPs.getPkg();
+ }
+ if (!Build.IS_DEBUGGABLE && !dataOwnerPkg.isDebuggable()) {
+ // Only restrict non-debuggable builds and non-debuggable version of the app
+ try {
+ PackageManagerServiceUtils.checkDowngrade(dataOwnerPkg, pkgLite);
+ } catch (PackageManagerException e) {
+ String errorMsg =
+ "System app: " + packageName + " cannot be downgraded to"
+ + " older than its preloaded version on the system"
+ + " image. " + e.getMessage();
+ Slog.w(TAG, errorMsg);
+ return Pair.create(
+ PackageManager.INSTALL_FAILED_VERSION_DOWNGRADE, errorMsg);
+ }
+ }
}
}
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java
index 714be185c972..be719e33dd00 100644
--- a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java
+++ b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java
@@ -38,7 +38,7 @@ import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.app.ActivityManager;
import android.compat.annotation.ChangeId;
-import android.compat.annotation.EnabledSince;
+import android.compat.annotation.Disabled;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -155,7 +155,7 @@ public class PackageManagerServiceUtils {
* allow 3P apps to trigger internal-only functionality.
*/
@ChangeId
- @EnabledSince(targetSdkVersion = Build.VERSION_CODES.TIRAMISU)
+ @Disabled /* Revert enforcement: b/274147456 */
private static final long ENFORCE_INTENTS_TO_MATCH_INTENT_FILTERS = 161252188;
/**
diff --git a/services/core/java/com/android/server/pm/ShortcutPackage.java b/services/core/java/com/android/server/pm/ShortcutPackage.java
index 890c89152a7c..8507ad028a19 100644
--- a/services/core/java/com/android/server/pm/ShortcutPackage.java
+++ b/services/core/java/com/android/server/pm/ShortcutPackage.java
@@ -430,6 +430,7 @@ class ShortcutPackage extends ShortcutPackageItem {
@NonNull List<ShortcutInfo> changedShortcuts) {
Preconditions.checkArgument(newShortcut.isEnabled(),
"pushDynamicShortcuts() cannot publish disabled shortcuts");
+ ensureShortcutCountBeforePush();
newShortcut.addFlags(ShortcutInfo.FLAG_DYNAMIC);
@@ -437,7 +438,7 @@ class ShortcutPackage extends ShortcutPackageItem {
final ShortcutInfo oldShortcut = findShortcutById(newShortcut.getId());
boolean deleted = false;
- if (oldShortcut == null) {
+ if (oldShortcut == null || !oldShortcut.isDynamic()) {
final ShortcutService service = mShortcutUser.mService;
final int maxShortcuts = service.getMaxActivityShortcuts();
@@ -446,18 +447,12 @@ class ShortcutPackage extends ShortcutPackageItem {
final ArrayList<ShortcutInfo> activityShortcuts = all.get(newShortcut.getActivity());
if (activityShortcuts != null && activityShortcuts.size() > maxShortcuts) {
- Slog.e(TAG, "Error pushing shortcut. There are already "
- + activityShortcuts.size() + " shortcuts, exceeding the " + maxShortcuts
- + " shortcuts limit when pushing the new shortcut " + newShortcut
- + ". Id of shortcuts currently available in system memory are "
- + activityShortcuts.stream().map(ShortcutInfo::getId)
- .collect(Collectors.joining(",", "[", "]")));
- // TODO: This should not have happened. If it does, identify the root cause where
- // possible, otherwise bail-out early to prevent memory issue.
+ // Root cause was discovered in b/233155034, so this should not be happening.
+ service.wtf("Error pushing shortcut. There are already "
+ + activityShortcuts.size() + " shortcuts.");
}
if (activityShortcuts != null && activityShortcuts.size() == maxShortcuts) {
// Max has reached. Delete the shortcut with lowest rank.
-
// Sort by isManifestShortcut() and getRank().
Collections.sort(activityShortcuts, mShortcutTypeAndRankComparator);
@@ -473,7 +468,8 @@ class ShortcutPackage extends ShortcutPackageItem {
deleted = deleteDynamicWithId(shortcut.getId(), /* ignoreInvisible =*/ true,
/*ignorePersistedShortcuts=*/ true) != null;
}
- } else {
+ }
+ if (oldShortcut != null) {
// It's an update case.
// Make sure the target is updatable. (i.e. should be mutable.)
oldShortcut.ensureUpdatableWith(newShortcut, /*isUpdating=*/ false);
@@ -505,6 +501,32 @@ class ShortcutPackage extends ShortcutPackageItem {
return deleted;
}
+ private void ensureShortcutCountBeforePush() {
+ final ShortcutService service = mShortcutUser.mService;
+ // Ensure the total number of shortcuts doesn't exceed the hard limit per app.
+ final int maxShortcutPerApp = service.getMaxAppShortcuts();
+ synchronized (mLock) {
+ final List<ShortcutInfo> appShortcuts = mShortcuts.values().stream().filter(si ->
+ !si.isPinned()).collect(Collectors.toList());
+ if (appShortcuts.size() >= maxShortcutPerApp) {
+ // Max has reached. Removes shortcuts until they fall within the hard cap.
+ // Sort by isManifestShortcut(), isDynamic() and getLastChangedTimestamp().
+ Collections.sort(appShortcuts, mShortcutTypeRankAndTimeComparator);
+
+ while (appShortcuts.size() >= maxShortcutPerApp) {
+ final ShortcutInfo shortcut = appShortcuts.remove(appShortcuts.size() - 1);
+ if (shortcut.isDeclaredInManifest()) {
+ // All shortcuts are manifest shortcuts and cannot be removed.
+ throw new IllegalArgumentException(getPackageName() + " has published "
+ + appShortcuts.size() + " manifest shortcuts across different"
+ + " activities.");
+ }
+ forceDeleteShortcutInner(shortcut.getId());
+ }
+ }
+ }
+ }
+
/**
* Remove all shortcuts that aren't pinned, cached nor dynamic.
*
@@ -1367,6 +1389,61 @@ class ShortcutPackage extends ShortcutPackageItem {
};
/**
+ * To sort by isManifestShortcut(), isDynamic(), getRank() and
+ * getLastChangedTimestamp(). i.e. manifest shortcuts come before non-manifest shortcuts,
+ * dynamic shortcuts come before floating shortcuts, then sort by last changed timestamp.
+ *
+ * This is used to decide which shortcuts to remove when the total number of shortcuts retained
+ * for the app exceeds the limit defined in {@link ShortcutService#getMaxAppShortcuts()}.
+ *
+ * (Note the number of manifest shortcuts is always <= the max number, because if there are
+ * more, ShortcutParser would ignore the rest.)
+ */
+ final Comparator<ShortcutInfo> mShortcutTypeRankAndTimeComparator = (ShortcutInfo a,
+ ShortcutInfo b) -> {
+ if (a.isDeclaredInManifest() && !b.isDeclaredInManifest()) {
+ return -1;
+ }
+ if (!a.isDeclaredInManifest() && b.isDeclaredInManifest()) {
+ return 1;
+ }
+ if (a.isDynamic() && b.isDynamic()) {
+ return Integer.compare(a.getRank(), b.getRank());
+ }
+ if (a.isDynamic()) {
+ return -1;
+ }
+ if (b.isDynamic()) {
+ return 1;
+ }
+ if (a.isCached() && b.isCached()) {
+ // if both shortcuts are cached, prioritize shortcuts cached by people tile,
+ if (a.hasFlags(ShortcutInfo.FLAG_CACHED_PEOPLE_TILE)
+ && !b.hasFlags(ShortcutInfo.FLAG_CACHED_PEOPLE_TILE)) {
+ return -1;
+ } else if (!a.hasFlags(ShortcutInfo.FLAG_CACHED_PEOPLE_TILE)
+ && b.hasFlags(ShortcutInfo.FLAG_CACHED_PEOPLE_TILE)) {
+ return 1;
+ }
+ // followed by bubbles.
+ if (a.hasFlags(ShortcutInfo.FLAG_CACHED_BUBBLES)
+ && !b.hasFlags(ShortcutInfo.FLAG_CACHED_BUBBLES)) {
+ return -1;
+ } else if (!a.hasFlags(ShortcutInfo.FLAG_CACHED_BUBBLES)
+ && b.hasFlags(ShortcutInfo.FLAG_CACHED_BUBBLES)) {
+ return 1;
+ }
+ }
+ if (a.isCached()) {
+ return -1;
+ }
+ if (b.isCached()) {
+ return 1;
+ }
+ return Long.compare(b.getLastChangedTimestamp(), a.getLastChangedTimestamp());
+ };
+
+ /**
* Build a list of shortcuts for each target activity and return as a map. The result won't
* contain "floating" shortcuts because they don't belong on any activities.
*/
diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java
index 0b20683185f0..f303fedde567 100644
--- a/services/core/java/com/android/server/pm/ShortcutService.java
+++ b/services/core/java/com/android/server/pm/ShortcutService.java
@@ -181,6 +181,9 @@ public class ShortcutService extends IShortcutService.Stub {
static final int DEFAULT_MAX_SHORTCUTS_PER_ACTIVITY = 15;
@VisibleForTesting
+ static final int DEFAULT_MAX_SHORTCUTS_PER_APP = 100;
+
+ @VisibleForTesting
static final int DEFAULT_MAX_ICON_DIMENSION_DP = 96;
@VisibleForTesting
@@ -257,6 +260,11 @@ public class ShortcutService extends IShortcutService.Stub {
String KEY_MAX_SHORTCUTS = "max_shortcuts";
/**
+ * Key name for the max shortcuts can be retained in system ram per app. (int)
+ */
+ String KEY_MAX_SHORTCUTS_PER_APP = "max_shortcuts_per_app";
+
+ /**
* Key name for icon compression quality, 0-100.
*/
String KEY_ICON_QUALITY = "icon_quality";
@@ -329,11 +337,16 @@ public class ShortcutService extends IShortcutService.Stub {
new SparseArray<>();
/**
- * Max number of dynamic + manifest shortcuts that each application can have at a time.
+ * Max number of dynamic + manifest shortcuts that each activity can have at a time.
*/
private int mMaxShortcuts;
/**
+ * Max number of shortcuts that can exists in system ram for each application.
+ */
+ private int mMaxShortcutsPerApp;
+
+ /**
* Max number of updating API calls that each application can make during the interval.
*/
int mMaxUpdatesPerInterval;
@@ -807,6 +820,9 @@ public class ShortcutService extends IShortcutService.Stub {
mMaxShortcuts = Math.max(0, (int) parser.getLong(
ConfigConstants.KEY_MAX_SHORTCUTS, DEFAULT_MAX_SHORTCUTS_PER_ACTIVITY));
+ mMaxShortcutsPerApp = Math.max(0, (int) parser.getLong(
+ ConfigConstants.KEY_MAX_SHORTCUTS_PER_APP, DEFAULT_MAX_SHORTCUTS_PER_APP));
+
final int iconDimensionDp = Math.max(1, injectIsLowRamDevice()
? (int) parser.getLong(
ConfigConstants.KEY_MAX_ICON_DIMENSION_DP_LOWRAM,
@@ -1759,6 +1775,13 @@ public class ShortcutService extends IShortcutService.Stub {
}
/**
+ * Return the max number of shortcuts can be retaiend in system ram for each application.
+ */
+ int getMaxAppShortcuts() {
+ return mMaxShortcutsPerApp;
+ }
+
+ /**
* - Sends a notification to LauncherApps
* - Write to file
*/
diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
index 5d03200624e4..10e72f5b283c 100644
--- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
+++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
@@ -74,6 +74,8 @@ import com.android.server.pm.KnownPackages;
import com.android.server.pm.permission.LegacyPermissionManagerInternal.PackagesProvider;
import com.android.server.pm.permission.LegacyPermissionManagerInternal.SyncAdapterPackagesProvider;
+import libcore.util.HexEncoding;
+
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -126,6 +128,7 @@ final class DefaultPermissionGrantPolicy {
private static final String ATTR_NAME = "name";
private static final String ATTR_FIXED = "fixed";
private static final String ATTR_WHITELISTED = "whitelisted";
+ private static final String ATTR_CERT = "cert";
private static final Set<String> PHONE_PERMISSIONS = new ArraySet<>();
@@ -1430,7 +1433,7 @@ final class DefaultPermissionGrantPolicy {
final int exceptionCount = mGrantExceptions.size();
for (int i = 0; i < exceptionCount; i++) {
String packageName = mGrantExceptions.keyAt(i);
- PackageInfo pkg = pm.getSystemPackageInfo(packageName);
+ PackageInfo pkg = pm.getPackageInfo(packageName);
List<DefaultPermissionGrant> permissionGrants = mGrantExceptions.valueAt(i);
final int permissionGrantCount = permissionGrants.size();
for (int j = 0; j < permissionGrantCount; j++) {
@@ -1548,12 +1551,12 @@ final class DefaultPermissionGrantPolicy {
}
if (TAG_EXCEPTION.equals(parser.getName())) {
String packageName = parser.getAttributeValue(null, ATTR_PACKAGE);
+ String cert = parser.getAttributeValue(null, ATTR_CERT);
List<DefaultPermissionGrant> packageExceptions =
outGrantExceptions.get(packageName);
if (packageExceptions == null) {
- // The package must be on the system image
- PackageInfo packageInfo = pm.getSystemPackageInfo(packageName);
+ PackageInfo packageInfo = pm.getPackageInfo(packageName);
if (packageInfo == null) {
Log.w(TAG, "No such package:" + packageName);
@@ -1561,8 +1564,8 @@ final class DefaultPermissionGrantPolicy {
continue;
}
- if (!pm.isSystemPackage(packageInfo)) {
- Log.w(TAG, "Unknown system package:" + packageName);
+ if (!isSystemOrCertificateMatchingPackage(packageInfo, cert)) {
+ Log.w(TAG, "Not system or certificate-matching package: " + packageName);
XmlUtils.skipCurrentTag(parser);
continue;
}
@@ -1617,6 +1620,15 @@ final class DefaultPermissionGrantPolicy {
}
}
+ private boolean isSystemOrCertificateMatchingPackage(PackageInfo pi, String cert) {
+ if (cert == null) {
+ return pi.applicationInfo.isSystemApp();
+ }
+
+ return mContext.getPackageManager().hasSigningCertificate(pi.packageName, HexEncoding.
+ decode(cert.replace(":", "")), PackageManager.CERT_INPUT_SHA256);
+ }
+
private static boolean doesPackageSupportRuntimePermissions(PackageInfo pkg) {
return pkg.applicationInfo != null
&& pkg.applicationInfo.targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1;
diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerServiceImpl.java b/services/core/java/com/android/server/pm/permission/PermissionManagerServiceImpl.java
index 554e2690b878..b92e73c49367 100644
--- a/services/core/java/com/android/server/pm/permission/PermissionManagerServiceImpl.java
+++ b/services/core/java/com/android/server/pm/permission/PermissionManagerServiceImpl.java
@@ -2868,9 +2868,7 @@ public class PermissionManagerServiceImpl implements PermissionManagerServiceInt
} else if (!permissionPolicyInitialized
|| (!hardRestricted || restrictionExempt)) {
if ((origPermState != null && origPermState.isGranted())) {
- if (!uidState.grantPermission(bp)) {
- wasChanged = true;
- }
+ uidState.grantPermission(bp);
}
}
if (mIsLeanback && NOTIFICATION_PERMISSIONS.contains(permName)) {
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index a2670eee0106..fd118d2d19a6 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -3349,8 +3349,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
@Override
- public void onKeyguardOccludedChangedLw(boolean occluded) {
- if (mKeyguardDelegate != null && mKeyguardDelegate.isShowing()) {
+ public void onKeyguardOccludedChangedLw(boolean occluded, boolean waitAppTransition) {
+ if (mKeyguardDelegate != null && waitAppTransition) {
mPendingKeyguardOccluded = occluded;
mKeyguardOccludedChanged = true;
} else {
diff --git a/services/core/java/com/android/server/policy/WindowManagerPolicy.java b/services/core/java/com/android/server/policy/WindowManagerPolicy.java
index 4f00992c713e..77007fa229a2 100644
--- a/services/core/java/com/android/server/policy/WindowManagerPolicy.java
+++ b/services/core/java/com/android/server/policy/WindowManagerPolicy.java
@@ -166,9 +166,10 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
/**
* Called when the Keyguard occluded state changed.
+ *
* @param occluded Whether Keyguard is currently occluded or not.
*/
- void onKeyguardOccludedChangedLw(boolean occluded);
+ void onKeyguardOccludedChangedLw(boolean occluded, boolean waitAppTransition);
/**
* Applies a keyguard occlusion change if one happened.
diff --git a/services/core/java/com/android/server/security/rkp/RemoteProvisioningRegistration.java b/services/core/java/com/android/server/security/rkp/RemoteProvisioningRegistration.java
index f586126196dd..7d148f6225be 100644
--- a/services/core/java/com/android/server/security/rkp/RemoteProvisioningRegistration.java
+++ b/services/core/java/com/android/server/security/rkp/RemoteProvisioningRegistration.java
@@ -17,6 +17,7 @@
package com.android.server.security.rkp;
import android.os.CancellationSignal;
+import android.os.IBinder;
import android.os.OperationCanceledException;
import android.os.OutcomeReceiver;
import android.security.rkp.IGetKeyCallback;
@@ -39,23 +40,23 @@ import java.util.concurrent.Executor;
*/
final class RemoteProvisioningRegistration extends IRegistration.Stub {
static final String TAG = RemoteProvisioningService.TAG;
- private final ConcurrentHashMap<IGetKeyCallback, CancellationSignal> mGetKeyOperations =
+ private final ConcurrentHashMap<IBinder, CancellationSignal> mGetKeyOperations =
new ConcurrentHashMap<>();
- private final Set<IStoreUpgradedKeyCallback> mStoreUpgradedKeyOperations =
- ConcurrentHashMap.newKeySet();
+ private final Set<IBinder> mStoreUpgradedKeyOperations = ConcurrentHashMap.newKeySet();
private final RegistrationProxy mRegistration;
private final Executor mExecutor;
private class GetKeyReceiver implements OutcomeReceiver<RemotelyProvisionedKey, Exception> {
IGetKeyCallback mCallback;
+
GetKeyReceiver(IGetKeyCallback callback) {
mCallback = callback;
}
@Override
public void onResult(RemotelyProvisionedKey result) {
- mGetKeyOperations.remove(mCallback);
- Log.i(TAG, "Successfully fetched key for client " + mCallback.hashCode());
+ mGetKeyOperations.remove(mCallback.asBinder());
+ Log.i(TAG, "Successfully fetched key for client " + mCallback.asBinder().hashCode());
android.security.rkp.RemotelyProvisionedKey parcelable =
new android.security.rkp.RemotelyProvisionedKey();
parcelable.keyBlob = result.getKeyBlob();
@@ -65,19 +66,21 @@ final class RemoteProvisioningRegistration extends IRegistration.Stub {
@Override
public void onError(Exception e) {
- mGetKeyOperations.remove(mCallback);
+ mGetKeyOperations.remove(mCallback.asBinder());
if (e instanceof OperationCanceledException) {
- Log.i(TAG, "Operation cancelled for client " + mCallback.hashCode());
+ Log.i(TAG, "Operation cancelled for client " + mCallback.asBinder().hashCode());
wrapCallback(mCallback::onCancel);
} else if (e instanceof RkpProxyException) {
- Log.e(TAG, "RKP error fetching key for client " + mCallback.hashCode() + ": "
+ Log.e(TAG, "RKP error fetching key for client " + mCallback.asBinder().hashCode()
+ + ": "
+ e.getMessage());
RkpProxyException rkpException = (RkpProxyException) e;
wrapCallback(() -> mCallback.onError(toGetKeyError(rkpException),
e.getMessage()));
} else {
- Log.e(TAG, "Unknown error fetching key for client " + mCallback.hashCode() + ": "
- + e.getMessage());
+ Log.e(TAG,
+ "Unknown error fetching key for client " + mCallback.asBinder().hashCode()
+ + ": " + e.getMessage());
wrapCallback(() -> mCallback.onError(IGetKeyCallback.ErrorCode.ERROR_UNKNOWN,
e.getMessage()));
}
@@ -108,20 +111,23 @@ final class RemoteProvisioningRegistration extends IRegistration.Stub {
@Override
public void getKey(int keyId, IGetKeyCallback callback) {
CancellationSignal cancellationSignal = new CancellationSignal();
- if (mGetKeyOperations.putIfAbsent(callback, cancellationSignal) != null) {
- Log.e(TAG, "Client can only request one call at a time " + callback.hashCode());
+ if (mGetKeyOperations.putIfAbsent(callback.asBinder(), cancellationSignal) != null) {
+ Log.e(TAG,
+ "Client can only request one call at a time " + callback.asBinder().hashCode());
throw new IllegalArgumentException(
"Callback is already associated with an existing operation: "
- + callback.hashCode());
+ + callback.asBinder().hashCode());
}
try {
- Log.i(TAG, "Fetching key " + keyId + " for client " + callback.hashCode());
+ Log.i(TAG, "Fetching key " + keyId + " for client " + callback.asBinder().hashCode());
mRegistration.getKeyAsync(keyId, cancellationSignal, mExecutor,
new GetKeyReceiver(callback));
} catch (Exception e) {
- Log.e(TAG, "getKeyAsync threw an exception for client " + callback.hashCode(), e);
- mGetKeyOperations.remove(callback);
+ Log.e(TAG,
+ "getKeyAsync threw an exception for client " + callback.asBinder().hashCode(),
+ e);
+ mGetKeyOperations.remove(callback.asBinder());
wrapCallback(() -> callback.onError(IGetKeyCallback.ErrorCode.ERROR_UNKNOWN,
e.getMessage()));
}
@@ -129,23 +135,23 @@ final class RemoteProvisioningRegistration extends IRegistration.Stub {
@Override
public void cancelGetKey(IGetKeyCallback callback) {
- CancellationSignal cancellationSignal = mGetKeyOperations.remove(callback);
+ CancellationSignal cancellationSignal = mGetKeyOperations.remove(callback.asBinder());
if (cancellationSignal == null) {
throw new IllegalArgumentException(
- "Invalid client in cancelGetKey: " + callback.hashCode());
+ "Invalid client in cancelGetKey: " + callback.asBinder().hashCode());
}
- Log.i(TAG, "Requesting cancellation for client " + callback.hashCode());
+ Log.i(TAG, "Requesting cancellation for client " + callback.asBinder().hashCode());
cancellationSignal.cancel();
}
@Override
public void storeUpgradedKeyAsync(byte[] oldKeyBlob, byte[] newKeyBlob,
IStoreUpgradedKeyCallback callback) {
- if (!mStoreUpgradedKeyOperations.add(callback)) {
+ if (!mStoreUpgradedKeyOperations.add(callback.asBinder())) {
throw new IllegalArgumentException(
"Callback is already associated with an existing operation: "
- + callback.hashCode());
+ + callback.asBinder().hashCode());
}
try {
@@ -153,20 +159,20 @@ final class RemoteProvisioningRegistration extends IRegistration.Stub {
new OutcomeReceiver<>() {
@Override
public void onResult(Void result) {
- mStoreUpgradedKeyOperations.remove(callback);
+ mStoreUpgradedKeyOperations.remove(callback.asBinder());
wrapCallback(callback::onSuccess);
}
@Override
public void onError(Exception e) {
- mStoreUpgradedKeyOperations.remove(callback);
+ mStoreUpgradedKeyOperations.remove(callback.asBinder());
wrapCallback(() -> callback.onError(e.getMessage()));
}
});
} catch (Exception e) {
Log.e(TAG, "storeUpgradedKeyAsync threw an exception for client "
- + callback.hashCode(), e);
- mStoreUpgradedKeyOperations.remove(callback);
+ + callback.asBinder().hashCode(), e);
+ mStoreUpgradedKeyOperations.remove(callback.asBinder());
wrapCallback(() -> callback.onError(e.getMessage()));
}
}
diff --git a/services/core/java/com/android/server/security/rkp/RemoteProvisioningService.java b/services/core/java/com/android/server/security/rkp/RemoteProvisioningService.java
index 97e463646fdc..2bd7383ddde0 100644
--- a/services/core/java/com/android/server/security/rkp/RemoteProvisioningService.java
+++ b/services/core/java/com/android/server/security/rkp/RemoteProvisioningService.java
@@ -61,7 +61,7 @@ public class RemoteProvisioningService extends SystemService {
try {
mCallback.onSuccess(new RemoteProvisioningRegistration(registration, mExecutor));
} catch (RemoteException e) {
- Log.e(TAG, "Error calling success callback " + mCallback.hashCode(), e);
+ Log.e(TAG, "Error calling success callback " + mCallback.asBinder().hashCode(), e);
}
}
@@ -70,7 +70,7 @@ public class RemoteProvisioningService extends SystemService {
try {
mCallback.onError(error.toString());
} catch (RemoteException e) {
- Log.e(TAG, "Error calling error callback " + mCallback.hashCode(), e);
+ Log.e(TAG, "Error calling error callback " + mCallback.asBinder().hashCode(), e);
}
}
}
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index f9e2eae20c76..36b976562877 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -36,6 +36,7 @@ import android.annotation.NonNull;
import android.app.ActivityManager;
import android.app.AppGlobals;
import android.app.AppOpsManager;
+import android.app.ApplicationExitInfo;
import android.app.ILocalWallpaperColorConsumer;
import android.app.IWallpaperManager;
import android.app.IWallpaperManagerCallback;
@@ -189,6 +190,10 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
private final Object mLock = new Object();
+ private static final double LMK_LOW_THRESHOLD_MEMORY_PERCENTAGE = 10;
+ private static final int LMK_RECONNECT_REBIND_RETRIES = 3;
+ private static final long LMK_RECONNECT_DELAY_MS = 5000;
+
/**
* Minimum time between crashes of a wallpaper service for us to consider
* restarting it vs. just reverting to the static wallpaper.
@@ -1208,6 +1213,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
/** Time in milliseconds until we expect the wallpaper to reconnect (unless we're in the
* middle of an update). If exceeded, the wallpaper gets reset to the system default. */
private static final long WALLPAPER_RECONNECT_TIMEOUT_MS = 10000;
+ private int mLmkLimitRebindRetries = LMK_RECONNECT_REBIND_RETRIES;
final WallpaperInfo mInfo;
IWallpaperService mService;
@@ -1448,20 +1454,51 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
&& mWallpaper.userId == mCurrentUserId
&& !Objects.equals(mDefaultWallpaperComponent, wpService)
&& !Objects.equals(mImageWallpaper, wpService)) {
- // There is a race condition which causes
- // {@link #mWallpaper.wallpaperUpdating} to be false even if it is
- // currently updating since the broadcast notifying us is async.
- // This race is overcome by the general rule that we only reset the
- // wallpaper if its service was shut down twice
- // during {@link #MIN_WALLPAPER_CRASH_TIME} millis.
- if (mWallpaper.lastDiedTime != 0
- && mWallpaper.lastDiedTime + MIN_WALLPAPER_CRASH_TIME
- > SystemClock.uptimeMillis()) {
- Slog.w(TAG, "Reverting to built-in wallpaper!");
- clearWallpaperLocked(true, FLAG_SYSTEM, mWallpaper.userId, null);
+ List<ApplicationExitInfo> reasonList =
+ mActivityManager.getHistoricalProcessExitReasons(
+ wpService.getPackageName(), 0, 1);
+ int exitReason = ApplicationExitInfo.REASON_UNKNOWN;
+ if (reasonList != null && !reasonList.isEmpty()) {
+ ApplicationExitInfo info = reasonList.get(0);
+ exitReason = info.getReason();
+ }
+ Slog.d(TAG, "exitReason: " + exitReason);
+ // If exit reason is LOW_MEMORY_KILLER
+ // delay the mTryToRebindRunnable for 10s
+ if (exitReason == ApplicationExitInfo.REASON_LOW_MEMORY) {
+ if (isRunningOnLowMemory()) {
+ Slog.i(TAG, "Rebind is delayed due to lmk");
+ mContext.getMainThreadHandler().postDelayed(mTryToRebindRunnable,
+ LMK_RECONNECT_DELAY_MS);
+ mLmkLimitRebindRetries = LMK_RECONNECT_REBIND_RETRIES;
+ } else {
+ if (mLmkLimitRebindRetries <= 0) {
+ Slog.w(TAG, "Reverting to built-in wallpaper due to lmk!");
+ clearWallpaperLocked(true, FLAG_SYSTEM, mWallpaper.userId,
+ null);
+ mLmkLimitRebindRetries = LMK_RECONNECT_REBIND_RETRIES;
+ return;
+ }
+ mLmkLimitRebindRetries--;
+ mContext.getMainThreadHandler().postDelayed(mTryToRebindRunnable,
+ LMK_RECONNECT_DELAY_MS);
+ }
} else {
- mWallpaper.lastDiedTime = SystemClock.uptimeMillis();
- tryToRebind();
+ // There is a race condition which causes
+ // {@link #mWallpaper.wallpaperUpdating} to be false even if it is
+ // currently updating since the broadcast notifying us is async.
+ // This race is overcome by the general rule that we only reset the
+ // wallpaper if its service was shut down twice
+ // during {@link #MIN_WALLPAPER_CRASH_TIME} millis.
+ if (mWallpaper.lastDiedTime != 0
+ && mWallpaper.lastDiedTime + MIN_WALLPAPER_CRASH_TIME
+ > SystemClock.uptimeMillis()) {
+ Slog.w(TAG, "Reverting to built-in wallpaper!");
+ clearWallpaperLocked(true, FLAG_SYSTEM, mWallpaper.userId, null);
+ } else {
+ mWallpaper.lastDiedTime = SystemClock.uptimeMillis();
+ tryToRebind();
+ }
}
}
} else {
@@ -1472,6 +1509,14 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
}
};
+ private boolean isRunningOnLowMemory() {
+ ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
+ mActivityManager.getMemoryInfo(memoryInfo);
+ double availableMBsInPercentage = memoryInfo.availMem / (double)memoryInfo.totalMem *
+ 100.0;
+ return availableMBsInPercentage < LMK_LOW_THRESHOLD_MEMORY_PERCENTAGE;
+ }
+
/**
* Called by a live wallpaper if its colors have changed.
* @param primaryColors representation of wallpaper primary colors
diff --git a/services/core/java/com/android/server/webkit/OWNERS b/services/core/java/com/android/server/webkit/OWNERS
index 00e540a46ab2..e7fd7a5d1096 100644
--- a/services/core/java/com/android/server/webkit/OWNERS
+++ b/services/core/java/com/android/server/webkit/OWNERS
@@ -1,3 +1,3 @@
-changwan@google.com
-tobiasjs@google.com
+# Bug component: 76427
+ntfschr@google.com
torne@google.com
diff --git a/services/core/java/com/android/server/wm/KeyguardController.java b/services/core/java/com/android/server/wm/KeyguardController.java
index 48258a11d13a..1d21b9d8c141 100644
--- a/services/core/java/com/android/server/wm/KeyguardController.java
+++ b/services/core/java/com/android/server/wm/KeyguardController.java
@@ -403,8 +403,10 @@ class KeyguardController {
return;
}
- mWindowManager.mPolicy.onKeyguardOccludedChangedLw(isDisplayOccluded(DEFAULT_DISPLAY));
- if (isKeyguardLocked(displayId)) {
+ final boolean waitAppTransition = isKeyguardLocked(displayId);
+ mWindowManager.mPolicy.onKeyguardOccludedChangedLw(isDisplayOccluded(DEFAULT_DISPLAY),
+ waitAppTransition);
+ if (waitAppTransition) {
mService.deferWindowLayout();
try {
mRootWindowContainer.getDefaultDisplay()
diff --git a/services/core/java/com/android/server/wm/RemoteDisplayChangeController.java b/services/core/java/com/android/server/wm/RemoteDisplayChangeController.java
index 43baebc7255a..e646f14a3e13 100644
--- a/services/core/java/com/android/server/wm/RemoteDisplayChangeController.java
+++ b/services/core/java/com/android/server/wm/RemoteDisplayChangeController.java
@@ -114,9 +114,15 @@ public class RemoteDisplayChangeController {
// timed-out, so run all continue callbacks and clear the list
synchronized (mService.mGlobalLock) {
for (int i = 0; i < mCallbacks.size(); ++i) {
- mCallbacks.get(i).onContinueRemoteDisplayChange(null /* transaction */);
+ final ContinueRemoteDisplayChangeCallback callback = mCallbacks.get(i);
+ if (i == mCallbacks.size() - 1) {
+ // Clear all callbacks before calling the last one, so that if the callback
+ // itself calls {@link #isWaitingForRemoteDisplayChange()}, it will get
+ // {@code false}. After all, there is nothing pending after this one.
+ mCallbacks.clear();
+ }
+ callback.onContinueRemoteDisplayChange(null /* transaction */);
}
- mCallbacks.clear();
}
}
diff --git a/services/core/xsd/vts/OWNERS b/services/core/xsd/vts/OWNERS
new file mode 100644
index 000000000000..9af2ebaba437
--- /dev/null
+++ b/services/core/xsd/vts/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 151862
+sundongahn@google.com
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index a31216b6bc2e..c4a945ce9eaf 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -12166,17 +12166,23 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
"Caller is not managed profile owner or device owner;"
+ " only managed profile owner or device owner may control the preferential"
+ " network service");
- synchronized (getLockObject()) {
- final ActiveAdmin requiredAdmin = getDeviceOrProfileOwnerAdminLocked(
- caller.getUserId());
- if (!requiredAdmin.mPreferentialNetworkServiceConfigs.equals(
- preferentialNetworkServiceConfigs)) {
- requiredAdmin.mPreferentialNetworkServiceConfigs =
- new ArrayList<>(preferentialNetworkServiceConfigs);
- saveSettingsLocked(caller.getUserId());
+
+ try {
+ updateNetworkPreferenceForUser(caller.getUserId(), preferentialNetworkServiceConfigs);
+ synchronized (getLockObject()) {
+ final ActiveAdmin requiredAdmin = getDeviceOrProfileOwnerAdminLocked(
+ caller.getUserId());
+ if (!requiredAdmin.mPreferentialNetworkServiceConfigs.equals(
+ preferentialNetworkServiceConfigs)) {
+ requiredAdmin.mPreferentialNetworkServiceConfigs =
+ new ArrayList<>(preferentialNetworkServiceConfigs);
+ saveSettingsLocked(caller.getUserId());
+ }
}
+ } catch (Exception e) {
+ Slogf.e(LOG_TAG, "Failed to set preferential network service configs");
+ throw e;
}
- updateNetworkPreferenceForUser(caller.getUserId(), preferentialNetworkServiceConfigs);
DevicePolicyEventLogger
.createEvent(DevicePolicyEnums.SET_PREFERENTIAL_NETWORK_SERVICE_ENABLED)
.setBoolean(preferentialNetworkServiceConfigs
diff --git a/services/musicrecognition/OWNERS b/services/musicrecognition/OWNERS
index 58f5d40dd8c3..037b04831260 100644
--- a/services/musicrecognition/OWNERS
+++ b/services/musicrecognition/OWNERS
@@ -1,6 +1,5 @@
# Bug component: 830636
-joannechung@google.com
oni@google.com
volnov@google.com
diff --git a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
index f05b1d47ac0b..4007672a0599 100644
--- a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
+++ b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
@@ -20,9 +20,11 @@ import android.app.job.JobInfo;
import android.app.job.JobParameters;
import android.app.job.JobScheduler;
import android.app.job.JobService;
+import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.IntentFilter;
import android.os.Handler;
import android.os.IBinder.DeathRecipient;
import android.os.Looper;
@@ -32,6 +34,8 @@ import android.os.SystemProperties;
import android.os.UpdateEngine;
import android.os.UpdateEngineCallback;
import android.provider.DeviceConfig;
+import android.provider.Settings;
+import android.provider.Settings.SettingNotFoundException;
import android.util.Log;
import com.android.internal.R;
@@ -53,7 +57,8 @@ public final class ProfcollectForwardingService extends SystemService {
public static final String LOG_TAG = "ProfcollectForwardingService";
private static final boolean DEBUG = Log.isLoggable(LOG_TAG, Log.DEBUG);
-
+ private static final String INTENT_UPLOAD_PROFILES =
+ "com.android.server.profcollect.UPLOAD_PROFILES";
private static final long BG_PROCESS_PERIOD = TimeUnit.HOURS.toMillis(4); // every 4 hours.
private IProfCollectd mIProfcollect;
@@ -66,6 +71,16 @@ public final class ProfcollectForwardingService extends SystemService {
}
};
+ private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (INTENT_UPLOAD_PROFILES.equals(intent.getAction())) {
+ Log.d(LOG_TAG, "Received broadcast to pack and upload reports");
+ packAndUploadReport();
+ }
+ }
+ };
+
public ProfcollectForwardingService(Context context) {
super(context);
@@ -73,6 +88,10 @@ public final class ProfcollectForwardingService extends SystemService {
throw new AssertionError("only one service instance allowed");
}
sSelfService = this;
+
+ final IntentFilter filter = new IntentFilter();
+ filter.addAction(INTENT_UPLOAD_PROFILES);
+ context.registerReceiver(mBroadcastReceiver, filter, Context.RECEIVER_NOT_EXPORTED);
}
/**
@@ -296,7 +315,7 @@ public final class ProfcollectForwardingService extends SystemService {
}
if (status == UpdateEngine.UpdateStatusConstants.UPDATED_NEED_REBOOT) {
- packProfileReport();
+ packAndUploadReport();
}
}
@@ -307,7 +326,7 @@ public final class ProfcollectForwardingService extends SystemService {
});
}
- private void packProfileReport() {
+ private void packAndUploadReport() {
if (mIProfcollect == null) {
return;
}
@@ -315,8 +334,17 @@ public final class ProfcollectForwardingService extends SystemService {
Context context = getContext();
BackgroundThread.get().getThreadHandler().post(() -> {
try {
+ int usageSetting = -1;
+ try {
+ // Get "Usage & diagnostics" checkbox status. 1 is for enabled, 0 is for
+ // disabled.
+ usageSetting = Settings.Global.getInt(context.getContentResolver(), "multi_cb");
+ } catch (SettingNotFoundException e) {
+ Log.i(LOG_TAG, "Usage setting not found: " + e.getMessage());
+ }
+
// Prepare profile report
- String reportName = mIProfcollect.report() + ".zip";
+ String reportName = mIProfcollect.report(usageSetting) + ".zip";
if (!context.getResources().getBoolean(
R.bool.config_profcollectReportUploaderEnabled)) {
diff --git a/services/proguard.flags b/services/proguard.flags
index 4c2830e5c447..85d05afdccc6 100644
--- a/services/proguard.flags
+++ b/services/proguard.flags
@@ -42,19 +42,6 @@
-keep,allowoptimization,allowaccessmodification class * extends android.os.IInterface
-keep,allowoptimization,allowaccessmodification class * extends android.os.IHwInterface
-# Global entities normally kept through explicit Manifest entries
-# TODO(b/210510433): Revisit and consider generating from frameworks/base/core/res/AndroidManifest.xml,
-# by including that manifest with the library rule that triggers optimization.
--keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.app.Activity
--keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.app.Service
--keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.app.backup.BackupAgent
--keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.content.BroadcastReceiver
--keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.content.ContentProvider
--keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.preference.Preference
--keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.view.View {
- public <init>(...);
-}
-
# Various classes subclassed in or referenced via JNI in ethernet-service
-keep public class android.net.** { *; }
-keep,allowoptimization,allowaccessmodification class com.android.net.module.util.* { *; }
diff --git a/services/tests/RemoteProvisioningServiceTests/Android.bp b/services/tests/RemoteProvisioningServiceTests/Android.bp
index 075680a51af3..fc2c0857146b 100644
--- a/services/tests/RemoteProvisioningServiceTests/Android.bp
+++ b/services/tests/RemoteProvisioningServiceTests/Android.bp
@@ -31,6 +31,7 @@ android_test {
"service-rkp.impl",
"services.core",
"truth-prebuilt",
+ "truth-java8-extension-jar",
],
test_suites: [
"device-tests",
diff --git a/services/tests/RemoteProvisioningServiceTests/src/com/android/server/security/rkp/RemoteProvisioningRegistrationTest.java b/services/tests/RemoteProvisioningServiceTests/src/com/android/server/security/rkp/RemoteProvisioningRegistrationTest.java
index 1dcd0b936c86..df7be515774a 100644
--- a/services/tests/RemoteProvisioningServiceTests/src/com/android/server/security/rkp/RemoteProvisioningRegistrationTest.java
+++ b/services/tests/RemoteProvisioningServiceTests/src/com/android/server/security/rkp/RemoteProvisioningRegistrationTest.java
@@ -23,8 +23,10 @@ import static org.mockito.AdditionalAnswers.answerVoid;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.anyInt;
import static org.mockito.Mockito.argThat;
+import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.contains;
import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.mock;
@@ -32,6 +34,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
+import android.os.Binder;
import android.os.CancellationSignal;
import android.os.OperationCanceledException;
import android.os.OutcomeReceiver;
@@ -101,8 +104,10 @@ public class RemoteProvisioningRegistrationTest {
.when(mRegistrationProxy).getKeyAsync(eq(42), any(), any(), any());
IGetKeyCallback callback = mock(IGetKeyCallback.class);
+ doReturn(new Binder()).when(callback).asBinder();
mRegistration.getKey(42, callback);
verify(callback).onSuccess(matches(expectedKey));
+ verify(callback, atLeastOnce()).asBinder();
verifyNoMoreInteractions(callback);
}
@@ -114,8 +119,10 @@ public class RemoteProvisioningRegistrationTest {
executor.execute(() -> receiver.onError(expectedException))))
.when(mRegistrationProxy).getKeyAsync(eq(0), any(), any(), any());
IGetKeyCallback callback = mock(IGetKeyCallback.class);
+ doReturn(new Binder()).when(callback).asBinder();
mRegistration.getKey(0, callback);
verify(callback).onError(eq(IGetKeyCallback.ErrorCode.ERROR_UNKNOWN), eq("oops!"));
+ verify(callback, atLeastOnce()).asBinder();
verifyNoMoreInteractions(callback);
}
@@ -140,18 +147,28 @@ public class RemoteProvisioningRegistrationTest {
executor.execute(() -> receiver.onError(expectedException))))
.when(mRegistrationProxy).getKeyAsync(eq(0), any(), any(), any());
IGetKeyCallback callback = mock(IGetKeyCallback.class);
+ doReturn(new Binder()).when(callback).asBinder();
mRegistration.getKey(0, callback);
verify(callback).onError(eq(error), contains(errorField.getName()));
+ verify(callback, atLeastOnce()).asBinder();
verifyNoMoreInteractions(callback);
}
}
@Test
public void getKeyCancelDuringProxyOperation() throws Exception {
+ final Binder theBinder = new Binder();
IGetKeyCallback callback = mock(IGetKeyCallback.class);
+ doReturn(theBinder).when(callback).asBinder();
doAnswer(
answerGetKeyAsync((keyId, cancelSignal, executor, receiver) -> {
- mRegistration.cancelGetKey(callback);
+ // Use a different callback object to ensure that the callback equivalence
+ // relies on the actual IBinder object.
+ IGetKeyCallback differentCallback = mock(IGetKeyCallback.class);
+ doReturn(theBinder).when(differentCallback).asBinder();
+ mRegistration.cancelGetKey(differentCallback);
+ verify(differentCallback, atLeastOnce()).asBinder();
+ verifyNoMoreInteractions(differentCallback);
assertThat(cancelSignal.isCanceled()).isTrue();
executor.execute(() -> receiver.onError(new OperationCanceledException()));
}))
@@ -159,18 +176,21 @@ public class RemoteProvisioningRegistrationTest {
mRegistration.getKey(Integer.MAX_VALUE, callback);
verify(callback).onCancel();
+ verify(callback, atLeastOnce()).asBinder();
verifyNoMoreInteractions(callback);
}
@Test
public void cancelGetKeyWithInvalidCallback() throws Exception {
IGetKeyCallback callback = mock(IGetKeyCallback.class);
+ doReturn(new Binder()).when(callback).asBinder();
assertThrows(IllegalArgumentException.class, () -> mRegistration.cancelGetKey(callback));
}
@Test
public void getKeyRejectsDuplicateCallback() throws Exception {
IGetKeyCallback callback = mock(IGetKeyCallback.class);
+ doReturn(new Binder()).when(callback).asBinder();
doAnswer(
answerGetKeyAsync((keyId, cancelSignal, executor, receiver) -> {
assertThrows(IllegalArgumentException.class, () ->
@@ -181,12 +201,14 @@ public class RemoteProvisioningRegistrationTest {
mRegistration.getKey(0, callback);
verify(callback, times(1)).onSuccess(any());
+ verify(callback, atLeastOnce()).asBinder();
verifyNoMoreInteractions(callback);
}
@Test
public void getKeyCancelAfterCompleteFails() throws Exception {
IGetKeyCallback callback = mock(IGetKeyCallback.class);
+ doReturn(new Binder()).when(callback).asBinder();
doAnswer(
answerGetKeyAsync((keyId, cancelSignal, executor, receiver) ->
executor.execute(() ->
@@ -197,6 +219,7 @@ public class RemoteProvisioningRegistrationTest {
mRegistration.getKey(Integer.MIN_VALUE, callback);
verify(callback).onSuccess(any());
assertThrows(IllegalArgumentException.class, () -> mRegistration.cancelGetKey(callback));
+ verify(callback, atLeastOnce()).asBinder();
verifyNoMoreInteractions(callback);
}
@@ -208,10 +231,12 @@ public class RemoteProvisioningRegistrationTest {
.getKeyAsync(anyInt(), any(), any(), any());
IGetKeyCallback callback = mock(IGetKeyCallback.class);
+ doReturn(new Binder()).when(callback).asBinder();
mRegistration.getKey(0, callback);
verify(callback).onError(eq(IGetKeyCallback.ErrorCode.ERROR_UNKNOWN),
eq(expectedException.getMessage()));
assertThrows(IllegalArgumentException.class, () -> mRegistration.cancelGetKey(callback));
+ verify(callback, atLeastOnce()).asBinder();
verifyNoMoreInteractions(callback);
}
@@ -224,8 +249,10 @@ public class RemoteProvisioningRegistrationTest {
.storeUpgradedKeyAsync(any(), any(), any(), any());
IStoreUpgradedKeyCallback callback = mock(IStoreUpgradedKeyCallback.class);
+ doReturn(new Binder()).when(callback).asBinder();
mRegistration.storeUpgradedKeyAsync(new byte[0], new byte[0], callback);
verify(callback).onSuccess();
+ verify(callback, atLeastOnce()).asBinder();
verifyNoMoreInteractions(callback);
}
@@ -239,8 +266,10 @@ public class RemoteProvisioningRegistrationTest {
.storeUpgradedKeyAsync(any(), any(), any(), any());
IStoreUpgradedKeyCallback callback = mock(IStoreUpgradedKeyCallback.class);
+ doReturn(new Binder()).when(callback).asBinder();
mRegistration.storeUpgradedKeyAsync(new byte[0], new byte[0], callback);
verify(callback).onError(errorString);
+ verify(callback, atLeastOnce()).asBinder();
verifyNoMoreInteractions(callback);
}
@@ -252,14 +281,17 @@ public class RemoteProvisioningRegistrationTest {
.storeUpgradedKeyAsync(any(), any(), any(), any());
IStoreUpgradedKeyCallback callback = mock(IStoreUpgradedKeyCallback.class);
+ doReturn(new Binder()).when(callback).asBinder();
mRegistration.storeUpgradedKeyAsync(new byte[0], new byte[0], callback);
verify(callback).onError(errorString);
+ verify(callback, atLeastOnce()).asBinder();
verifyNoMoreInteractions(callback);
}
@Test
public void storeUpgradedKeyDuplicateCallback() throws Exception {
IStoreUpgradedKeyCallback callback = mock(IStoreUpgradedKeyCallback.class);
+ doReturn(new Binder()).when(callback).asBinder();
doAnswer(
answerStoreUpgradedKeyAsync((oldBlob, newBlob, executor, receiver) -> {
@@ -273,6 +305,7 @@ public class RemoteProvisioningRegistrationTest {
mRegistration.storeUpgradedKeyAsync(new byte[0], new byte[0], callback);
verify(callback).onSuccess();
+ verify(callback, atLeastOnce()).asBinder();
verifyNoMoreInteractions(callback);
}
diff --git a/services/tests/RemoteProvisioningServiceTests/src/com/android/server/security/rkp/RemoteProvisioningShellCommandTest.java b/services/tests/RemoteProvisioningServiceTests/src/com/android/server/security/rkp/RemoteProvisioningShellCommandTest.java
index 77c339646400..2d93120681ec 100644
--- a/services/tests/RemoteProvisioningServiceTests/src/com/android/server/security/rkp/RemoteProvisioningShellCommandTest.java
+++ b/services/tests/RemoteProvisioningServiceTests/src/com/android/server/security/rkp/RemoteProvisioningShellCommandTest.java
@@ -17,6 +17,7 @@
package com.android.server.security.rkp;
import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth8.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
@@ -42,7 +43,6 @@ import org.junit.runner.RunWith;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.util.Arrays;
import java.util.Base64;
import java.util.Map;
@@ -119,6 +119,7 @@ public class RemoteProvisioningShellCommandTest {
assertThat(res.getErr()).isEmpty();
assertThat(res.getCode()).isEqualTo(0);
assertThat(res.getOut()).isEmpty();
+ assertThat(res.getOut().lines()).isEmpty();
}
@Test
@@ -128,7 +129,7 @@ public class RemoteProvisioningShellCommandTest {
CommandResult res = exec(cmd, new String[] {"list"});
assertThat(res.getErr()).isEmpty();
assertThat(res.getCode()).isEqualTo(0);
- assertThat(Arrays.asList(res.getOut().split("\n"))).containsExactly("default");
+ assertThat(res.getOut().lines()).containsExactly("default");
}
@Test
@@ -140,7 +141,7 @@ public class RemoteProvisioningShellCommandTest {
CommandResult res = exec(cmd, new String[] {"list"});
assertThat(res.getErr()).isEmpty();
assertThat(res.getCode()).isEqualTo(0);
- assertThat(Arrays.asList(res.getOut().split("\n"))).containsExactly("default", "strongbox");
+ assertThat(res.getOut().lines()).containsExactly("default", "strongbox");
}
@Test
diff --git a/services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java b/services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java
index 8d59dce29bd9..9397533bdf8d 100644
--- a/services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java
+++ b/services/tests/mockingservicestests/src/com/android/server/am/MockingOomAdjusterTests.java
@@ -64,6 +64,7 @@ import static com.android.server.am.ProcessList.UNKNOWN_ADJ;
import static com.android.server.am.ProcessList.VISIBLE_APP_ADJ;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.AdditionalAnswers.answer;
@@ -2208,6 +2209,28 @@ public class MockingOomAdjusterTests {
assertProcStates(app2, false, PROCESS_STATE_SERVICE, SERVICE_ADJ, "started-services");
}
+ @SuppressWarnings("GuardedBy")
+ @Test
+ public void testUpdateOomAdj_DoOne_AboveClient_SameProcess() {
+ ProcessRecord app = spy(makeDefaultProcessRecord(MOCKAPP_PID, MOCKAPP_UID,
+ MOCKAPP_PROCESSNAME, MOCKAPP_PACKAGENAME, true));
+ doReturn(PROCESS_STATE_TOP).when(sService.mAtmInternal).getTopProcessState();
+ doReturn(app).when(sService).getTopApp();
+ sService.mWakefulness.set(PowerManagerInternal.WAKEFULNESS_AWAKE);
+ sService.mOomAdjuster.updateOomAdjLocked(app, OomAdjuster.OOM_ADJ_REASON_NONE);
+
+ assertEquals(FOREGROUND_APP_ADJ, app.mState.getSetAdj());
+
+ // Simulate binding to a service in the same process using BIND_ABOVE_CLIENT and
+ // verify that its OOM adjustment level is unaffected.
+ bindService(app, app, null, Context.BIND_ABOVE_CLIENT, mock(IBinder.class));
+ app.mServices.updateHasAboveClientLocked();
+ assertFalse(app.mServices.hasAboveClient());
+
+ sService.mOomAdjuster.updateOomAdjLocked(app, OomAdjuster.OOM_ADJ_REASON_NONE);
+ assertEquals(FOREGROUND_APP_ADJ, app.mState.getSetAdj());
+ }
+
private ProcessRecord makeDefaultProcessRecord(int pid, int uid, String processName,
String packageName, boolean hasShownUi) {
long now = SystemClock.uptimeMillis();
diff --git a/services/tests/servicestests/src/com/android/server/accessibility/magnification/WindowMagnificationManagerTest.java b/services/tests/servicestests/src/com/android/server/accessibility/magnification/WindowMagnificationManagerTest.java
index 25ad2be3772e..edb4eca598a5 100644
--- a/services/tests/servicestests/src/com/android/server/accessibility/magnification/WindowMagnificationManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/accessibility/magnification/WindowMagnificationManagerTest.java
@@ -66,6 +66,7 @@ import com.android.server.accessibility.AccessibilityTraceManager;
import com.android.server.statusbar.StatusBarManagerInternal;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
@@ -294,6 +295,7 @@ public class WindowMagnificationManagerTest {
MagnificationScaleProvider.MAX_SCALE);
}
+ @Ignore("b/278816260: We could refer to b/182561174#comment4 for solution.")
@Test
public void logTrackingTypingFocus_processScroll_logDuration() {
WindowMagnificationManager spyWindowMagnificationManager = spy(mWindowMagnificationManager);
diff --git a/services/tests/servicestests/src/com/android/server/contentcapture/OWNERS b/services/tests/servicestests/src/com/android/server/contentcapture/OWNERS
new file mode 100644
index 000000000000..b3583a7f6ab1
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/contentcapture/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 544200
+
+include /core/java/android/view/contentcapture/OWNERS
+
diff --git a/services/tests/servicestests/src/com/android/server/contentprotection/OWNERS b/services/tests/servicestests/src/com/android/server/contentprotection/OWNERS
new file mode 100644
index 000000000000..24561c59bba6
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/contentprotection/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 544200
+
+include /core/java/android/view/contentcapture/OWNERS
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java
index 035249e32d74..a4a35dc42472 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java
@@ -344,6 +344,7 @@ public class RecoverableKeyStoreManagerTest {
assertThat(mRecoverableKeyStoreDb.getShouldCreateSnapshot(userId, uid)).isFalse();
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void initRecoveryService_succeedsWithCertFile() throws Exception {
int uid = Binder.getCallingUid();
@@ -365,6 +366,7 @@ public class RecoverableKeyStoreManagerTest {
assertThat(mRecoverableKeyStoreDb.getRecoveryServicePublicKey(userId, uid)).isNull();
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void initRecoveryService_updatesShouldCreatesnapshotOnCertUpdate() throws Exception {
int uid = Binder.getCallingUid();
@@ -392,6 +394,7 @@ public class RecoverableKeyStoreManagerTest {
assertThat(mRecoverableKeyStoreDb.getShouldCreateSnapshot(userId, uid)).isTrue();
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void initRecoveryService_triesToFilterRootAlias() throws Exception {
int uid = Binder.getCallingUid();
@@ -413,6 +416,7 @@ public class RecoverableKeyStoreManagerTest {
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void initRecoveryService_usesProdCertificateForEmptyRootAlias() throws Exception {
int uid = Binder.getCallingUid();
@@ -433,6 +437,7 @@ public class RecoverableKeyStoreManagerTest {
assertThat(activeRootAlias).isEqualTo(DEFAULT_ROOT_CERT_ALIAS);
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void initRecoveryService_usesProdCertificateForNullRootAlias() throws Exception {
int uid = Binder.getCallingUid();
@@ -453,6 +458,7 @@ public class RecoverableKeyStoreManagerTest {
assertThat(activeRootAlias).isEqualTo(DEFAULT_ROOT_CERT_ALIAS);
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void initRecoveryService_regeneratesCounterId() throws Exception {
int uid = Binder.getCallingUid();
@@ -483,6 +489,7 @@ public class RecoverableKeyStoreManagerTest {
}
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void initRecoveryService_updatesWithLargerSerial() throws Exception {
int uid = Binder.getCallingUid();
@@ -500,6 +507,7 @@ public class RecoverableKeyStoreManagerTest {
assertThat(mRecoverableKeyStoreDb.getShouldCreateSnapshot(userId, uid)).isFalse();
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void initRecoveryService_throwsExceptionOnSmallerSerial() throws Exception {
int uid = Binder.getCallingUid();
@@ -565,6 +573,7 @@ public class RecoverableKeyStoreManagerTest {
TestData.getInsecureCertPathForEndpoint1());
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void initRecoveryService_ignoresTheSameSerial() throws Exception {
int uid = Binder.getCallingUid();
@@ -615,6 +624,7 @@ public class RecoverableKeyStoreManagerTest {
}
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void initRecoveryServiceWithSigFile_succeeds() throws Exception {
int uid = Binder.getCallingUid();
@@ -630,6 +640,7 @@ public class RecoverableKeyStoreManagerTest {
assertThat(mRecoverableKeyStoreDb.getRecoveryServicePublicKey(userId, uid)).isNull();
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void initRecoveryServiceWithSigFile_usesProdCertificateForNullRootAlias()
throws Exception {
@@ -723,6 +734,7 @@ public class RecoverableKeyStoreManagerTest {
eq(Manifest.permission.RECOVER_KEYSTORE), any());
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void startRecoverySessionWithCertPath_storesTheSessionInfo() throws Exception {
mRecoverableKeyStoreManager.startRecoverySessionWithCertPath(
@@ -740,6 +752,7 @@ public class RecoverableKeyStoreManagerTest {
assertEquals(KEY_CLAIMANT_LENGTH_BYTES, entry.getKeyClaimant().length);
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void startRecoverySessionWithCertPath_checksPermissionFirst() throws Exception {
mRecoverableKeyStoreManager.startRecoverySessionWithCertPath(
@@ -809,6 +822,7 @@ public class RecoverableKeyStoreManagerTest {
}
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void startRecoverySession_throwsIfBadNumberOfSecrets() throws Exception {
try {
@@ -825,6 +839,7 @@ public class RecoverableKeyStoreManagerTest {
}
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void startRecoverySession_throwsIfPublicKeysMismatch() throws Exception {
byte[] vaultParams = TEST_VAULT_PARAMS.clone();
@@ -843,6 +858,7 @@ public class RecoverableKeyStoreManagerTest {
}
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void startRecoverySessionWithCertPath_throwsIfBadNumberOfSecrets() throws Exception {
try {
@@ -860,6 +876,7 @@ public class RecoverableKeyStoreManagerTest {
}
}
+ @Ignore("Causing breakages so ignoring to resolve, b/281583079")
@Test
public void startRecoverySessionWithCertPath_throwsIfPublicKeysMismatch() throws Exception {
byte[] vaultParams = TEST_VAULT_PARAMS.clone();
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 7c7e2ee53f3c..012596e4327e 100644
--- a/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
@@ -151,6 +151,7 @@ import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionPlan;
+import android.telephony.TelephonyCallback;
import android.telephony.TelephonyManager;
import android.test.suitebuilder.annotation.MediumTest;
import android.text.TextUtils;
@@ -241,6 +242,7 @@ public class NetworkPolicyManagerServiceTest {
private static final String TEST_WIFI_NETWORK_KEY = "TestWifiNetworkKey";
private static final String TEST_IMSI = "310210";
private static final int TEST_SUB_ID = 42;
+ private static final int TEST_SUB_ID2 = 24;
private static final Network TEST_NETWORK = mock(Network.class, CALLS_REAL_METHODS);
private static NetworkTemplate sTemplateWifi = new NetworkTemplate.Builder(MATCH_WIFI)
@@ -282,6 +284,8 @@ public class NetworkPolicyManagerServiceTest {
private ArgumentCaptor<ConnectivityManager.NetworkCallback> mNetworkCallbackCaptor =
ArgumentCaptor.forClass(ConnectivityManager.NetworkCallback.class);
+ private TelephonyCallback.ActiveDataSubscriptionIdListener mActiveDataSubIdListener;
+
private ActivityManagerInternal mActivityManagerInternal;
private PackageManagerInternal mPackageManagerInternal;
@@ -357,6 +361,8 @@ public class NetworkPolicyManagerServiceTest {
private class TestDependencies extends NetworkPolicyManagerService.Dependencies {
private final SparseArray<NetworkStats.Bucket> mMockedStats = new SparseArray<>();
+ private int mMockDefaultDataSubId;
+ private int mMockedActiveDataSubId;
TestDependencies(Context context) {
super(context);
@@ -394,6 +400,21 @@ public class NetworkPolicyManagerServiceTest {
final NetworkStats.Bucket bucket = mMockedStats.get(uid);
setMockedTotalBytes(uid, bucket.getRxBytes() + rxBytes, bucket.getTxBytes() + txBytes);
}
+
+ void setDefaultAndActiveDataSubId(int defaultDataSubId, int activeDataSubId) {
+ mMockDefaultDataSubId = defaultDataSubId;
+ mMockedActiveDataSubId = activeDataSubId;
+ }
+
+ @Override
+ int getDefaultDataSubId() {
+ return mMockDefaultDataSubId;
+ }
+
+ @Override
+ int getActivateDataSubId() {
+ return mMockedActiveDataSubId;
+ }
}
@Before
@@ -551,6 +572,14 @@ public class NetworkPolicyManagerServiceTest {
NetworkPolicy defaultPolicy = mService.buildDefaultCarrierPolicy(0, "");
mDefaultWarningBytes = defaultPolicy.warningBytes;
mDefaultLimitBytes = defaultPolicy.limitBytes;
+
+ // Catch TelephonyCallback during systemReady().
+ ArgumentCaptor<TelephonyCallback> telephonyCallbackArgumentCaptor =
+ ArgumentCaptor.forClass(TelephonyCallback.class);
+ verify(mTelephonyManager).registerTelephonyCallback(any(),
+ telephonyCallbackArgumentCaptor.capture());
+ mActiveDataSubIdListener = (TelephonyCallback.ActiveDataSubscriptionIdListener)
+ telephonyCallbackArgumentCaptor.getValue();
}
@After
@@ -1243,6 +1272,7 @@ public class NetworkPolicyManagerServiceTest {
reset(mTelephonyManager, mNetworkManager, mNotifManager);
TelephonyManager tmSub = expectMobileDefaults();
+ clearInvocations(mNotifManager);
mService.updateNetworks();
@@ -1258,6 +1288,7 @@ public class NetworkPolicyManagerServiceTest {
reset(mTelephonyManager, mNetworkManager, mNotifManager);
TelephonyManager tmSub = expectMobileDefaults();
+ clearInvocations(mNotifManager);
mService.updateNetworks();
@@ -1275,6 +1306,7 @@ public class NetworkPolicyManagerServiceTest {
reset(mTelephonyManager, mNetworkManager, mNotifManager);
TelephonyManager tmSub = expectMobileDefaults();
expectDefaultCarrierConfig();
+ clearInvocations(mNotifManager);
mService.updateNetworks();
@@ -1291,6 +1323,7 @@ public class NetworkPolicyManagerServiceTest {
reset(mTelephonyManager, mNetworkManager, mNotifManager);
TelephonyManager tmSub = expectMobileDefaults();
+ clearInvocations(mNotifManager);
mService.updateNetworks();
@@ -1304,6 +1337,7 @@ public class NetworkPolicyManagerServiceTest {
{
reset(mTelephonyManager, mNetworkManager, mNotifManager);
TelephonyManager tmSub = expectMobileDefaults();
+ clearInvocations(mNotifManager);
mService.snoozeLimit(sTemplateCarrierMetered);
mService.updateNetworks();
@@ -1314,6 +1348,31 @@ public class NetworkPolicyManagerServiceTest {
verify(mNotifManager, atLeastOnce()).notifyAsUser(any(), eq(TYPE_LIMIT_SNOOZED),
isA(Notification.class), eq(UserHandle.ALL));
}
+ // The sub is no longer used for data(e.g. user uses another sub), hide the notifications.
+ {
+ reset(mTelephonyManager, mNetworkManager, mNotifManager);
+
+ notifyDefaultAndActiveDataSubIdChange(TEST_SUB_ID2, TEST_SUB_ID2);
+ verify(mNotifManager, atLeastOnce()).cancel(any(), eq(TYPE_LIMIT_SNOOZED));
+ }
+ // The sub is not active for data(e.g. due to auto data switch), but still default for data,
+ // show notification.
+ {
+ reset(mTelephonyManager, mNetworkManager, mNotifManager);
+
+ notifyDefaultAndActiveDataSubIdChange(TEST_SUB_ID, TEST_SUB_ID2);
+ verify(mNotifManager, atLeastOnce()).notifyAsUser(any(), eq(TYPE_LIMIT_SNOOZED),
+ isA(Notification.class), eq(UserHandle.ALL));
+ }
+ // The sub is active for data, but not the default(e.g. due to auto data switch),
+ // show notification.
+ {
+ reset(mTelephonyManager, mNetworkManager, mNotifManager);
+
+ notifyDefaultAndActiveDataSubIdChange(TEST_SUB_ID2, TEST_SUB_ID);
+ verify(mNotifManager, atLeastOnce()).notifyAsUser(any(), eq(TYPE_LIMIT_SNOOZED),
+ isA(Notification.class), eq(UserHandle.ALL));
+ }
}
@Test
@@ -2377,6 +2436,7 @@ public class NetworkPolicyManagerServiceTest {
String subscriberId) {
when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(
createSubscriptionInfoList(subscriptionId));
+ notifyDefaultAndActiveDataSubIdChange(subscriptionId, subscriptionId);
TelephonyManager subTelephonyManager;
subTelephonyManager = mock(TelephonyManager.class);
@@ -2388,6 +2448,16 @@ public class NetworkPolicyManagerServiceTest {
}
/**
+ * Telephony Manager callback notifies data sub Id changes.
+ * @param defaultDataSubId The mock default data sub Id.
+ * @param activeDataSubId The mock active data sub Id.
+ */
+ private void notifyDefaultAndActiveDataSubIdChange(int defaultDataSubId, int activeDataSubId) {
+ mDeps.setDefaultAndActiveDataSubId(defaultDataSubId, activeDataSubId);
+ mActiveDataSubIdListener.onActiveDataSubscriptionIdChanged(activeDataSubId);
+ }
+
+ /**
* Creates mock {@link SubscriptionInfo} from subscription id.
*/
private List<SubscriptionInfo> createSubscriptionInfoList(int subId) {
diff --git a/services/tests/servicestests/src/com/android/server/webkit/OWNERS b/services/tests/servicestests/src/com/android/server/webkit/OWNERS
index 00e540a46ab2..e7fd7a5d1096 100644
--- a/services/tests/servicestests/src/com/android/server/webkit/OWNERS
+++ b/services/tests/servicestests/src/com/android/server/webkit/OWNERS
@@ -1,3 +1,3 @@
-changwan@google.com
-tobiasjs@google.com
+# Bug component: 76427
+ntfschr@google.com
torne@google.com
diff --git a/services/tests/servicestests/utils/com/android/server/testutils/OWNERS b/services/tests/servicestests/utils/com/android/server/testutils/OWNERS
new file mode 100644
index 000000000000..bdacf7f37d3f
--- /dev/null
+++ b/services/tests/servicestests/utils/com/android/server/testutils/OWNERS
@@ -0,0 +1 @@
+per-file *Transaction.java = file:/services/core/java/com/android/server/wm/OWNERS \ No newline at end of file
diff --git a/services/tests/uiservicestests/OWNERS b/services/tests/uiservicestests/OWNERS
new file mode 100644
index 000000000000..c0cbea98cc57
--- /dev/null
+++ b/services/tests/uiservicestests/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/notification/OWNERS \ No newline at end of file
diff --git a/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java b/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java
index d2cb7ba5d311..e2db2e6b19e1 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java
@@ -222,7 +222,7 @@ class TestWindowManagerPolicy implements WindowManagerPolicy {
}
@Override
- public void onKeyguardOccludedChangedLw(boolean occluded) {
+ public void onKeyguardOccludedChangedLw(boolean occluded, boolean waitAppTransition) {
}
public void setSafeMode(boolean safeMode) {
diff --git a/services/usb/OWNERS b/services/usb/OWNERS
index 60172a36128e..d35dbb56437b 100644
--- a/services/usb/OWNERS
+++ b/services/usb/OWNERS
@@ -1,3 +1,7 @@
+aprasath@google.com
+kumarashishg@google.com
+sarup@google.com
+anothermark@google.com
badhri@google.com
elaurent@google.com
albertccwang@google.com
diff --git a/services/usb/java/com/android/server/usb/UsbAlsaManager.java b/services/usb/java/com/android/server/usb/UsbAlsaManager.java
index 42a5af7fdce3..3a8ef3370a53 100644
--- a/services/usb/java/com/android/server/usb/UsbAlsaManager.java
+++ b/services/usb/java/com/android/server/usb/UsbAlsaManager.java
@@ -71,6 +71,7 @@ public final class UsbAlsaManager {
private static final int USB_VENDORID_SONY = 0x054C;
private static final int USB_PRODUCTID_PS4CONTROLLER_ZCT1 = 0x05C4;
private static final int USB_PRODUCTID_PS4CONTROLLER_ZCT2 = 0x09CC;
+ private static final int USB_PRODUCTID_PS5CONTROLLER = 0x0CE6;
private static final int USB_DENYLIST_OUTPUT = 0x0001;
private static final int USB_DENYLIST_INPUT = 0x0002;
@@ -93,6 +94,9 @@ public final class UsbAlsaManager {
USB_DENYLIST_OUTPUT),
new DenyListEntry(USB_VENDORID_SONY,
USB_PRODUCTID_PS4CONTROLLER_ZCT2,
+ USB_DENYLIST_OUTPUT),
+ new DenyListEntry(USB_VENDORID_SONY,
+ USB_PRODUCTID_PS5CONTROLLER,
USB_DENYLIST_OUTPUT));
private static boolean isDeviceDenylisted(int vendorId, int productId, int flags) {
diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java
index ec18c6a696b8..7a53447c1eee 100644
--- a/telecomm/java/android/telecom/PhoneAccount.java
+++ b/telecomm/java/android/telecom/PhoneAccount.java
@@ -555,6 +555,11 @@ public final class PhoneAccount implements Parcelable {
/**
* Sets the address. See {@link PhoneAccount#getAddress}.
+ * <p>
+ * Note: The entire URI value is limited to 256 characters. This check is
+ * enforced when registering the PhoneAccount via
+ * {@link TelecomManager#registerPhoneAccount(PhoneAccount)} and will cause an
+ * {@link IllegalArgumentException} to be thrown if URI is over 256.
*
* @param value The address of the phone account.
* @return The builder.
@@ -588,6 +593,10 @@ public final class PhoneAccount implements Parcelable {
/**
* Sets the icon. See {@link PhoneAccount#getIcon}.
+ * <p>
+ * Note: An {@link IllegalArgumentException} if the Icon cannot be written to memory.
+ * This check is enforced when registering the PhoneAccount via
+ * {@link TelecomManager#registerPhoneAccount(PhoneAccount)}
*
* @param icon The icon to set.
*/
@@ -621,6 +630,10 @@ public final class PhoneAccount implements Parcelable {
/**
* Specifies an additional URI scheme supported by the {@link PhoneAccount}.
*
+ * <p>
+ * Each URI scheme is limited to 256 characters. Adding a scheme over 256 characters will
+ * cause an {@link IllegalArgumentException} to be thrown when the account is registered.
+ *
* @param uriScheme The URI scheme.
* @return The builder.
*/
@@ -634,6 +647,12 @@ public final class PhoneAccount implements Parcelable {
/**
* Specifies the URI schemes supported by the {@link PhoneAccount}.
*
+ * <p>
+ * A max of 10 URI schemes can be added per account. Additionally, each URI scheme is
+ * limited to 256 characters. Adding more than 10 URI schemes or 256 characters on any
+ * scheme will cause an {@link IllegalArgumentException} to be thrown when the account
+ * is registered.
+ *
* @param uriSchemes The URI schemes.
* @return The builder.
*/
diff --git a/tests/utils/testutils/java/android/os/test/FakePermissionEnforcer.java b/tests/utils/testutils/java/android/os/test/FakePermissionEnforcer.java
index b94bb41c0988..d10ae307fdf4 100644
--- a/tests/utils/testutils/java/android/os/test/FakePermissionEnforcer.java
+++ b/tests/utils/testutils/java/android/os/test/FakePermissionEnforcer.java
@@ -47,6 +47,10 @@ public class FakePermissionEnforcer extends PermissionEnforcer {
mGranted.remove(permission);
}
+ public void revokeAll() {
+ mGranted.clear();
+ }
+
private boolean granted(String permission) {
return mGranted.contains(permission);
}
diff --git a/tools/aapt2/SdkConstants.cpp b/tools/aapt2/SdkConstants.cpp
index 34e8edb0a47f..e7b37704f3ea 100644
--- a/tools/aapt2/SdkConstants.cpp
+++ b/tools/aapt2/SdkConstants.cpp
@@ -26,8 +26,8 @@ using android::StringPiece;
namespace aapt {
static ApiVersion sDevelopmentSdkLevel = 10000;
-static const auto sDevelopmentSdkCodeNames =
- std::unordered_set<StringPiece>({"Q", "R", "S", "Sv2", "Tiramisu", "UpsideDownCake"});
+static const auto sDevelopmentSdkCodeNames = std::unordered_set<StringPiece>(
+ {"Q", "R", "S", "Sv2", "Tiramisu", "UpsideDownCake", "VanillaIceCream"});
static const std::vector<std::pair<uint16_t, ApiVersion>> sAttrIdMap = {
{0x021c, 1},
diff --git a/tools/aapt2/cmd/Link.h b/tools/aapt2/cmd/Link.h
index 0170c4a4c54b..2f5d8d19ebe5 100644
--- a/tools/aapt2/cmd/Link.h
+++ b/tools/aapt2/cmd/Link.h
@@ -206,6 +206,11 @@ class LinkCommand : public Command {
AddOptionalFlag("--compile-sdk-version-name",
"Version name to inject into the AndroidManifest.xml if none is present.",
&options_.manifest_fixer_options.compile_sdk_version_codename);
+ AddOptionalSwitch(
+ "--no-compile-sdk-metadata",
+ "Suppresses output of compile SDK-related attributes in AndroidManifest.xml,\n"
+ "including android:compileSdkVersion and platformBuildVersion.",
+ &options_.manifest_fixer_options.no_compile_sdk_metadata);
AddOptionalSwitch("--shared-lib", "Generates a shared Android runtime library.",
&shared_lib_);
AddOptionalSwitch("--static-lib", "Generate a static Android library.", &static_lib_);
diff --git a/tools/aapt2/link/ManifestFixer.cpp b/tools/aapt2/link/ManifestFixer.cpp
index 42191912775a..f8e734724018 100644
--- a/tools/aapt2/link/ManifestFixer.cpp
+++ b/tools/aapt2/link/ManifestFixer.cpp
@@ -635,7 +635,7 @@ bool ManifestFixer::Consume(IAaptContext* context, xml::XmlResource* doc) {
root->InsertChild(0, std::move(uses_sdk));
}
- if (options_.compile_sdk_version) {
+ if (!options_.no_compile_sdk_metadata && options_.compile_sdk_version) {
xml::Attribute* attr = root->FindOrCreateAttribute(xml::kSchemaAndroid, "compileSdkVersion");
// Make sure we un-compile the value if it was set to something else.
@@ -647,10 +647,9 @@ bool ManifestFixer::Consume(IAaptContext* context, xml::XmlResource* doc) {
// Make sure we un-compile the value if it was set to something else.
attr->compiled_value = {};
attr->value = options_.compile_sdk_version.value();
-
}
- if (options_.compile_sdk_version_codename) {
+ if (!options_.no_compile_sdk_metadata && options_.compile_sdk_version_codename) {
xml::Attribute* attr =
root->FindOrCreateAttribute(xml::kSchemaAndroid, "compileSdkVersionCodename");
diff --git a/tools/aapt2/link/ManifestFixer.h b/tools/aapt2/link/ManifestFixer.h
index a8707d9d8623..70bfcfc1365a 100644
--- a/tools/aapt2/link/ManifestFixer.h
+++ b/tools/aapt2/link/ManifestFixer.h
@@ -68,11 +68,12 @@ struct ManifestFixerOptions {
std::optional<std::string> revision_code_default;
// The version of the framework being compiled against to set for 'android:compileSdkVersion' in
- // the <manifest> tag.
+ // the <manifest> tag. Not used if no_compile_sdk_metadata is set.
std::optional<std::string> compile_sdk_version;
// The version codename of the framework being compiled against to set for
- // 'android:compileSdkVersionCodename' in the <manifest> tag.
+ // 'android:compileSdkVersionCodename' in the <manifest> tag. Not used if no_compile_sdk_metadata
+ // is set.
std::optional<std::string> compile_sdk_version_codename;
// Whether validation errors should be treated only as warnings. If this is 'true', then an
@@ -85,6 +86,9 @@ struct ManifestFixerOptions {
// Whether to replace the manifest version with the the command line version
bool replace_version = false;
+
+ // Whether to suppress `android:compileSdkVersion*` and `platformBuildVersion*` attributes.
+ bool no_compile_sdk_metadata = false;
};
// Verifies that the manifest is correctly formed and inserts defaults where specified with
diff --git a/tools/aapt2/link/ManifestFixer_test.cpp b/tools/aapt2/link/ManifestFixer_test.cpp
index 098d0be7f87d..9204d2276a17 100644
--- a/tools/aapt2/link/ManifestFixer_test.cpp
+++ b/tools/aapt2/link/ManifestFixer_test.cpp
@@ -892,6 +892,35 @@ TEST_F(ManifestFixerTest, InsertCompileSdkVersions) {
EXPECT_THAT(attr->value, StrEq("P"));
}
+TEST_F(ManifestFixerTest, DoNotInsertCompileSdkVersions) {
+ std::string input = R"(<manifest package="com.pkg" />)";
+ ManifestFixerOptions options;
+ options.no_compile_sdk_metadata = true;
+ options.compile_sdk_version = {"28"};
+ options.compile_sdk_version_codename = {"P"};
+
+ std::unique_ptr<xml::XmlResource> manifest = VerifyWithOptions(input, options);
+ ASSERT_THAT(manifest, NotNull());
+
+ // There should be a declaration of kSchemaAndroid, even when the input
+ // didn't have one.
+ EXPECT_EQ(manifest->root->namespace_decls.size(), 1);
+ EXPECT_EQ(manifest->root->namespace_decls[0].prefix, "android");
+ EXPECT_EQ(manifest->root->namespace_decls[0].uri, xml::kSchemaAndroid);
+
+ xml::Attribute* attr = manifest->root->FindAttribute(xml::kSchemaAndroid, "compileSdkVersion");
+ ASSERT_THAT(attr, IsNull());
+
+ attr = manifest->root->FindAttribute(xml::kSchemaAndroid, "compileSdkVersionCodename");
+ ASSERT_THAT(attr, IsNull());
+
+ attr = manifest->root->FindAttribute("", "platformBuildVersionCode");
+ ASSERT_THAT(attr, IsNull());
+
+ attr = manifest->root->FindAttribute("", "platformBuildVersionName");
+ ASSERT_THAT(attr, IsNull());
+}
+
TEST_F(ManifestFixerTest, OverrideCompileSdkVersions) {
std::string input = R"(
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="android"
diff --git a/tools/incident_section_gen/main.cpp b/tools/incident_section_gen/main.cpp
index dd266ffe0f16..a2c1d6b4f784 100644
--- a/tools/incident_section_gen/main.cpp
+++ b/tools/incident_section_gen/main.cpp
@@ -383,13 +383,11 @@ static bool generatePrivacyFlags(const Descriptor* descriptor, const Destination
if (allDefaults) return false;
emptyline();
- int policyCount = 0;
printf("Privacy* %s[] = {\n", messageName.c_str());
for (size_t i=0; i<fieldsInOrder.size(); i++) {
const FieldDescriptor* field = fieldsInOrder[i];
if (hasDefaultFlags[i]) continue; // NOLINT(clang-analyzer-core.uninitialized.Branch)
printf(" &%s,\n", getFieldName(field).c_str());
- policyCount++;
}
printf(" NULL };\n");
emptyline();
diff --git a/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/Constants.kt b/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/Constants.kt
index dcfbe953f955..e03d92ab44a0 100644
--- a/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/Constants.kt
+++ b/tools/lint/global/checks/src/main/java/com/google/android/lint/aidl/Constants.kt
@@ -72,5 +72,78 @@ val EXCLUDED_CPP_INTERFACES = listOf(
"Status",
"IThermalService",
"IPowerManager",
- "ITunerResourceManager"
+ "ITunerResourceManager",
+ // b/278147400
+ "IActivityManager",
+ "IUidObserver",
+ "IDrm",
+ "IVsyncCallback",
+ "IVsyncService",
+ "ICallback",
+ "IIPCTest",
+ "ISafeInterfaceTest",
+ "IGpuService",
+ "IConsumerListener",
+ "IGraphicBufferConsumer",
+ "ITransactionComposerListener",
+ "SensorEventConnection",
+ "SensorServer",
+ "ICamera",
+ "ICameraClient",
+ "ICameraRecordingProxy",
+ "ICameraRecordingProxyListener",
+ "ICrypto",
+ "IOMXObserver",
+ "IStreamListener",
+ "IStreamSource",
+ "IAudioService",
+ "IDataSource",
+ "IDrmClient",
+ "IMediaCodecList",
+ "IMediaDrmService",
+ "IMediaExtractor",
+ "IMediaExtractorService",
+ "IMediaHTTPConnection",
+ "IMediaHTTPService",
+ "IMediaLogService",
+ "IMediaMetadataRetriever",
+ "IMediaMetricsService",
+ "IMediaPlayer",
+ "IMediaPlayerClient",
+ "IMediaPlayerService",
+ "IMediaRecorder",
+ "IMediaRecorderClient",
+ "IMediaResourceMonitor",
+ "IMediaSource",
+ "IRemoteDisplay",
+ "IRemoteDisplayClient",
+ "IResourceManagerClient",
+ "IResourceManagerService",
+ "IComplexTypeInterface",
+ "IPermissionController",
+ "IPingResponder",
+ "IProcessInfoService",
+ "ISchedulingPolicyService",
+ "IStringConstants",
+ "IObbActionListener",
+ "IStorageEventListener",
+ "IStorageManager",
+ "IStorageShutdownObserver",
+ "IPersistentVrStateCallbacks",
+ "IVrManager",
+ "IVrStateCallbacks",
+ "ISurfaceComposer",
+ "IMemory",
+ "IMemoryHeap",
+ "IProcfsInspector",
+ "IAppOpsCallback",
+ "IAppOpsService",
+ "IBatteryStats",
+ "IResultReceiver",
+ "IShellCallback",
+ "IDrmManagerService",
+ "IDrmServiceListener",
+ "IAAudioClient",
+ "IAAudioService",
+ "VtsFuzzer",
)