Merge "Enable bus device audio in default audio HAL" into main
diff --git a/Android.bp b/Android.bp
index 223a1a9..baf3291 100644
--- a/Android.bp
+++ b/Android.bp
@@ -51,7 +51,6 @@
// Lists all dependencies that can *not* be expected on the device.
static_libs: [
"VtsHalHidlTestUtils",
- "libhidlbase",
"libhidl-gen-utils",
],
@@ -64,6 +63,7 @@
"libbase",
// All the following are dependencies of any HAL definition library.
"libcutils",
+ "libhidlbase",
"liblog",
"libutils",
],
@@ -72,14 +72,6 @@
"-g",
],
- target: {
- android: {
- shared_libs: [
- "libvndksupport",
- ],
- },
- },
-
require_root: true,
}
diff --git a/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl b/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl
index 65ea9ef..cfe001e 100644
--- a/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl
+++ b/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl
@@ -386,14 +386,23 @@
* For input streams: the moment when data at the specified stream position
* was acquired (i.e. capture position).
*
- * The observable position must never be reset by the HAL module.
- * The data type of the frame counter is large enough to support
- * continuous counting for years of operation.
+ * The observable position must never be reset by the HAL module,
+ * providing an abstraction of continuous audio data flow. The data
+ * type of the frame counter is large enough to support continuous
+ * counting for years of operation.
*/
Position observable;
/**
* Used only for MMap streams to provide the hardware read / write
* position for audio data in the shared memory buffer 'audio.mmap'.
+ * Similar to the observable position, the 'Position::UNKNOWN' value
+ * can be returned when the HAL module is unable to retrieve the current
+ * position.
+ *
+ * The hardware position must never be reset by the HAL module,
+ * providing an abstraction of continuous audio data flow. The data
+ * type of the frame counter is large enough to support continuous
+ * counting for years of operation.
*/
Position hardware;
/**
diff --git a/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp b/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp
index d8332aa..154a5af 100644
--- a/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp
@@ -78,6 +78,8 @@
const std::vector<float> kQFactorValues = {MIN_FLOAT, 100, MAX_FLOAT};
const std::vector<float> kMaxAmplitude = {MIN_FLOAT, 100, MAX_FLOAT};
+constexpr int HAPTIC_SCALE_FACTORS_EFFECT_MIN_VERSION = 3;
+
class HapticGeneratorParamTest : public ::testing::TestWithParam<HapticGeneratorParamTestParam>,
public EffectHelper {
public:
@@ -95,6 +97,7 @@
void SetUp() override {
ASSERT_NE(nullptr, mFactory);
ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
+ EXPECT_STATUS(EX_NONE, mEffect->getInterfaceVersion(&mEffectInterfaceVersion));
Parameter::Common common = createParamCommon(
0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */,
@@ -113,6 +116,7 @@
std::shared_ptr<IFactory> mFactory;
std::shared_ptr<IEffect> mEffect;
Descriptor mDescriptor;
+ int mEffectInterfaceVersion;
int mParamHapticScaleId = 0;
HapticGenerator::VibratorScale mParamVibratorScale = HapticGenerator::VibratorScale::MUTE;
float mParamScaleFactor = HapticGenerator::HapticScale::UNDEFINED_SCALE_FACTOR;
@@ -148,11 +152,15 @@
void addHapticScaleParam(int id, HapticGenerator::VibratorScale scale, float scaleFactor,
float adaptiveScaleFactor) {
HapticGenerator setHg;
- std::vector<HapticGenerator::HapticScale> hapticScales = {
- {.id = id,
- .scale = scale,
- .scaleFactor = scaleFactor,
- .adaptiveScaleFactor = adaptiveScaleFactor}};
+ std::vector<HapticGenerator::HapticScale> hapticScales;
+ if (mEffectInterfaceVersion >= HAPTIC_SCALE_FACTORS_EFFECT_MIN_VERSION) {
+ hapticScales = {{.id = id,
+ .scale = scale,
+ .scaleFactor = scaleFactor,
+ .adaptiveScaleFactor = adaptiveScaleFactor}};
+ } else {
+ hapticScales = {{.id = id, .scale = scale}};
+ }
setHg.set<HapticGenerator::hapticScales>(hapticScales);
mTags.push_back({HapticGenerator::hapticScales, setHg});
}
diff --git a/automotive/remoteaccess/hal/default/Android.bp b/automotive/remoteaccess/hal/default/Android.bp
index cc8f2b0..b6c0525 100644
--- a/automotive/remoteaccess/hal/default/Android.bp
+++ b/automotive/remoteaccess/hal/default/Android.bp
@@ -51,15 +51,22 @@
cc_binary {
name: "android.hardware.automotive.remoteaccess@V2-default-service",
defaults: ["remote-access-hal-defaults"],
- vintf_fragments: ["remoteaccess-default-service.xml"],
init_rc: ["remoteaccess-default-service.rc"],
+ vintf_fragment_modules: ["remoteaccess-default-service.xml"],
+
}
cc_binary {
name: "android.hardware.automotive.remoteaccess@V2-tcu-test-service",
defaults: ["remote-access-hal-defaults"],
- vintf_fragments: ["remoteaccess-default-service.xml"],
init_rc: ["remoteaccess-tcu-test-service.rc"],
+ vintf_fragment_modules: ["remoteaccess-default-service.xml"],
+}
+
+vintf_fragment {
+ name: "remoteaccess-default-service.xml",
+ src: "remoteaccess-default-service.xml",
+ vendor: true,
}
cc_library {
diff --git a/automotive/vehicle/Android.bp b/automotive/vehicle/Android.bp
index e614937..3a7ef43 100644
--- a/automotive/vehicle/Android.bp
+++ b/automotive/vehicle/Android.bp
@@ -22,7 +22,7 @@
name: "VehicleHalInterfaceDefaults",
static_libs: [
"android.hardware.automotive.vehicle-V3-ndk",
- "android.hardware.automotive.vehicle.property-V3-ndk",
+ "android.hardware.automotive.vehicle.property-V4-ndk",
],
}
@@ -30,6 +30,6 @@
name: "VehicleHalInterfaceRustDefaults",
rustlibs: [
"android.hardware.automotive.vehicle-V3-rust",
- "android.hardware.automotive.vehicle.property-V3-rust",
+ "android.hardware.automotive.vehicle.property-V4-rust",
],
}
diff --git a/automotive/vehicle/aidl/aidl_test/Android.bp b/automotive/vehicle/aidl/aidl_test/Android.bp
index f517df8..1e43070 100644
--- a/automotive/vehicle/aidl/aidl_test/Android.bp
+++ b/automotive/vehicle/aidl/aidl_test/Android.bp
@@ -40,7 +40,7 @@
cc_test {
name: "VehiclePropertyAnnotationCppTest",
srcs: ["VehiclePropertyAnnotationCppTest.cpp"],
- header_libs: ["IVehicleGeneratedHeaders-V3"],
+ header_libs: ["IVehicleGeneratedHeaders-V4"],
defaults: ["VehicleHalInterfaceDefaults"],
test_suites: ["general-tests"],
}
@@ -49,11 +49,11 @@
name: "VehiclePropertyAnnotationJavaTest",
srcs: [
"VehiclePropertyAnnotationJavaTest.java",
- ":IVehicleGeneratedJavaFiles-V3",
+ ":IVehicleGeneratedJavaFiles-V4",
],
static_libs: [
"android.hardware.automotive.vehicle-V3-java",
- "android.hardware.automotive.vehicle.property-V3-java",
+ "android.hardware.automotive.vehicle.property-V4-java",
"androidx.test.runner",
"truth",
],
diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp
index 28c95ce..aef2909 100644
--- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp
+++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp
@@ -27,7 +27,7 @@
defaults: ["VehicleHalDefaults"],
static_libs: ["VehicleHalUtils"],
header_libs: [
- "IVehicleGeneratedHeaders-V3",
+ "IVehicleGeneratedHeaders-V4",
],
shared_libs: ["libjsoncpp"],
}
@@ -44,7 +44,7 @@
defaults: ["VehicleHalDefaults"],
static_libs: ["VehicleHalUtils"],
header_libs: [
- "IVehicleGeneratedHeaders-V3",
+ "IVehicleGeneratedHeaders-V4",
"libbinder_headers",
],
cflags: ["-DENABLE_VEHICLE_HAL_TEST_PROPERTIES"],
@@ -60,7 +60,7 @@
defaults: ["VehicleHalDefaults"],
static_libs: ["VehicleHalUtils"],
header_libs: [
- "IVehicleGeneratedHeaders-V3",
+ "IVehicleGeneratedHeaders-V4",
],
shared_libs: ["libjsoncpp"],
}
diff --git a/automotive/vehicle/aidl/impl/default_config/test/Android.bp b/automotive/vehicle/aidl/impl/default_config/test/Android.bp
index 70933be..52014fb 100644
--- a/automotive/vehicle/aidl/impl/default_config/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/default_config/test/Android.bp
@@ -31,7 +31,7 @@
"libgtest",
],
header_libs: [
- "IVehicleGeneratedHeaders-V3",
+ "IVehicleGeneratedHeaders-V4",
],
shared_libs: [
"libjsoncpp",
@@ -57,7 +57,7 @@
"-DENABLE_VEHICLE_HAL_TEST_PROPERTIES",
],
header_libs: [
- "IVehicleGeneratedHeaders-V3",
+ "IVehicleGeneratedHeaders-V4",
],
shared_libs: [
"libjsoncpp",
diff --git a/automotive/vehicle/aidl/impl/vhal/Android.bp b/automotive/vehicle/aidl/impl/vhal/Android.bp
index 5cc071d..54d148e 100644
--- a/automotive/vehicle/aidl/impl/vhal/Android.bp
+++ b/automotive/vehicle/aidl/impl/vhal/Android.bp
@@ -66,7 +66,7 @@
],
header_libs: [
"IVehicleHardware",
- "IVehicleGeneratedHeaders-V3",
+ "IVehicleGeneratedHeaders-V4",
],
shared_libs: [
"libbinder_ndk",
diff --git a/automotive/vehicle/tools/generate_emu_metadata/src/com/android/car/tool/EmuMetadataGenerator.java b/automotive/vehicle/tools/generate_emu_metadata/src/com/android/car/tool/EmuMetadataGenerator.java
index bea5951..7f4ceb8 100644
--- a/automotive/vehicle/tools/generate_emu_metadata/src/com/android/car/tool/EmuMetadataGenerator.java
+++ b/automotive/vehicle/tools/generate_emu_metadata/src/com/android/car/tool/EmuMetadataGenerator.java
@@ -79,17 +79,18 @@
+ "either this or input_files must be specified\n" + INPUT_FILES_OPTION
+ ": one or more Java files, this is used to decide the input "
+ "directory\n" + PACKAGE_NAME_OPTION
- + ": the optional package name for the interface, by default is " + DEFAULT_PACKAGE_NAME
- + "\n" + OUTPUT_JSON_OPTION + ": The output JSON file\n" + OUTPUT_EMPTY_FILE_OPTION
- + ": Only used for check_mode, this file will be created if "
+ + ": the optional package name for the interface, by default is "
+ + DEFAULT_PACKAGE_NAME + "\n" + OUTPUT_JSON_OPTION + ": The output JSON file\n"
+ + OUTPUT_EMPTY_FILE_OPTION + ": Only used for check_mode, this file will be created if "
+ "check passed\n" + CHECK_AGAINST_OPTION
+ ": An optional JSON file to check against. If specified, the "
- + "generated output file will be checked against this file, if they are not the same, "
+ + ("generated output file will be checked against this file, if they are not the "
+ + "same, ")
+ "the script will fail, otherwise, the output_empty_file will be created\n"
+ "For example: \n"
+ "EnumMetadataGenerator --input_dir out/soong/.intermediates/hardware/"
+ "interfaces/automotive/vehicle/aidl_property/android.hardware.automotive.vehicle."
- + "property-V3-java-source/gen/ --package_name android.hardware.automotive.vehicle "
+ + "property-V4-java-source/gen/ --package_name android.hardware.automotive.vehicle "
+ "--output_json /tmp/android.hardware.automotive.vehicle-types-meta.json";
private static final String VEHICLE_PROPERTY_FILE = "VehicleProperty.java";
private static final String CHECK_FILE_PATH =
diff --git a/automotive/vehicle/vhal_static_cpp_lib.mk b/automotive/vehicle/vhal_static_cpp_lib.mk
index 6b3d486..9371453 100644
--- a/automotive/vehicle/vhal_static_cpp_lib.mk
+++ b/automotive/vehicle/vhal_static_cpp_lib.mk
@@ -17,4 +17,4 @@
LOCAL_STATIC_LIBRARIES += \
android.hardware.automotive.vehicle-V3-ndk \
- android.hardware.automotive.vehicle.property-V3-ndk
+ android.hardware.automotive.vehicle.property-V4-ndk
diff --git a/automotive/vehicle/vts/Android.bp b/automotive/vehicle/vts/Android.bp
index 40aec59..433ac41 100644
--- a/automotive/vehicle/vts/Android.bp
+++ b/automotive/vehicle/vts/Android.bp
@@ -43,7 +43,7 @@
"vhalclient_defaults",
],
header_libs: [
- "IVehicleGeneratedHeaders-V3",
+ "IVehicleGeneratedHeaders-V4",
],
test_suites: [
"general-tests",
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayLuts.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayLuts.aidl
index 869db5b..327e84c 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayLuts.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayLuts.aidl
@@ -35,5 +35,9 @@
@VintfStability
parcelable DisplayLuts {
long display;
- android.hardware.graphics.composer3.Lut[] luts;
+ android.hardware.graphics.composer3.DisplayLuts.LayerLut[] layerLuts;
+ parcelable LayerLut {
+ long layer;
+ android.hardware.graphics.composer3.Lut lut;
+ }
}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Lut.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Lut.aidl
index 39245b5..5fae35b 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Lut.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Lut.aidl
@@ -34,7 +34,6 @@
package android.hardware.graphics.composer3;
@VintfStability
parcelable Lut {
- long layer;
@nullable ParcelFileDescriptor pfd;
android.hardware.graphics.composer3.LutProperties lutProperties;
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayLuts.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayLuts.aidl
index 56381e0..ac0a606 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayLuts.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayLuts.aidl
@@ -27,12 +27,20 @@
@VintfStability
parcelable DisplayLuts {
/**
- * The display which this commands refers to.
+ * The display which the layerLuts list is for.
*/
long display;
- /**
- * A Lut list specified by the HWC for given HDR layers that don't have Luts provided.
- */
- Lut[] luts;
+ parcelable LayerLut {
+ /**
+ * The layer that the HWC is requesting a LUT to be applied during GPU composition.
+ */
+ long layer;
+ /**
+ * A Lut specified by the HWC for given HDR layers that don't have Luts provided.
+ */
+ Lut lut;
+ }
+
+ LayerLut[] layerLuts;
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Lut.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Lut.aidl
index e4320f5..abfeb14 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/Lut.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Lut.aidl
@@ -28,11 +28,6 @@
@VintfStability
parcelable Lut {
/**
- * The layer which this commands refer to.
- */
- long layer;
-
- /**
* A handle to a memory region.
* If the file descriptor is not set, this means that the HWC doesn't specify a Lut.
*
diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h
index fc96882..331d717 100644
--- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h
+++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h
@@ -186,7 +186,7 @@
}
// Get the lut(s) requested by hardware composer.
- std::vector<Lut> takeDisplayLuts(int64_t display) {
+ std::vector<DisplayLuts::LayerLut> takeDisplayLuts(int64_t display) {
LOG_ALWAYS_FATAL_IF(mDisplay && display != *mDisplay);
auto found = mReturnData.find(display);
@@ -196,7 +196,7 @@
}
ReturnData& data = found->second;
- return std::move(data.luts);
+ return std::move(data.layerLuts);
}
private:
@@ -247,10 +247,11 @@
void parseSetDisplayLuts(DisplayLuts&& displayLuts) {
LOG_ALWAYS_FATAL_IF(mDisplay && displayLuts.display != *mDisplay);
auto& data = mReturnData[displayLuts.display];
- for (auto& lut : displayLuts.luts) {
- if (lut.pfd.get() >= 0) {
- data.luts.push_back({lut.layer, ndk::ScopedFileDescriptor(lut.pfd.release()),
- lut.lutProperties});
+ for (auto& layerLut : displayLuts.layerLuts) {
+ if (layerLut.lut.pfd.get() >= 0) {
+ data.layerLuts.push_back(
+ {layerLut.layer, Lut{ndk::ScopedFileDescriptor(layerLut.lut.pfd.release()),
+ layerLut.lut.lutProperties}});
}
}
}
@@ -266,7 +267,7 @@
.clientTargetProperty = {common::PixelFormat::RGBA_8888, Dataspace::UNKNOWN},
.brightness = 1.f,
};
- std::vector<Lut> luts;
+ std::vector<DisplayLuts::LayerLut> layerLuts;
};
std::vector<CommandError> mErrors;
diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
index a1ccbfe..02fb3aa 100644
--- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
+++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
@@ -30,6 +30,7 @@
#include <aidl/android/hardware/graphics/composer3/DisplayBrightness.h>
#include <aidl/android/hardware/graphics/composer3/LayerBrightness.h>
#include <aidl/android/hardware/graphics/composer3/LayerLifecycleBatchCommandType.h>
+#include <aidl/android/hardware/graphics/composer3/Lut.h>
#include <aidl/android/hardware/graphics/composer3/PerFrameMetadata.h>
#include <aidl/android/hardware/graphics/composer3/PerFrameMetadataBlob.h>
@@ -245,6 +246,15 @@
getLayerCommand(display, layer).blockingRegion.emplace(blocking.begin(), blocking.end());
}
+ void setLayerLuts(int64_t display, int64_t layer, std::vector<Lut>& luts) {
+ std::vector<std::optional<Lut>> currentLuts;
+ for (auto& lut : luts) {
+ currentLuts.push_back(std::make_optional<Lut>(
+ {ndk::ScopedFileDescriptor(lut.pfd.release()), lut.lutProperties}));
+ }
+ getLayerCommand(display, layer).luts.emplace(std::move(currentLuts));
+ }
+
std::vector<DisplayCommand> takePendingCommands() {
flushLayerCommand();
flushDisplayCommand();
diff --git a/health/aidl/default/corpus/seed-2024-08-29-0 b/health/aidl/default/corpus/seed-2024-08-29-0
new file mode 100644
index 0000000..07fd0e9
--- /dev/null
+++ b/health/aidl/default/corpus/seed-2024-08-29-0
Binary files differ
diff --git a/health/aidl/default/corpus/seed-2024-08-29-1 b/health/aidl/default/corpus/seed-2024-08-29-1
new file mode 100644
index 0000000..ef19735
--- /dev/null
+++ b/health/aidl/default/corpus/seed-2024-08-29-1
Binary files differ
diff --git a/health/aidl/default/corpus/seed-2024-08-29-2 b/health/aidl/default/corpus/seed-2024-08-29-2
new file mode 100644
index 0000000..76addb7
--- /dev/null
+++ b/health/aidl/default/corpus/seed-2024-08-29-2
Binary files differ
diff --git a/health/utils/libhealthloop/HealthLoop.cpp b/health/utils/libhealthloop/HealthLoop.cpp
index d43c2d5..c5ad5a8 100644
--- a/health/utils/libhealthloop/HealthLoop.cpp
+++ b/health/utils/libhealthloop/HealthLoop.cpp
@@ -43,6 +43,8 @@
namespace hardware {
namespace health {
+static constexpr uint32_t kUeventMsgLen = 2048;
+
HealthLoop::HealthLoop() {
InitHealthdConfig(&healthd_config_);
awake_poll_interval_ = -1;
@@ -61,14 +63,13 @@
EventHandler{this, fd, std::move(func)}))
.get();
- struct epoll_event ev;
-
- ev.events = EPOLLIN;
+ struct epoll_event ev = {
+ .events = EPOLLIN | EPOLLERR,
+ .data.ptr = reinterpret_cast<void*>(event_handler),
+ };
if (wakeup == EVENT_WAKEUP_FD) ev.events |= EPOLLWAKEUP;
- ev.data.ptr = reinterpret_cast<void*>(event_handler);
-
if (epoll_ctl(epollfd_, EPOLL_CTL_ADD, fd, &ev) == -1) {
KLOG_ERROR(LOG_TAG, "epoll_ctl failed; errno=%d\n", errno);
return -1;
@@ -121,32 +122,42 @@
ScheduleBatteryUpdate();
}
-#define UEVENT_MSG_LEN 2048
-void HealthLoop::UeventEvent(uint32_t /*epevents*/) {
- // No need to lock because uevent_fd_ is guaranteed to be initialized.
-
- char msg[UEVENT_MSG_LEN + 2];
- char* cp;
- int n;
-
- n = uevent_kernel_multicast_recv(uevent_fd_, msg, UEVENT_MSG_LEN);
- if (n <= 0) return;
- if (n >= UEVENT_MSG_LEN) /* overflow -- discard */
- return;
-
- msg[n] = '\0';
- msg[n + 1] = '\0';
- cp = msg;
-
- while (*cp) {
- if (!strcmp(cp, "SUBSYSTEM=power_supply")) {
- ScheduleBatteryUpdate();
- break;
+// Returns true if and only if the battery statistics should be updated.
+bool HealthLoop::RecvUevents() {
+ bool update_stats = false;
+ for (;;) {
+ char msg[kUeventMsgLen + 2];
+ int n = uevent_kernel_multicast_recv(uevent_fd_, msg, kUeventMsgLen);
+ if (n < 0 && errno == ENOBUFS) {
+ update_stats = true;
+ }
+ if (n <= 0) return update_stats;
+ if (n >= kUeventMsgLen) {
+ // too long -- discard
+ continue;
+ }
+ if (update_stats) {
+ continue;
}
- /* advance to after the next \0 */
- while (*cp++)
- ;
+ msg[n] = '\0';
+ msg[n + 1] = '\0';
+ for (char* cp = msg; *cp;) {
+ if (strcmp(cp, "SUBSYSTEM=power_supply") == 0) {
+ update_stats = true;
+ break;
+ }
+
+ /* advance to after the next \0 */
+ while (*cp++) {
+ }
+ }
+ }
+}
+
+void HealthLoop::UeventEvent(uint32_t /*epevents*/) {
+ if (RecvUevents()) {
+ ScheduleBatteryUpdate();
}
}
@@ -169,7 +180,7 @@
}
void HealthLoop::UeventInit(void) {
- uevent_fd_.reset(uevent_create_socket(64 * 1024, true));
+ uevent_fd_.reset(uevent_create_socket(kUeventMsgLen, true));
if (uevent_fd_ < 0) {
KLOG_ERROR(LOG_TAG, "uevent_init: uevent_open_socket failed\n");
@@ -183,9 +194,9 @@
std::string error_msg = attach_result.error().message();
error_msg +=
". This is expected in recovery mode and also for kernel versions before 5.10.";
- KLOG_WARNING(LOG_TAG, "%s", error_msg.c_str());
+ KLOG_WARNING(LOG_TAG, "%s\n", error_msg.c_str());
} else {
- KLOG_INFO(LOG_TAG, "Successfully attached the BPF filter to the uevent socket");
+ KLOG_INFO(LOG_TAG, "Successfully attached the BPF filter to the uevent socket\n");
}
if (RegisterEvent(uevent_fd_, &HealthLoop::UeventEvent, EVENT_WAKEUP_FD))
diff --git a/health/utils/libhealthloop/filterPowerSupplyEventsTest.cpp b/health/utils/libhealthloop/filterPowerSupplyEventsTest.cpp
index e885f0b..04b8bcd 100644
--- a/health/utils/libhealthloop/filterPowerSupplyEventsTest.cpp
+++ b/health/utils/libhealthloop/filterPowerSupplyEventsTest.cpp
@@ -192,16 +192,21 @@
bpf_object__close(obj);
}
+static constexpr char input0[] = "a";
+static constexpr char input1[] = "abc\0SUBSYSTEM=block\0";
+static constexpr char input2[] = "\0SUBSYSTEM=block";
+static constexpr char input3[] = "\0SUBSYSTEM=power_supply";
+static constexpr char input4[] = "\0SUBSYSTEM=power_supply\0";
+static constexpr char input5[] =
+ "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
+ "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
+ "012345678901234567890123456789012345678901234567890123456789\0SUBSYSTEM=block\0";
+
INSTANTIATE_TEST_SUITE_P(
filterPse, filterPseTest,
- testing::Values(test_data{false, "a"},
- test_data{true, std::string_view("abc\0SUBSYSTEM=block\0", 20)},
- test_data{true, std::string_view("\0SUBSYSTEM=block", 16)},
- test_data{true, std::string_view("\0SUBSYSTEM=power_supply", 23)},
- test_data{false, std::string_view("\0SUBSYSTEM=power_supply\0", 24)},
- test_data{
- false,
- "012345678901234567890123456789012345678901234567890123456789012345"
- "678901234567890123456789012345678901234567890123456789012345678901"
- "234567890123456789012345678901234567890123456789012345678901234567"
- "890123456789012345678901234567890123456789\0SUBSYSTEM=block\0"}));
+ testing::Values(test_data{false, std::string_view(input0, sizeof(input0) - 1)},
+ test_data{true, std::string_view(input1, sizeof(input1) - 1)},
+ test_data{true, std::string_view(input2, sizeof(input2) - 1)},
+ test_data{true, std::string_view(input3, sizeof(input3) - 1)},
+ test_data{false, std::string_view(input4, sizeof(input4) - 1)},
+ test_data{false, std::string_view(input5, sizeof(input5) - 1)}));
diff --git a/health/utils/libhealthloop/include/health/HealthLoop.h b/health/utils/libhealthloop/include/health/HealthLoop.h
index 1af7274..43c38dc 100644
--- a/health/utils/libhealthloop/include/health/HealthLoop.h
+++ b/health/utils/libhealthloop/include/health/HealthLoop.h
@@ -93,6 +93,7 @@
void WakeAlarmInit();
void WakeAlarmEvent(uint32_t);
void UeventInit();
+ bool RecvUevents();
void UeventEvent(uint32_t);
void WakeAlarmSetInterval(int interval);
void PeriodicChores();
diff --git a/radio/aidl/android/hardware/radio/config/IRadioConfig.aidl b/radio/aidl/android/hardware/radio/config/IRadioConfig.aidl
index 8f4dff4..936315c 100644
--- a/radio/aidl/android/hardware/radio/config/IRadioConfig.aidl
+++ b/radio/aidl/android/hardware/radio/config/IRadioConfig.aidl
@@ -17,9 +17,10 @@
* This interface is used by telephony and telecom to talk to cellular radio for the purpose of
* radio configuration, and it is not associated with any specific modem or slot.
* All the functions have minimum one parameter:
- * serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the
- * duration of a method call. If clients provide colliding serials (including passing the same
- * serial to different methods), multiple responses (one for each method call) must still be served.
+ * serial: which corresponds to the serial number of the request. Serial numbers must only be
+ * memorized for the duration of a method call. If clients provide colliding serials (including
+ * passing the same serial to different methods), multiple responses (one for each method call) must
+ * still be served.
*/
package android.hardware.radio.config;
@@ -108,12 +109,12 @@
/**
* Set preferred data modem Id.
- * In a multi-SIM device, notify modem layer which logical modem will be used primarily
- * for data. It helps modem with resource optimization and decisions of what data connections
- * should be satisfied.
+ * In a multi-SIM device, notify the modem layer which logical modem will be used primarily
+ * for data. It helps the modem with resource optimization and decisions of what data
+ * connections should be satisfied.
*
* @param serial Serial number of request.
- * @param modem Id the logical modem ID, which should match one of modem IDs returned
+ * @param modemId the logical modem ID which should match one of the modem IDs returned
* from getPhoneCapability().
*
* Response callback is IRadioConfigResponse.setPreferredDataModemResponse()
@@ -136,30 +137,30 @@
/**
* Set SIM Slot mapping.
*
- * Maps the logical slots to the SlotPortMapping which consist of both physical slot id and port
- * id. Logical slot is the slot that is seen by modem. Physical slot is the actual physical
- * slot. PortId is the id (enumerated value) for the associated port available on the SIM. Each
- * physical slot can have multiple ports which enables multi-enabled profile(MEP). If eUICC
- * physical slot supports 2 ports, then the portId is numbered 0,1 and if eUICC2 supports 4
- * ports then the portID is numbered 0,1,2,3. Each portId is unique within a UICC physical slot
- * but not necessarily unique across UICC’s. SEP(Single enabled profile) eUICC and non-eUICC
- * will only have portId 0.
+ * Maps the logical slots to the SlotPortMapping, which consists of both physical slot id and
+ * port id. Logical slot is the slot that is seen by the modem. Physical slot is the actual
+ * physical slot. PortId is the id (enumerated value) for the associated port available on the
+ * SIM. Each physical slot can have multiple ports, which enables multi-enabled profile(MEP). If
+ * eUICC physical slot supports 2 ports, then the portId is numbered 0,1 and if eUICC2 supports
+ * 4 ports then the portID is numbered 0,1,2,3. Each portId is unique within a UICC physical
+ * slot but not necessarily unique across UICC’s. SEP(Single enabled profile) eUICC and
+ * non-eUICC will only have portId 0.
*
* Logical slots that are already mapped to the requested SlotPortMapping are not impacted.
*
- * Example no. of logical slots 1 and physical slots 2 do not support MEP, each physical slot
- * has one port:
- * The only logical slot (index 0) can be mapped to first physical slot (value 0), port(index
- * 0). or second
- * physical slot(value 1), port (index 0), while the other physical slot remains unmapped and
- * inactive.
+ * Example: There is 1 logical slot, 2 physical slots, MEP is not supported and each physical
+ * slot has one port:
+ * The only logical slot (index 0) can be mapped to the first physical slot (value 0),
+ * port(index 0), or second physical slot(value 1), port (index 0), while the other physical
+ * slot remains unmapped and inactive.
* slotMap[0] = SlotPortMapping{0 //physical slot//, 0 //port//}
* slotMap[0] = SlotPortMapping{1 //physical slot//, 0 //port//}
*
- * Example no. of logical slots 2 and physical slots 2 supports MEP with 2 ports available:
- * Each logical slot must be mapped to a port (physical slot and port combination).
- * First logical slot (index 0) can be mapped to physical slot 1 and the second logical slot
- * can be mapped to either port from physical slot 2.
+ * Example: There are 2 logical slots, 2 physical slots, MEP is supported and there are 2 ports
+ * available:
+ * Each logical slot must be mapped to a port (physical slot and port combination). The first
+ * logical slot (index 0) can be mapped to the physical slot 1 and the second logical slot can
+ * be mapped to either port from physical slot 2.
*
* slotMap[0] = SlotPortMapping{0, 0} and slotMap[1] = SlotPortMapping{1, 0} or
* slotMap[0] = SlotPortMapping{0, 0} and slotMap[1] = SlotPortMapping{1, 1}
@@ -178,10 +179,10 @@
*
* @param serial Serial number of request
* @param slotMap Logical to physical slot and port mapping.
- * Index is mapping to logical slot and value to physical slot and port id, need to
- * provide all the slots mapping when sending request in case of multi slot device.
+ * The index maps to the logical slot, and the value to the physical slot and port id. In
+ * the case of a multi-slot device, provide all the slot mappings when sending a request.
*
- * EX: SlotPortMapping(physical slot, port id)
+ * Example: SlotPortMapping(physical slot, port id)
* index 0 is the first logical_slot number of logical slots is equal to number of Radio
* instances and number of physical slots is equal to size of slotStatus in
* getSimSlotsStatusResponse
diff --git a/radio/aidl/android/hardware/radio/config/IRadioConfigIndication.aidl b/radio/aidl/android/hardware/radio/config/IRadioConfigIndication.aidl
index 9eacb8e..0b60dbb 100644
--- a/radio/aidl/android/hardware/radio/config/IRadioConfigIndication.aidl
+++ b/radio/aidl/android/hardware/radio/config/IRadioConfigIndication.aidl
@@ -27,9 +27,9 @@
/**
* Indicates SIM slot status change.
*
- * This indication must be sent by the modem whenever there is any slot status change, even the
- * slot is inactive. For example, this indication must be triggered if a SIM card is inserted
- * into an inactive slot.
+ * This indication must be sent by the modem whenever there is any slot status change, even if
+ * the slot is inactive. For example, this indication must be triggered if a SIM card is
+ * inserted into an inactive slot.
*
* @param type Type of radio indication
* @param slotStatus new slot status info with size equals to the number of physical slots on
@@ -39,7 +39,7 @@
in android.hardware.radio.RadioIndicationType type, in SimSlotStatus[] slotStatus);
/**
- * The logical slots supporting simultaneous cellular calling has changed.
+ * The logical slots supporting simultaneous cellular calling have changed.
*
* @param enabledLogicalSlots The slots that have simultaneous cellular calling enabled. If
* there is a call active on logical slot X, then a simultaneous cellular call is only possible
diff --git a/radio/aidl/android/hardware/radio/config/IRadioConfigResponse.aidl b/radio/aidl/android/hardware/radio/config/IRadioConfigResponse.aidl
index 33b0ff0..8182cd1 100644
--- a/radio/aidl/android/hardware/radio/config/IRadioConfigResponse.aidl
+++ b/radio/aidl/android/hardware/radio/config/IRadioConfigResponse.aidl
@@ -26,18 +26,18 @@
@VintfStability
oneway interface IRadioConfigResponse {
/**
- * @param info Response info struct containing response type, serial no. and error
+ * @param info Response info struct containing response type, serial number and error
* @param modemReducedFeatureSet1 True indicates that the modem does NOT support the following
- * features.
- * - Providing either LinkCapacityEstimate:secondaryDownlinkCapacityKbps
- * or LinkCapacityEstimate:secondaryUplinkCapacityKbps when given from
- * RadioIndication:currentLinkCapacityEstimate
- * - Calling IRadio.setNrDualConnectivityState or querying
- * IRadio.isNrDualConnectivityEnabled
- * - Requesting IRadio.setDataThrottling()
- * - Providing SlicingConfig through getSlicingConfig()
+ * features:
+ * - Providing either LinkCapacityEstimate#secondaryDownlinkCapacityKbps
+ * or LinkCapacityEstimate#secondaryUplinkCapacityKbps when given from
+ * IRadioNetworkIndication#currentLinkCapacityEstimate
+ * - Calling IRadioNetwork#setNrDualConnectivityState or querying
+ * IRadioNetwork#isNrDualConnectivityEnabled
+ * - Requesting IRadioData#setDataThrottling
+ * - Providing SlicingConfig through IRadioData#getSlicingConfig
* - Providing PhysicalChannelConfig through
- * IRadioIndication.currentPhysicalChannelConfigs_1_6()
+ * IRadioNetworkIndication#currentPhysicalChannelConfigs
*
* Valid errors returned:
* RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony is not defined
@@ -49,7 +49,7 @@
in android.hardware.radio.RadioResponseInfo info, in boolean modemReducedFeatureSet1);
/**
- * @param info Response info struct containing response type, serial no. and error
+ * @param info Response info struct containing response type, serial number and error
* @param numOfLiveModems <byte> indicate the number of live modems i.e. modems that
* are enabled and actively working as part of a working connectivity stack
*
@@ -62,8 +62,8 @@
in android.hardware.radio.RadioResponseInfo info, in byte numOfLiveModems);
/**
- * @param info Response info struct containing response type, serial no. and error
- * @param phoneCapability <PhoneCapability> it defines modem's capability for example
+ * @param info Response info struct containing response type, serial number and error
+ * @param phoneCapability <PhoneCapability> it defines the modem's capability. For example,
* how many logical modems it has, how many data connections it supports.
*
* Valid errors returned:
@@ -76,7 +76,7 @@
in android.hardware.radio.RadioResponseInfo info, in PhoneCapability phoneCapability);
/**
- * @param info Response info struct containing response type, serial no. and error
+ * @param info Response info struct containing response type, serial number and error
* @param slotStatus Sim slot struct containing all the physical SIM slots info with size
* equal to the number of physical slots on the device
*
@@ -93,7 +93,7 @@
in android.hardware.radio.RadioResponseInfo info, in SimSlotStatus[] slotStatus);
/**
- * @param info Response info struct containing response type, serial no. and error
+ * @param info Response info struct containing response type, serial number and error
*
* Valid errors returned:
* RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony is not defined
@@ -104,7 +104,7 @@
void setNumOfLiveModemsResponse(in android.hardware.radio.RadioResponseInfo info);
/**
- * @param info Response info struct containing response type, serial no. and error
+ * @param info Response info struct containing response type, serial number and error
*
* Valid errors returned:
* RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.data is not defined
@@ -116,7 +116,7 @@
void setPreferredDataModemResponse(in android.hardware.radio.RadioResponseInfo info);
/**
- * @param info Response info struct containing response type, serial no. and error
+ * @param info Response info struct containing response type, serial number and error
*
* Valid errors returned:
* RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not
@@ -134,7 +134,7 @@
* Response to the asynchronous
* {@link IRadioConfig#getSimultaneousCallingSupport} request.
*
- * @param info Response info struct containing response type, serial no. and error
+ * @param info Response info struct containing response type, serial number and error
* @param enabledLogicalSlots The slots that have simultaneous cellular calling enabled. If
* there is a call active on logical slot X, then a simultaneous cellular call is only possible
* on logical slot Y if BOTH slot X and slot Y are in enabledLogicalSlots. If simultaneous
diff --git a/radio/aidl/android/hardware/radio/config/PhoneCapability.aidl b/radio/aidl/android/hardware/radio/config/PhoneCapability.aidl
index 7936eb6..265ab96 100644
--- a/radio/aidl/android/hardware/radio/config/PhoneCapability.aidl
+++ b/radio/aidl/android/hardware/radio/config/PhoneCapability.aidl
@@ -17,8 +17,8 @@
package android.hardware.radio.config;
/**
- * Phone capability which describes the data connection capability of modem.
- * It's used to evaluate possible phone config change, for example from single
+ * Phone capability which describes the data connection capability of the modem.
+ * It's used to evaluate a possible phone config change, for example, from single
* SIM device to multi-SIM device.
* @hide
*/
@@ -27,21 +27,18 @@
parcelable PhoneCapability {
const byte UNKNOWN = -1;
/**
- * maxActiveData defines how many logical modems can have
- * PS attached simultaneously. For example, for L+L modem it
- * should be 2.
+ * maxActiveData defines how many logical modems can have PS attached simultaneously. For
+ * example, for a L+L modem, it should be 2.
*/
byte maxActiveData;
/**
- * maxActiveData defines how many logical modems can have
- * internet PDN connections simultaneously. For example, for L+L
- * DSDS modem it’s 1, and for DSDA modem it’s 2.
+ * maxActiveInternetData defines how many logical modems can have internet PDN connections
+ * simultaneously. For example, for a L+L DSDS modem, it’s 1, and for a DSDA modem, it’s 2.
*/
byte maxActiveInternetData;
/**
- * Whether modem supports both internet PDN up so
- * that we can do ping test before tearing down the
- * other one.
+ * Whether the modem supports both internet PDNs up, so that we can do a ping test on one PDN
+ * before tearing down the other PDN.
*/
boolean isInternetLingeringSupported;
/**
@@ -49,9 +46,8 @@
*/
byte[] logicalModemIds;
/**
- * maxActiveVoice defines how many logical modems can have
- * cellular voice calls simultaneously. For example, for cellular DSDA
- * with simultaneous calling support, it should be 2.
+ * maxActiveVoice defines how many logical modems can have cellular voice calls simultaneously.
+ * For example, for cellular DSDA with simultaneous calling support, it should be 2.
*/
byte maxActiveVoice = UNKNOWN;
}
diff --git a/radio/aidl/android/hardware/radio/config/SimPortInfo.aidl b/radio/aidl/android/hardware/radio/config/SimPortInfo.aidl
index f579639..380932e 100644
--- a/radio/aidl/android/hardware/radio/config/SimPortInfo.aidl
+++ b/radio/aidl/android/hardware/radio/config/SimPortInfo.aidl
@@ -21,8 +21,8 @@
@JavaDerive(toString=true)
parcelable SimPortInfo {
/**
- * Integrated Circuit Card IDentifier (ICCID) is unique identifier of the SIM card. File is
- * located in the SIM card at EFiccid (0x2FE2) as per ETSI 102.221. The ICCID is defined by
+ * Integrated Circuit Card IDentifier (ICCID) is the unique identifier of the SIM card. The file
+ * is located in the SIM card at EFiccid (0x2FE2) as per ETSI 102.221. The ICCID is defined by
* the ITU-T recommendation E.118 ISO/IEC 7816.
*
* This data is applicable only when cardState is CardStatus.STATE_PRESENT.
@@ -33,13 +33,13 @@
*/
String iccId;
/**
- * Logical slot id is identifier of the active slot
+ * The identifier of the active slot.
*/
int logicalSlotId;
/**
* Port active status in the slot.
- * Inactive means logical modem is no longer associated to the port.
- * Active means logical modem is associated to the port.
+ * Inactive means that the logical modem is no longer associated to the port.
+ * Active means that the logical modem is associated to the port.
*/
boolean portActive;
}
diff --git a/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl b/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl
index 34f98c5..171d97a 100644
--- a/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl
+++ b/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl
@@ -46,12 +46,12 @@
String eid;
/**
* PortInfo contains the ICCID, logical slot ID, and port state.
- * Cardstate has no relationship with whether the slot is active or inactive. Should always
- * report up at least 1 port otherwise the logicalSlotIndex and portActive info will be lost.
+ * Cardstate has no relationship with whether the slot is active or inactive. At least one port
+ * shall always be reported, otherwise the logicalSlotIndex and portActive info will be lost.
* For example, the pSIM can be removed, but the slot can still be active. In that case, the
* SIM_STATUS reported for the corresponding logical stack will show CARDSTATE_ABSENT.
- * Similarly, even if there is no profile enabled on the eSIM, that port can still be the
- * active port in the slot mapping.
+ * Similarly, even if there is no profile enabled on the eSIM, that port can still be the active
+ * port in the slot mapping.
*/
SimPortInfo[] portInfo;
/**
diff --git a/radio/aidl/vts/radio_sim_test.cpp b/radio/aidl/vts/radio_sim_test.cpp
index 9d1c356..6ffe2c5 100644
--- a/radio/aidl/vts/radio_sim_test.cpp
+++ b/radio/aidl/vts/radio_sim_test.cpp
@@ -531,7 +531,7 @@
EXPECT_EQ(RadioError::NONE, radioRsp_sim->rspInfo.error);
if (aidl_version <= 2) {
- EXPECT_EQ(1, radioRsp_sim->carrierRestrictionsResp.allowedCarriers.size());
+ ASSERT_EQ(1, radioRsp_sim->carrierRestrictionsResp.allowedCarriers.size());
EXPECT_EQ(0, radioRsp_sim->carrierRestrictionsResp.excludedCarriers.size());
ASSERT_TRUE(std::string("123") ==
@@ -543,7 +543,7 @@
ASSERT_TRUE(radioRsp_sim->carrierRestrictionsResp.allowedCarriersPrioritized);
EXPECT_EQ(SimLockMultiSimPolicy::NO_MULTISIM_POLICY, radioRsp_sim->multiSimPolicyResp);
} else {
- EXPECT_EQ(1, radioRsp_sim->carrierRestrictionsResp.allowedCarrierInfoList.size());
+ ASSERT_EQ(1, radioRsp_sim->carrierRestrictionsResp.allowedCarrierInfoList.size());
EXPECT_EQ(0, radioRsp_sim->carrierRestrictionsResp.excludedCarrierInfoList.size());
ASSERT_TRUE(std::string("321") ==
radioRsp_sim->carrierRestrictionsResp.allowedCarrierInfoList[0].mcc);
diff --git a/security/keymint/aidl/default/Android.bp b/security/keymint/aidl/default/Android.bp
index fbb6140..22a46ed 100644
--- a/security/keymint/aidl/default/Android.bp
+++ b/security/keymint/aidl/default/Android.bp
@@ -7,6 +7,24 @@
default_applicable_licenses: ["hardware_interfaces_license"],
}
+vintf_fragment {
+ name: "android.hardware.security.keymint-service.xml",
+ src: "android.hardware.security.keymint-service.xml",
+ vendor: true,
+}
+
+vintf_fragment {
+ name: "android.hardware.security.sharedsecret-service.xml",
+ src: "android.hardware.security.sharedsecret-service.xml",
+ vendor: true,
+}
+
+vintf_fragment {
+ name: "android.hardware.security.secureclock-service.xml",
+ src: "android.hardware.security.secureclock-service.xml",
+ vendor: true,
+}
+
// The following target has an insecure implementation of KeyMint where the
// trusted application (TA) code runs in-process alongside the HAL service
// code.
@@ -18,11 +36,6 @@
name: "android.hardware.security.keymint-service",
relative_install_path: "hw",
init_rc: ["android.hardware.security.keymint-service.rc"],
- vintf_fragments: [
- "android.hardware.security.keymint-service.xml",
- "android.hardware.security.sharedsecret-service.xml",
- "android.hardware.security.secureclock-service.xml",
- ],
vendor: true,
cflags: [
"-Wall",
@@ -51,6 +64,11 @@
required: [
"android.hardware.hardware_keystore.xml",
],
+ vintf_fragment_modules: [
+ "android.hardware.security.keymint-service.xml",
+ "android.hardware.security.sharedsecret-service.xml",
+ "android.hardware.security.secureclock-service.xml",
+ ],
}
// The following target has an insecure implementation of KeyMint where the
@@ -65,11 +83,6 @@
relative_install_path: "hw",
vendor: true,
init_rc: ["android.hardware.security.keymint-service.nonsecure.rc"],
- vintf_fragments: [
- "android.hardware.security.keymint-service.xml",
- "android.hardware.security.sharedsecret-service.xml",
- "android.hardware.security.secureclock-service.xml",
- ],
defaults: [
"keymint_use_latest_hal_aidl_rust",
],
@@ -87,6 +100,11 @@
required: [
"android.hardware.hardware_keystore.xml",
],
+ vintf_fragment_modules: [
+ "android.hardware.security.keymint-service.xml",
+ "android.hardware.security.sharedsecret-service.xml",
+ "android.hardware.security.secureclock-service.xml",
+ ],
}
prebuilt_etc {
diff --git a/security/keymint/support/include/remote_prov/remote_prov_utils.h b/security/keymint/support/include/remote_prov/remote_prov_utils.h
index 1d7db6a..b7c32ca 100644
--- a/security/keymint/support/include/remote_prov/remote_prov_utils.h
+++ b/security/keymint/support/include/remote_prov/remote_prov_utils.h
@@ -167,7 +167,8 @@
const DeviceInfo& deviceInfo, const cppbor::Array& keysToSign,
const std::vector<uint8_t>& keysToSignMac, const ProtectedData& protectedData,
const EekChain& eekChain, const std::vector<uint8_t>& eekId, int32_t supportedEekCurve,
- IRemotelyProvisionedComponent* provisionable, const std::vector<uint8_t>& challenge);
+ IRemotelyProvisionedComponent* provisionable, const std::vector<uint8_t>& challenge,
+ bool allowAnyMode = false);
/**
* Verify the CSR as if the device is still early in the factory process and may not
@@ -181,7 +182,8 @@
*/
ErrMsgOr<std::unique_ptr<cppbor::Array>> verifyProductionCsr(
const cppbor::Array& keysToSign, const std::vector<uint8_t>& csr,
- IRemotelyProvisionedComponent* provisionable, const std::vector<uint8_t>& challenge);
+ IRemotelyProvisionedComponent* provisionable, const std::vector<uint8_t>& challenge,
+ bool allowAnyMode = false);
/** Checks whether the CSR has a proper DICE chain. */
ErrMsgOr<bool> isCsrWithProperDiceChain(const std::vector<uint8_t>& csr);
diff --git a/security/keymint/support/remote_prov_utils.cpp b/security/keymint/support/remote_prov_utils.cpp
index 29124af..646037c 100644
--- a/security/keymint/support/remote_prov_utils.cpp
+++ b/security/keymint/support/remote_prov_utils.cpp
@@ -325,9 +325,16 @@
}
ErrMsgOr<std::vector<BccEntryData>> validateBcc(const cppbor::Array* bcc,
- hwtrust::DiceChain::Kind kind) {
+ hwtrust::DiceChain::Kind kind, bool allowAnyMode) {
auto encodedBcc = bcc->encode();
- auto chain = hwtrust::DiceChain::Verify(encodedBcc, kind);
+
+ // Use ro.build.type instead of ro.debuggable because ro.debuggable=1 for VTS testing
+ std::string build_type = ::android::base::GetProperty("ro.build.type", "");
+ if (!build_type.empty() && build_type != "user") {
+ allowAnyMode = true;
+ }
+
+ auto chain = hwtrust::DiceChain::Verify(encodedBcc, kind, allowAnyMode);
if (!chain.ok()) return chain.error().message();
auto keys = chain->CosePublicKeys();
if (!keys.ok()) return keys.error().message();
@@ -638,7 +645,7 @@
const std::vector<uint8_t>& keysToSignMac, const ProtectedData& protectedData,
const EekChain& eekChain, const std::vector<uint8_t>& eekId, int32_t supportedEekCurve,
IRemotelyProvisionedComponent* provisionable, const std::vector<uint8_t>& challenge,
- bool isFactory) {
+ bool isFactory, bool allowAnyMode = false) {
auto [parsedProtectedData, _, protDataErrMsg] = cppbor::parse(protectedData.protectedData);
if (!parsedProtectedData) {
return protDataErrMsg;
@@ -694,7 +701,7 @@
}
// BCC is [ pubkey, + BccEntry]
- auto bccContents = validateBcc(bcc->asArray(), hwtrust::DiceChain::Kind::kVsr13);
+ auto bccContents = validateBcc(bcc->asArray(), hwtrust::DiceChain::Kind::kVsr13, allowAnyMode);
if (!bccContents) {
return bccContents.message() + "\n" + prettyPrint(bcc.get());
}
@@ -747,10 +754,11 @@
const DeviceInfo& deviceInfo, const cppbor::Array& keysToSign,
const std::vector<uint8_t>& keysToSignMac, const ProtectedData& protectedData,
const EekChain& eekChain, const std::vector<uint8_t>& eekId, int32_t supportedEekCurve,
- IRemotelyProvisionedComponent* provisionable, const std::vector<uint8_t>& challenge) {
+ IRemotelyProvisionedComponent* provisionable, const std::vector<uint8_t>& challenge,
+ bool allowAnyMode) {
return verifyProtectedData(deviceInfo, keysToSign, keysToSignMac, protectedData, eekChain,
eekId, supportedEekCurve, provisionable, challenge,
- /*isFactory=*/false);
+ /*isFactory=*/false, allowAnyMode);
}
ErrMsgOr<X509_Ptr> parseX509Cert(const std::vector<uint8_t>& cert) {
@@ -988,7 +996,8 @@
}
ErrMsgOr<bytevec> parseAndValidateAuthenticatedRequest(const std::vector<uint8_t>& request,
- const std::vector<uint8_t>& challenge) {
+ const std::vector<uint8_t>& challenge,
+ bool allowAnyMode = false) {
auto [parsedRequest, _, csrErrMsg] = cppbor::parse(request);
if (!parsedRequest) {
return csrErrMsg;
@@ -1026,7 +1035,7 @@
return diceChainKind.message();
}
- auto diceContents = validateBcc(diceCertChain, *diceChainKind);
+ auto diceContents = validateBcc(diceCertChain, *diceChainKind, allowAnyMode);
if (!diceContents) {
return diceContents.message() + "\n" + prettyPrint(diceCertChain);
}
@@ -1055,7 +1064,7 @@
const std::vector<uint8_t>& csr,
IRemotelyProvisionedComponent* provisionable,
const std::vector<uint8_t>& challenge,
- bool isFactory) {
+ bool isFactory, bool allowAnyMode = false) {
RpcHardwareInfo info;
provisionable->getHardwareInfo(&info);
if (info.versionNumber != 3) {
@@ -1063,7 +1072,7 @@
") does not match expected version (3).";
}
- auto csrPayload = parseAndValidateAuthenticatedRequest(csr, challenge);
+ auto csrPayload = parseAndValidateAuthenticatedRequest(csr, challenge, allowAnyMode);
if (!csrPayload) {
return csrPayload.message();
}
@@ -1079,8 +1088,9 @@
ErrMsgOr<std::unique_ptr<cppbor::Array>> verifyProductionCsr(
const cppbor::Array& keysToSign, const std::vector<uint8_t>& csr,
- IRemotelyProvisionedComponent* provisionable, const std::vector<uint8_t>& challenge) {
- return verifyCsr(keysToSign, csr, provisionable, challenge, /*isFactory=*/false);
+ IRemotelyProvisionedComponent* provisionable, const std::vector<uint8_t>& challenge,
+ bool allowAnyMode) {
+ return verifyCsr(keysToSign, csr, provisionable, challenge, /*isFactory=*/false, allowAnyMode);
}
ErrMsgOr<bool> isCsrWithProperDiceChain(const std::vector<uint8_t>& csr) {
@@ -1114,7 +1124,8 @@
}
auto encodedDiceChain = diceCertChain->encode();
- auto chain = hwtrust::DiceChain::Verify(encodedDiceChain, *diceChainKind);
+ auto chain =
+ hwtrust::DiceChain::Verify(encodedDiceChain, *diceChainKind, /*allowAnyMode=*/false);
if (!chain.ok()) return chain.error().message();
return chain->IsProper();
}
diff --git a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
index 2dbc73f..f68ff91 100644
--- a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
+++ b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
@@ -188,7 +188,8 @@
}
ASSERT_NE(provisionable_, nullptr);
auto status = provisionable_->getHardwareInfo(&rpcHardwareInfo);
- if (GetParam() == RKP_VM_INSTANCE_NAME) {
+ isRkpVmInstance_ = GetParam() == RKP_VM_INSTANCE_NAME;
+ if (isRkpVmInstance_) {
if (status.getExceptionCode() == EX_UNSUPPORTED_OPERATION) {
GTEST_SKIP() << "The RKP VM is not supported on this system.";
}
@@ -209,6 +210,7 @@
protected:
std::shared_ptr<IRemotelyProvisionedComponent> provisionable_;
RpcHardwareInfo rpcHardwareInfo;
+ bool isRkpVmInstance_;
};
/**
@@ -765,7 +767,8 @@
provisionable_->generateCertificateRequestV2({} /* keysToSign */, challenge, &csr);
ASSERT_TRUE(status.isOk()) << status.getDescription();
- auto result = verifyProductionCsr(cppbor::Array(), csr, provisionable_.get(), challenge);
+ auto result = verifyProductionCsr(cppbor::Array(), csr, provisionable_.get(), challenge,
+ isRkpVmInstance_);
ASSERT_TRUE(result) << result.message();
}
}
@@ -786,7 +789,8 @@
auto status = provisionable_->generateCertificateRequestV2(keysToSign_, challenge, &csr);
ASSERT_TRUE(status.isOk()) << status.getDescription();
- auto result = verifyProductionCsr(cborKeysToSign_, csr, provisionable_.get(), challenge);
+ auto result = verifyProductionCsr(cborKeysToSign_, csr, provisionable_.get(), challenge,
+ isRkpVmInstance_);
ASSERT_TRUE(result) << result.message();
}
}
@@ -816,13 +820,15 @@
auto status = provisionable_->generateCertificateRequestV2(keysToSign_, challenge_, &csr);
ASSERT_TRUE(status.isOk()) << status.getDescription();
- auto firstCsr = verifyProductionCsr(cborKeysToSign_, csr, provisionable_.get(), challenge_);
+ auto firstCsr = verifyProductionCsr(cborKeysToSign_, csr, provisionable_.get(), challenge_,
+ isRkpVmInstance_);
ASSERT_TRUE(firstCsr) << firstCsr.message();
status = provisionable_->generateCertificateRequestV2(keysToSign_, challenge_, &csr);
ASSERT_TRUE(status.isOk()) << status.getDescription();
- auto secondCsr = verifyProductionCsr(cborKeysToSign_, csr, provisionable_.get(), challenge_);
+ auto secondCsr = verifyProductionCsr(cborKeysToSign_, csr, provisionable_.get(), challenge_,
+ isRkpVmInstance_);
ASSERT_TRUE(secondCsr) << secondCsr.message();
ASSERT_EQ(**firstCsr, **secondCsr);
@@ -840,7 +846,8 @@
auto status = provisionable_->generateCertificateRequestV2(keysToSign_, challenge_, &csr);
ASSERT_TRUE(status.isOk()) << status.getDescription();
- auto result = verifyProductionCsr(cborKeysToSign_, csr, provisionable_.get(), challenge_);
+ auto result = verifyProductionCsr(cborKeysToSign_, csr, provisionable_.get(), challenge_,
+ isRkpVmInstance_);
ASSERT_TRUE(result) << result.message();
}
diff --git a/tv/tuner/aidl/default/Android.bp b/tv/tuner/aidl/default/Android.bp
index 5dbc7f6..a76a653 100644
--- a/tv/tuner/aidl/default/Android.bp
+++ b/tv/tuner/aidl/default/Android.bp
@@ -10,7 +10,6 @@
cc_defaults {
name: "tuner_hal_example_defaults",
relative_install_path: "hw",
- vintf_fragments: ["tuner-default.xml"],
vendor: true,
compile_multilib: "first",
srcs: [
@@ -43,6 +42,15 @@
header_libs: [
"media_plugin_headers",
],
+ vintf_fragment_modules: [
+ "tuner-default.xml",
+ ],
+}
+
+vintf_fragment {
+ name: "tuner-default.xml",
+ src: "tuner-default.xml",
+ vendor: true,
}
cc_binary {
diff --git a/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp b/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp
index 33e8660..bc017ae 100644
--- a/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp
+++ b/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp
@@ -1053,59 +1053,62 @@
}
TEST_P(VibratorAidl, PwleV2FrequencyToOutputAccelerationMapHasValidFrequencyRange) {
+ if (!(capabilities & IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2)) {
+ GTEST_SKIP() << "PWLE V2 not supported, skipping test";
+ return;
+ }
+
std::vector<PwleV2OutputMapEntry> frequencyToOutputAccelerationMap;
ndk::ScopedAStatus status =
vibrator->getPwleV2FrequencyToOutputAccelerationMap(&frequencyToOutputAccelerationMap);
- if (capabilities & IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2) {
- EXPECT_OK(std::move(status));
- ASSERT_FALSE(frequencyToOutputAccelerationMap.empty());
- auto sharpnessRange =
- pwle_v2_utils::getPwleV2SharpnessRange(vibrator, frequencyToOutputAccelerationMap);
- // Validate the curve provides a usable sharpness range, which is a range of frequencies
- // that are supported by the device.
- ASSERT_TRUE(sharpnessRange.first >= 0);
- // Validate that the sharpness range is a valid interval, not a single point.
- ASSERT_TRUE(sharpnessRange.first < sharpnessRange.second);
- } else {
- EXPECT_UNKNOWN_OR_UNSUPPORTED(std::move(status));
- }
+ EXPECT_OK(std::move(status));
+ ASSERT_FALSE(frequencyToOutputAccelerationMap.empty());
+ auto sharpnessRange =
+ pwle_v2_utils::getPwleV2SharpnessRange(vibrator, frequencyToOutputAccelerationMap);
+ // Validate the curve provides a usable sharpness range, which is a range of frequencies
+ // that are supported by the device.
+ ASSERT_TRUE(sharpnessRange.first >= 0);
+ // Validate that the sharpness range is a valid interval, not a single point.
+ ASSERT_TRUE(sharpnessRange.first < sharpnessRange.second);
}
TEST_P(VibratorAidl, GetPwleV2PrimitiveDurationMaxMillis) {
+ if (!(capabilities & IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2)) {
+ GTEST_SKIP() << "PWLE V2 not supported, skipping test";
+ return;
+ }
+
int32_t durationMs;
ndk::ScopedAStatus status = vibrator->getPwleV2PrimitiveDurationMaxMillis(&durationMs);
- if (capabilities & IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2) {
- EXPECT_OK(std::move(status));
- ASSERT_GT(durationMs, 0); // Ensure greater than zero
- ASSERT_GE(durationMs,
- pwle_v2_utils::COMPOSE_PWLE_V2_MIN_REQUIRED_PRIMITIVE_MAX_DURATION_MS);
- } else {
- EXPECT_UNKNOWN_OR_UNSUPPORTED(std::move(status));
- }
+ EXPECT_OK(std::move(status));
+ ASSERT_GT(durationMs, 0); // Ensure greater than zero
+ ASSERT_GE(durationMs, pwle_v2_utils::COMPOSE_PWLE_V2_MIN_REQUIRED_PRIMITIVE_MAX_DURATION_MS);
}
TEST_P(VibratorAidl, GetPwleV2CompositionSizeMax) {
+ if (!(capabilities & IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2)) {
+ GTEST_SKIP() << "PWLE V2 not supported, skipping test";
+ return;
+ }
+
int32_t maxSize;
ndk::ScopedAStatus status = vibrator->getPwleV2CompositionSizeMax(&maxSize);
- if (capabilities & IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2) {
- EXPECT_OK(std::move(status));
- ASSERT_GT(maxSize, 0); // Ensure greater than zero
- ASSERT_GE(maxSize, pwle_v2_utils::COMPOSE_PWLE_V2_MIN_REQUIRED_SIZE);
- } else {
- EXPECT_UNKNOWN_OR_UNSUPPORTED(std::move(status));
- }
+ EXPECT_OK(std::move(status));
+ ASSERT_GT(maxSize, 0); // Ensure greater than zero
+ ASSERT_GE(maxSize, pwle_v2_utils::COMPOSE_PWLE_V2_MIN_REQUIRED_SIZE);
}
TEST_P(VibratorAidl, GetPwleV2PrimitiveDurationMinMillis) {
+ if (!(capabilities & IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2)) {
+ GTEST_SKIP() << "PWLE V2 not supported, skipping test";
+ return;
+ }
+
int32_t durationMs;
ndk::ScopedAStatus status = vibrator->getPwleV2PrimitiveDurationMinMillis(&durationMs);
- if (capabilities & IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2) {
- EXPECT_OK(std::move(status));
- ASSERT_GT(durationMs, 0); // Ensure greater than zero
- ASSERT_LE(durationMs, pwle_v2_utils::COMPOSE_PWLE_V2_MAX_ALLOWED_PRIMITIVE_MIN_DURATION_MS);
- } else {
- EXPECT_UNKNOWN_OR_UNSUPPORTED(std::move(status));
- }
+ EXPECT_OK(std::move(status));
+ ASSERT_GT(durationMs, 0); // Ensure greater than zero
+ ASSERT_LE(durationMs, pwle_v2_utils::COMPOSE_PWLE_V2_MAX_ALLOWED_PRIMITIVE_MIN_DURATION_MS);
}
TEST_P(VibratorAidl, ComposeValidPwleV2Effect) {
@@ -1125,8 +1128,10 @@
}
if (capabilities & IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2) return;
- EXPECT_UNKNOWN_OR_UNSUPPORTED(
- vibrator->composePwleV2(pwle_v2_utils::composeValidPwleV2Effect(vibrator), nullptr));
+ std::vector<PwleV2Primitive> pwleEffect{
+ PwleV2Primitive(/*amplitude=*/1.0f, /*frequencyHz=*/100.0f, /*timeMillis=*/50)};
+
+ EXPECT_UNKNOWN_OR_UNSUPPORTED(vibrator->composePwleV2(pwleEffect, nullptr));
}
TEST_P(VibratorAidl, ComposeValidPwleV2EffectWithCallback) {
diff --git a/vibrator/aidl/vts/pwle_v2_utils.h b/vibrator/aidl/vts/pwle_v2_utils.h
index feb8790..2163908 100644
--- a/vibrator/aidl/vts/pwle_v2_utils.h
+++ b/vibrator/aidl/vts/pwle_v2_utils.h
@@ -120,6 +120,11 @@
EXPECT_OK(
vibrator->getPwleV2FrequencyToOutputAccelerationMap(&frequencyToOutputAccelerationMap));
EXPECT_TRUE(!frequencyToOutputAccelerationMap.empty());
+ // We can't use ASSERT_TRUE() above because this is a non-void function,
+ // but we need to return to assure we don't crash from a null dereference.
+ if (frequencyToOutputAccelerationMap.empty()) {
+ return std::numeric_limits<float>::quiet_NaN();
+ }
auto entry = std::min_element(
frequencyToOutputAccelerationMap.begin(), frequencyToOutputAccelerationMap.end(),
@@ -133,6 +138,11 @@
EXPECT_OK(
vibrator->getPwleV2FrequencyToOutputAccelerationMap(&frequencyToOutputAccelerationMap));
EXPECT_TRUE(!frequencyToOutputAccelerationMap.empty());
+ // We can't use ASSERT_TRUE() above because this is a non-void function,
+ // but we need to return to assure we don't crash from a null dereference.
+ if (frequencyToOutputAccelerationMap.empty()) {
+ return std::numeric_limits<float>::quiet_NaN();
+ }
auto entry = std::max_element(
frequencyToOutputAccelerationMap.begin(), frequencyToOutputAccelerationMap.end(),
diff --git a/weaver/vts/VtsHalWeaverTargetTest.cpp b/weaver/vts/VtsHalWeaverTargetTest.cpp
index 40e9558..8952dfc 100644
--- a/weaver/vts/VtsHalWeaverTargetTest.cpp
+++ b/weaver/vts/VtsHalWeaverTargetTest.cpp
@@ -221,7 +221,10 @@
}
}
// Starting in Android 14, the system will always use at least one Weaver slot if Weaver is
- // supported at all. Make sure we saw at least one.
+ // supported at all. This is true even if an LSKF hasn't been set yet, since Weaver is used to
+ // protect the initial binding of each user's synthetic password to ensure that binding can be
+ // securely deleted if an LSKF is set later. Make sure we saw at least one slot, as otherwise
+ // the Weaver implementation must have a bug that makes it not fully usable by Android.
ASSERT_FALSE(used_slots.empty())
<< "Could not determine which Weaver slots are in use by the system";
diff --git a/wifi/aidl/default/Android.bp b/wifi/aidl/default/Android.bp
index 2047807..3fcb77f 100644
--- a/wifi/aidl/default/Android.bp
+++ b/wifi/aidl/default/Android.bp
@@ -112,9 +112,14 @@
export_include_dirs: ["."],
}
+vintf_fragment {
+ name: "android.hardware.wifi-service.xml",
+ src: "android.hardware.wifi-service.xml",
+ vendor: true,
+}
+
cc_binary {
name: "android.hardware.wifi-service",
- vintf_fragments: ["android.hardware.wifi-service.xml"],
relative_install_path: "hw",
proprietary: true,
cppflags: [
@@ -137,11 +142,11 @@
],
static_libs: ["android.hardware.wifi-service-lib"],
init_rc: ["android.hardware.wifi-service.rc"],
+ vintf_fragment_modules: ["android.hardware.wifi-service.xml"],
}
cc_binary {
name: "android.hardware.wifi-service-lazy",
- vintf_fragments: ["android.hardware.wifi-service.xml"],
overrides: ["android.hardware.wifi-service"],
cflags: ["-DLAZY_SERVICE"],
relative_install_path: "hw",
@@ -166,6 +171,7 @@
],
static_libs: ["android.hardware.wifi-service-lib"],
init_rc: ["android.hardware.wifi-service-lazy.rc"],
+ vintf_fragment_modules: ["android.hardware.wifi-service.xml"],
}
cc_test {