diff options
author | Chris Gross <chrisgross@google.com> | 2021-05-19 11:39:07 -0700 |
---|---|---|
committer | Chris Gross <chrisgross@google.com> | 2021-05-19 11:39:07 -0700 |
commit | a01a9128380dad45a28f4740a57136a058eb9d12 (patch) | |
tree | bc23fb815c7ca1da5c47c38ec75859572b1c2fbd | |
parent | 7c8e6a102c7b41e35d85931a8aaf445359ccd0c3 (diff) | |
parent | fd795fe35563951f2a34471acc5d745866843b0f (diff) |
Merge SP1A.210513.004
Change-Id: I8ff902b999e3f6515f1a51c85c14bc91a0037204
20 files changed, 158 insertions, 58 deletions
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h index abf33a3f46..81f31987e0 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h @@ -1245,6 +1245,7 @@ const ConfigDeclaration kVehicleProperties[]{ .access = VehiclePropertyAccess::READ, .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, + .initialValue = {.int32Values = {0 /* ClusterHome */, -1 /* ClusterNone */}}, }, { .config = @@ -1253,6 +1254,8 @@ const ConfigDeclaration kVehicleProperties[]{ .access = VehiclePropertyAccess::READ, .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, + .initialValue = {.int32Values = {0 /* Off */, -1, -1, -1, -1 /* Bounds */, + -1, -1, -1, -1 /* Insets */}}, }, { .config = @@ -1305,6 +1308,9 @@ const ConfigDeclaration kVehicleProperties[]{ .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .configArray = {0, 0, 0, 11, 0, 0, 0, 0, 16}, }, + .initialValue = {.int32Values = {0 /* Off */, -1, -1, -1, -1 /* Bounds */, + -1, -1, -1, -1 /* Insets */, + 0 /* ClusterHome */, -1 /* ClusterNone */}}, }, { .config = @@ -1313,6 +1319,7 @@ const ConfigDeclaration kVehicleProperties[]{ .access = VehiclePropertyAccess::READ, .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, + .initialValue = {.int32Values = {0 /* ClusterHome */}}, }, { .config = diff --git a/biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp b/biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp index c548fe5bfb..84433364df 100644 --- a/biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp +++ b/biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp @@ -40,8 +40,7 @@ TEST(WorkerThreadTest, ScheduleReturnsTrueWhenQueueHasSpace) { promise.set_value(); }))); - auto status = future.wait_for(1s); - EXPECT_EQ(status, std::future_status::ready); + future.wait(); } } @@ -56,12 +55,11 @@ TEST(WorkerThreadTest, ScheduleReturnsFalseWhenQueueIsFull) { // Notify that the task has started. promise.set_value(); // Block for a "very long" time. - std::this_thread::sleep_for(2s); + std::this_thread::sleep_for(1s); }))); // Make sure the long-running task began executing. - auto status = future.wait_for(1s); - ASSERT_EQ(status, std::future_status::ready); + future.wait(); // The first task is already being worked on, which means the queue must be empty. // Fill the worker's queue to the maximum. @@ -91,8 +89,7 @@ TEST(WorkerThreadTest, TasksExecuteInOrder) { // Schedule a special task to signal when all of the tasks are finished. worker.schedule( Callable::from([promise = std::move(promise)]() mutable { promise.set_value(); })); - auto status = future.wait_for(1s); - ASSERT_EQ(status, std::future_status::ready); + future.wait(); ASSERT_EQ(results.size(), NUM_TASKS); EXPECT_TRUE(std::is_sorted(results.begin(), results.end())); @@ -115,8 +112,7 @@ TEST(WorkerThreadTest, ExecutionStopsAfterWorkerIsDestroyed) { }))); // The first task should start executing. - auto status = future1.wait_for(1s); - ASSERT_EQ(status, std::future_status::ready); + future1.wait(); // The second task should schedule successfully. ASSERT_TRUE( @@ -128,8 +124,7 @@ TEST(WorkerThreadTest, ExecutionStopsAfterWorkerIsDestroyed) { } // The second task should never execute. - auto status = future2.wait_for(1s); - ASSERT_EQ(status, std::future_status::ready); + future2.wait(); // The future is expected to be ready but contain an exception. // Cannot use ASSERT_THROW because exceptions are disabled in this codebase. // ASSERT_THROW(future2.get(), std::future_error); diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl index 747ee90933..8c1784174d 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl @@ -34,9 +34,13 @@ package android.hardware.gnss; @VintfStability parcelable SatellitePvt { + int flags; android.hardware.gnss.SatellitePositionEcef satPosEcef; android.hardware.gnss.SatelliteVelocityEcef satVelEcef; android.hardware.gnss.SatelliteClockInfo satClockInfo; double ionoDelayMeters; double tropoDelayMeters; + const int HAS_POSITION_VELOCITY_CLOCK_INFO = 1; + const int HAS_IONO = 2; + const int HAS_TROPO = 4; } diff --git a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl index 336e9272a6..58f29c5f92 100644 --- a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl +++ b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl @@ -625,6 +625,17 @@ parcelable GnssMeasurement { * The position and velocity must be in ECEF coordinates. * * If the data is available, gnssMeasurementFlags must contain HAS_SATELLITE_PVT. + * + * If SatellitePvt is derived from Broadcast ephemeris, then the position is already w.r.t. + * the antenna phase center. However, if SatellitePvt is derived from other modeled orbits, + * such as long-term-orbits, or precise orbits, then the orbits may have been computed w.r.t. + * the satellite center of mass, and then GNSS vendors are expected to correct for the effect + * on different phase centers (can differ by meters) of different GNSS signals (e.g. L1, L5) + * on the reported satellite position. Accordingly, we might observe a different satellite + * position reported for L1 GnssMeasurement struct compared to L5 GnssMeasurement struct. + * + * If receivedSvTimeNs is not fully decoded, Satellite PVT could still be reported and + * receivedSvTimeNs uncertainty field would be used to provide confidence. */ SatellitePvt satellitePvt; diff --git a/gnss/aidl/android/hardware/gnss/SatelliteClockInfo.aidl b/gnss/aidl/android/hardware/gnss/SatelliteClockInfo.aidl index 844fd1c47d..4b7d5d68cb 100644 --- a/gnss/aidl/android/hardware/gnss/SatelliteClockInfo.aidl +++ b/gnss/aidl/android/hardware/gnss/SatelliteClockInfo.aidl @@ -24,6 +24,14 @@ parcelable SatelliteClockInfo { /** * Satellite hardware code bias of the reported code type w.r.t * ionosphere-free measurement in meters. + * + * When broadcast ephemeris is used, this is the offset caused + * by the satellite hardware delays at different frequencies; + * e.g. in IS-GPS-705D, this term is described in Section + * 20.3.3.3.1.2.1. + * + * For GPS this term is ~10ns, and affects the satellite position + * computation by less than a millimeter. */ double satHardwareCodeBiasMeters; @@ -31,9 +39,20 @@ parcelable SatelliteClockInfo { * Satellite time correction for ionospheric-free signal measurement * (meters). The satellite clock correction for the given signal type * = satTimeCorrectionMeters - satHardwareCodeBiasMeters. + * + * When broadcast ephemeris is used, this is the offset modeled in the + * clock terms broadcast over the air by the satellites; + * e.g. in IS-GPS-200H, Section 20.3.3.3.3.1, this term is + * ∆tsv = af0 + af1(t - toc) + af2(t - toc)^2 + ∆tr. + * + * If another source of ephemeris is used for SatellitePvt, then the + * equivalent value of satTimeCorrection must be provided. + * + * For GPS this term is ~1ms, and affects the satellite position + * computation by ~1m. */ double satTimeCorrectionMeters; /** Satellite clock drift (meters per second). */ double satClkDriftMps; -}
\ No newline at end of file +} diff --git a/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl b/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl index ea55f0c257..a238e3fc26 100644 --- a/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl +++ b/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl @@ -16,9 +16,9 @@ package android.hardware.gnss; +import android.hardware.gnss.SatelliteClockInfo; import android.hardware.gnss.SatellitePositionEcef; import android.hardware.gnss.SatelliteVelocityEcef; -import android.hardware.gnss.SatelliteClockInfo; /** * Contains estimates of the satellite position, velocity and time in the @@ -27,6 +27,34 @@ import android.hardware.gnss.SatelliteClockInfo; @VintfStability parcelable SatellitePvt { /** + * Bit mask indicating valid satellite position, velocity and clock info fields are + * stored in the SatellitePvt. + */ + const int HAS_POSITION_VELOCITY_CLOCK_INFO = 1 << 0; + + /** + * Bit mask indicating a valid iono delay field is stored in the SatellitePvt. + */ + const int HAS_IONO = 1 << 1; + + /** + * Bit mask indicating a valid tropo delay field is stored in the SatellitePvt. + */ + const int HAS_TROPO = 1 << 2; + + /** + * A bitfield of flags indicating the validity of the fields in this SatellitePvt. + * The bit masks are defined in the constants with prefix HAS_* + * + * Fields for which there is no corresponding flag must be filled in with a valid value. + * For convenience, these are marked as mandatory. + * + * Others fields may have invalid information in them, if not marked as valid by the + * corresponding bit in flags. + */ + int flags; + + /** * Satellite position in WGS84 ECEF. See comments of * SatellitePositionEcef for units. */ @@ -46,4 +74,4 @@ parcelable SatellitePvt { /** Tropospheric delay in meters. */ double tropoDelayMeters; -}
\ No newline at end of file +} diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index 0fc2ff8a38..67ccf52c15 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -38,6 +38,7 @@ using android::hardware::gnss::IGnssMeasurementInterface; using android::hardware::gnss::IGnssPowerIndication; using android::hardware::gnss::IGnssPsds; using android::hardware::gnss::PsdsType; +using android::hardware::gnss::SatellitePvt; using GnssConstellationTypeAidl = android::hardware::gnss::GnssConstellationType; @@ -128,22 +129,39 @@ TEST_P(GnssHalTest, TestGnssMeasurementExtension) { GnssMeasurement::HAS_SATELLITE_PVT | GnssMeasurement::HAS_CORRELATION_VECTOR)); - if ((measurement.flags & GnssMeasurement::HAS_SATELLITE_PVT) && - (has_capability_satpvt == true)) { - ASSERT_TRUE(measurement.satellitePvt.satPosEcef.posXMeters >= -43000000 && - measurement.satellitePvt.satPosEcef.posXMeters <= 43000000); - ASSERT_TRUE(measurement.satellitePvt.satPosEcef.posYMeters >= -43000000 && - measurement.satellitePvt.satPosEcef.posYMeters <= 43000000); - ASSERT_TRUE(measurement.satellitePvt.satPosEcef.posZMeters >= -43000000 && - measurement.satellitePvt.satPosEcef.posZMeters <= 43000000); - ASSERT_TRUE(measurement.satellitePvt.satPosEcef.ureMeters > 0); - ASSERT_TRUE(measurement.satellitePvt.satVelEcef.velXMps >= -4000 && - measurement.satellitePvt.satVelEcef.velXMps <= 4000); - ASSERT_TRUE(measurement.satellitePvt.satVelEcef.velYMps >= -4000 && - measurement.satellitePvt.satVelEcef.velYMps <= 4000); - ASSERT_TRUE(measurement.satellitePvt.satVelEcef.velZMps >= -4000 && - measurement.satellitePvt.satVelEcef.velZMps <= 4000); - ASSERT_TRUE(measurement.satellitePvt.satVelEcef.ureRateMps > 0); + if (measurement.flags & GnssMeasurement::HAS_SATELLITE_PVT && + has_capability_satpvt == true) { + if (measurement.satellitePvt.flags & SatellitePvt::HAS_POSITION_VELOCITY_CLOCK_INFO) { + ASSERT_TRUE(measurement.satellitePvt.satPosEcef.posXMeters >= -43000000 && + measurement.satellitePvt.satPosEcef.posXMeters <= 43000000); + ASSERT_TRUE(measurement.satellitePvt.satPosEcef.posYMeters >= -43000000 && + measurement.satellitePvt.satPosEcef.posYMeters <= 43000000); + ASSERT_TRUE(measurement.satellitePvt.satPosEcef.posZMeters >= -43000000 && + measurement.satellitePvt.satPosEcef.posZMeters <= 43000000); + ASSERT_TRUE(measurement.satellitePvt.satPosEcef.ureMeters > 0); + ASSERT_TRUE(measurement.satellitePvt.satVelEcef.velXMps >= -4000 && + measurement.satellitePvt.satVelEcef.velXMps <= 4000); + ASSERT_TRUE(measurement.satellitePvt.satVelEcef.velYMps >= -4000 && + measurement.satellitePvt.satVelEcef.velYMps <= 4000); + ASSERT_TRUE(measurement.satellitePvt.satVelEcef.velZMps >= -4000 && + measurement.satellitePvt.satVelEcef.velZMps <= 4000); + ASSERT_TRUE(measurement.satellitePvt.satVelEcef.ureRateMps > 0); + ASSERT_TRUE( + measurement.satellitePvt.satClockInfo.satHardwareCodeBiasMeters > -17.869 && + measurement.satellitePvt.satClockInfo.satHardwareCodeBiasMeters < 17.729); + ASSERT_TRUE(measurement.satellitePvt.satClockInfo.satTimeCorrectionMeters > -3e6 && + measurement.satellitePvt.satClockInfo.satTimeCorrectionMeters < 3e6); + ASSERT_TRUE(measurement.satellitePvt.satClockInfo.satClkDriftMps > -1.117 && + measurement.satellitePvt.satClockInfo.satClkDriftMps < 1.117); + } + if (measurement.satellitePvt.flags & SatellitePvt::HAS_IONO) { + ASSERT_TRUE(measurement.satellitePvt.ionoDelayMeters > 0 && + measurement.satellitePvt.ionoDelayMeters < 100); + } + if (measurement.satellitePvt.flags & SatellitePvt::HAS_TROPO) { + ASSERT_TRUE(measurement.satellitePvt.tropoDelayMeters > 0 && + measurement.satellitePvt.tropoDelayMeters < 100); + } } if (kIsCorrelationVectorSupported && diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp index 9bc6786b80..569dac4c59 100644 --- a/gnss/common/utils/default/Utils.cpp +++ b/gnss/common/utils/default/Utils.cpp @@ -31,6 +31,7 @@ using aidl::android::hardware::gnss::GnssData; using aidl::android::hardware::gnss::GnssMeasurement; using aidl::android::hardware::gnss::IGnss; using aidl::android::hardware::gnss::IGnssMeasurementCallback; +using aidl::android::hardware::gnss::SatellitePvt; using GnssSvFlags = V1_0::IGnssCallback::GnssSvFlags; using GnssMeasurementFlagsV1_0 = V1_0::IGnssMeasurementCallback::GnssMeasurementFlags; @@ -175,7 +176,9 @@ GnssData Utils::getMockMeasurement(const bool enableCorrVecOutputs) { .fullInterSignalBiasUncertaintyNs = 792.0, .satelliteInterSignalBiasNs = 233.9, .satelliteInterSignalBiasUncertaintyNs = 921.2, - .satellitePvt = {.satPosEcef = {.posXMeters = 10442993.1153328, + .satellitePvt = {.flags = SatellitePvt::HAS_POSITION_VELOCITY_CLOCK_INFO | + SatellitePvt::HAS_IONO | SatellitePvt::HAS_TROPO, + .satPosEcef = {.posXMeters = 10442993.1153328, .posYMeters = -19926932.8051666, .posZMeters = -12034295.0216203, .ureMeters = 1000.2345678}, diff --git a/identity/aidl/default/libeic/EicCbor.c b/identity/aidl/default/libeic/EicCbor.c index fe131eb8b7..0e2684fec4 100644 --- a/identity/aidl/default/libeic/EicCbor.c +++ b/identity/aidl/default/libeic/EicCbor.c @@ -114,7 +114,7 @@ void eicCborBegin(EicCbor* cbor, int majorType, size_t size) { data[4] = size & 0xff; eicCborAppend(cbor, data, 5); } else { - data[0] = (majorType << 5) | 24; + data[0] = (majorType << 5) | 27; data[1] = (((uint64_t)size) >> 56) & 0xff; data[2] = (((uint64_t)size) >> 48) & 0xff; data[3] = (((uint64_t)size) >> 40) & 0xff; diff --git a/neuralnetworks/1.0/utils/src/PreparedModel.cpp b/neuralnetworks/1.0/utils/src/PreparedModel.cpp index 7987ab4d7f..00970c090d 100644 --- a/neuralnetworks/1.0/utils/src/PreparedModel.cpp +++ b/neuralnetworks/1.0/utils/src/PreparedModel.cpp @@ -65,7 +65,8 @@ nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>> Prepare hal::utils::RequestRelocation relocation; const nn::Request& requestInShared = NN_TRY(hal::utils::makeExecutionFailure(hal::utils::convertRequestFromPointerToShared( - &request, &maybeRequestInShared, &relocation))); + &request, nn::kDefaultRequestMemoryAlignment, nn::kMinMemoryPadding, + &maybeRequestInShared, &relocation))); const auto hidlRequest = NN_TRY(hal::utils::makeExecutionFailure(convert(requestInShared))); @@ -111,7 +112,8 @@ nn::GeneralResult<nn::SharedExecution> PreparedModel::createReusableExecution( std::optional<nn::Request> maybeRequestInShared; hal::utils::RequestRelocation relocation; const nn::Request& requestInShared = NN_TRY(hal::utils::convertRequestFromPointerToShared( - &request, &maybeRequestInShared, &relocation)); + &request, nn::kDefaultRequestMemoryAlignment, nn::kMinMemoryPadding, + &maybeRequestInShared, &relocation)); auto hidlRequest = NN_TRY(convert(requestInShared)); return Execution::create(shared_from_this(), std::move(hidlRequest), std::move(relocation)); diff --git a/neuralnetworks/1.2/utils/src/ExecutionBurstController.cpp b/neuralnetworks/1.2/utils/src/ExecutionBurstController.cpp index 8e82d2536d..b4b6f680d3 100644 --- a/neuralnetworks/1.2/utils/src/ExecutionBurstController.cpp +++ b/neuralnetworks/1.2/utils/src/ExecutionBurstController.cpp @@ -328,7 +328,8 @@ ExecutionBurstController::execute(const nn::Request& request, nn::MeasureTiming hal::utils::RequestRelocation relocation; const nn::Request& requestInShared = NN_TRY(hal::utils::makeExecutionFailure(hal::utils::convertRequestFromPointerToShared( - &request, &maybeRequestInShared, &relocation))); + &request, nn::kDefaultRequestMemoryAlignment, nn::kMinMemoryPadding, + &maybeRequestInShared, &relocation))); // clear pools field of request, as they will be provided via slots const auto requestWithoutPools = nn::Request{ @@ -373,7 +374,8 @@ nn::GeneralResult<nn::SharedExecution> ExecutionBurstController::createReusableE std::optional<nn::Request> maybeRequestInShared; hal::utils::RequestRelocation relocation; const nn::Request& requestInShared = NN_TRY(hal::utils::convertRequestFromPointerToShared( - &request, &maybeRequestInShared, &relocation)); + &request, nn::kDefaultRequestMemoryAlignment, nn::kMinMemoryPadding, + &maybeRequestInShared, &relocation)); // clear pools field of request, as they will be provided via slots const auto requestWithoutPools = nn::Request{ diff --git a/neuralnetworks/1.2/utils/src/PreparedModel.cpp b/neuralnetworks/1.2/utils/src/PreparedModel.cpp index 1d8793733b..d0ef36e7b5 100644 --- a/neuralnetworks/1.2/utils/src/PreparedModel.cpp +++ b/neuralnetworks/1.2/utils/src/PreparedModel.cpp @@ -97,7 +97,8 @@ nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>> Prepare hal::utils::RequestRelocation relocation; const nn::Request& requestInShared = NN_TRY(hal::utils::makeExecutionFailure(hal::utils::convertRequestFromPointerToShared( - &request, &maybeRequestInShared, &relocation))); + &request, nn::kDefaultRequestMemoryAlignment, nn::kMinMemoryPadding, + &maybeRequestInShared, &relocation))); const auto hidlRequest = NN_TRY(hal::utils::makeExecutionFailure(convert(requestInShared))); const auto hidlMeasure = NN_TRY(hal::utils::makeExecutionFailure(convert(measure))); @@ -140,7 +141,8 @@ nn::GeneralResult<nn::SharedExecution> PreparedModel::createReusableExecution( std::optional<nn::Request> maybeRequestInShared; hal::utils::RequestRelocation relocation; const nn::Request& requestInShared = NN_TRY(hal::utils::convertRequestFromPointerToShared( - &request, &maybeRequestInShared, &relocation)); + &request, nn::kDefaultRequestMemoryAlignment, nn::kMinMemoryPadding, + &maybeRequestInShared, &relocation)); auto hidlRequest = NN_TRY(convert(requestInShared)); auto hidlMeasure = NN_TRY(convert(measure)); diff --git a/neuralnetworks/1.3/utils/src/PreparedModel.cpp b/neuralnetworks/1.3/utils/src/PreparedModel.cpp index cb56bdcb99..1623de5e9f 100644 --- a/neuralnetworks/1.3/utils/src/PreparedModel.cpp +++ b/neuralnetworks/1.3/utils/src/PreparedModel.cpp @@ -143,7 +143,8 @@ nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>> Prepare hal::utils::RequestRelocation relocation; const nn::Request& requestInShared = NN_TRY(hal::utils::makeExecutionFailure(hal::utils::convertRequestFromPointerToShared( - &request, &maybeRequestInShared, &relocation))); + &request, nn::kDefaultRequestMemoryAlignment, nn::kMinMemoryPadding, + &maybeRequestInShared, &relocation))); const auto hidlRequest = NN_TRY(hal::utils::makeExecutionFailure(convert(requestInShared))); const auto hidlMeasure = NN_TRY(hal::utils::makeExecutionFailure(convert(measure))); @@ -184,7 +185,8 @@ PreparedModel::executeFenced(const nn::Request& request, const std::vector<nn::S std::optional<nn::Request> maybeRequestInShared; hal::utils::RequestRelocation relocation; const nn::Request& requestInShared = NN_TRY(hal::utils::convertRequestFromPointerToShared( - &request, &maybeRequestInShared, &relocation)); + &request, nn::kDefaultRequestMemoryAlignment, nn::kMinMemoryPadding, + &maybeRequestInShared, &relocation)); const auto hidlRequest = NN_TRY(convert(requestInShared)); const auto hidlWaitFor = NN_TRY(hal::utils::convertSyncFences(waitFor)); @@ -236,7 +238,8 @@ nn::GeneralResult<nn::SharedExecution> PreparedModel::createReusableExecution( std::optional<nn::Request> maybeRequestInShared; hal::utils::RequestRelocation relocation; const nn::Request& requestInShared = NN_TRY(hal::utils::convertRequestFromPointerToShared( - &request, &maybeRequestInShared, &relocation)); + &request, nn::kDefaultRequestMemoryAlignment, nn::kMinMemoryPadding, + &maybeRequestInShared, &relocation)); auto hidlRequest = NN_TRY(convert(requestInShared)); auto hidlMeasure = NN_TRY(convert(measure)); diff --git a/neuralnetworks/aidl/utils/src/Burst.cpp b/neuralnetworks/aidl/utils/src/Burst.cpp index 3cbba4d643..87cd0e4afe 100644 --- a/neuralnetworks/aidl/utils/src/Burst.cpp +++ b/neuralnetworks/aidl/utils/src/Burst.cpp @@ -178,7 +178,8 @@ nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>> Burst:: hal::utils::RequestRelocation relocation; const nn::Request& requestInShared = NN_TRY(hal::utils::makeExecutionFailure(hal::utils::convertRequestFromPointerToShared( - &request, &maybeRequestInShared, &relocation))); + &request, nn::kDefaultRequestMemoryAlignment, nn::kDefaultRequestMemoryPadding, + &maybeRequestInShared, &relocation))); const auto aidlRequest = NN_TRY(hal::utils::makeExecutionFailure(convert(requestInShared))); const auto aidlMeasure = NN_TRY(hal::utils::makeExecutionFailure(convert(measure))); @@ -248,7 +249,8 @@ nn::GeneralResult<nn::SharedExecution> Burst::createReusableExecution( std::optional<nn::Request> maybeRequestInShared; hal::utils::RequestRelocation relocation; const nn::Request& requestInShared = NN_TRY(hal::utils::convertRequestFromPointerToShared( - &request, &maybeRequestInShared, &relocation)); + &request, nn::kDefaultRequestMemoryAlignment, nn::kDefaultRequestMemoryPadding, + &maybeRequestInShared, &relocation)); auto aidlRequest = NN_TRY(convert(requestInShared)); const auto aidlMeasure = NN_TRY(convert(measure)); diff --git a/neuralnetworks/aidl/utils/src/PreparedModel.cpp b/neuralnetworks/aidl/utils/src/PreparedModel.cpp index 191560786f..18e7636346 100644 --- a/neuralnetworks/aidl/utils/src/PreparedModel.cpp +++ b/neuralnetworks/aidl/utils/src/PreparedModel.cpp @@ -80,7 +80,8 @@ nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>> Prepare hal::utils::RequestRelocation relocation; const nn::Request& requestInShared = NN_TRY(hal::utils::makeExecutionFailure(hal::utils::convertRequestFromPointerToShared( - &request, &maybeRequestInShared, &relocation))); + &request, nn::kDefaultRequestMemoryAlignment, nn::kDefaultRequestMemoryPadding, + &maybeRequestInShared, &relocation))); const auto aidlRequest = NN_TRY(hal::utils::makeExecutionFailure(convert(requestInShared))); const auto aidlMeasure = NN_TRY(hal::utils::makeExecutionFailure(convert(measure))); @@ -127,7 +128,8 @@ PreparedModel::executeFenced(const nn::Request& request, const std::vector<nn::S std::optional<nn::Request> maybeRequestInShared; hal::utils::RequestRelocation relocation; const nn::Request& requestInShared = NN_TRY(hal::utils::convertRequestFromPointerToShared( - &request, &maybeRequestInShared, &relocation)); + &request, nn::kDefaultRequestMemoryAlignment, nn::kDefaultRequestMemoryPadding, + &maybeRequestInShared, &relocation)); const auto aidlRequest = NN_TRY(convert(requestInShared)); const auto aidlWaitFor = NN_TRY(convert(waitFor)); @@ -197,7 +199,8 @@ nn::GeneralResult<nn::SharedExecution> PreparedModel::createReusableExecution( std::optional<nn::Request> maybeRequestInShared; hal::utils::RequestRelocation relocation; const nn::Request& requestInShared = NN_TRY(hal::utils::convertRequestFromPointerToShared( - &request, &maybeRequestInShared, &relocation)); + &request, nn::kDefaultRequestMemoryAlignment, nn::kDefaultRequestMemoryPadding, + &maybeRequestInShared, &relocation)); auto aidlRequest = NN_TRY(convert(requestInShared)); auto aidlMeasure = NN_TRY(convert(measure)); diff --git a/neuralnetworks/utils/common/include/nnapi/hal/CommonUtils.h b/neuralnetworks/utils/common/include/nnapi/hal/CommonUtils.h index fdc90dfb41..702ee92da8 100644 --- a/neuralnetworks/utils/common/include/nnapi/hal/CommonUtils.h +++ b/neuralnetworks/utils/common/include/nnapi/hal/CommonUtils.h @@ -122,8 +122,8 @@ struct RequestRelocation { // Unlike `flushDataFromPointerToShared`, this method will not copy the input pointer data to the // shared memory pool. Use `relocationOut` to flush the input or output data after the call. nn::GeneralResult<std::reference_wrapper<const nn::Request>> convertRequestFromPointerToShared( - const nn::Request* request, std::optional<nn::Request>* maybeRequestInSharedOut, - RequestRelocation* relocationOut); + const nn::Request* request, uint32_t alignment, uint32_t padding, + std::optional<nn::Request>* maybeRequestInSharedOut, RequestRelocation* relocationOut); nn::GeneralResult<std::vector<uint32_t>> countNumberOfConsumers( size_t numberOfOperands, const std::vector<nn::Operation>& operations); diff --git a/neuralnetworks/utils/common/src/CommonUtils.cpp b/neuralnetworks/utils/common/src/CommonUtils.cpp index eaeb9ad872..8e55bf0253 100644 --- a/neuralnetworks/utils/common/src/CommonUtils.cpp +++ b/neuralnetworks/utils/common/src/CommonUtils.cpp @@ -220,8 +220,8 @@ void OutputRelocationTracker::flush() const { } nn::GeneralResult<std::reference_wrapper<const nn::Request>> convertRequestFromPointerToShared( - const nn::Request* request, std::optional<nn::Request>* maybeRequestInSharedOut, - RequestRelocation* relocationOut) { + const nn::Request* request, uint32_t alignment, uint32_t padding, + std::optional<nn::Request>* maybeRequestInSharedOut, RequestRelocation* relocationOut) { CHECK(request != nullptr); CHECK(maybeRequestInSharedOut != nullptr); CHECK(relocationOut != nullptr); @@ -249,7 +249,7 @@ nn::GeneralResult<std::reference_wrapper<const nn::Request>> convertRequestFromP const void* data = std::visit([](auto ptr) { return static_cast<const void*>(ptr); }, location.pointer); CHECK(data != nullptr); - input.location = inputBuilder.append(location.length); + input.location = inputBuilder.append(location.length, alignment, padding); inputRelocationInfos.push_back({data, input.location.length, input.location.offset}); } @@ -273,7 +273,7 @@ nn::GeneralResult<std::reference_wrapper<const nn::Request>> convertRequestFromP output.lifetime = nn::Request::Argument::LifeTime::POOL; void* data = std::get<void*>(location.pointer); CHECK(data != nullptr); - output.location = outputBuilder.append(location.length); + output.location = outputBuilder.append(location.length, alignment, padding); outputRelocationInfos.push_back({data, output.location.length, output.location.offset}); } diff --git a/power/stats/aidl/android/hardware/power/stats/EnergyConsumerResult.aidl b/power/stats/aidl/android/hardware/power/stats/EnergyConsumerResult.aidl index 12d2042eb2..66c8c8c58f 100644 --- a/power/stats/aidl/android/hardware/power/stats/EnergyConsumerResult.aidl +++ b/power/stats/aidl/android/hardware/power/stats/EnergyConsumerResult.aidl @@ -25,7 +25,7 @@ parcelable EnergyConsumerResult { */ int id; /** - * Time since boot in milliseconds + * Time of data capture in milliseconds since boot (CLOCK_BOOTTIME clock) */ long timestampMs; /** @@ -38,4 +38,3 @@ parcelable EnergyConsumerResult { */ EnergyConsumerAttribution[] attribution; } - diff --git a/power/stats/aidl/android/hardware/power/stats/EnergyMeasurement.aidl b/power/stats/aidl/android/hardware/power/stats/EnergyMeasurement.aidl index d3e8f46699..31fbaa870d 100644 --- a/power/stats/aidl/android/hardware/power/stats/EnergyMeasurement.aidl +++ b/power/stats/aidl/android/hardware/power/stats/EnergyMeasurement.aidl @@ -23,7 +23,7 @@ parcelable EnergyMeasurement { */ int id; /** - * Approximate time of data capture in millseconds since boot + * Time of data capture in milliseconds since boot (CLOCK_BOOTTIME clock) */ long timestampMs; /** @@ -35,4 +35,3 @@ parcelable EnergyMeasurement { */ long energyUWs; } - diff --git a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h index a8e19967d5..af140096b8 100644 --- a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h +++ b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h @@ -425,7 +425,10 @@ class SensorsHidlTestBase : public testing::TestWithParam<std::string> { return; } - batchingPeriodInNs = std::min(batchingPeriodInNs, maxBatchingTestTimeNs); + if (batchingPeriodInNs > maxBatchingTestTimeNs) { + batchingPeriodInNs = maxBatchingTestTimeNs; + minFifoCount = (uint32_t)(batchingPeriodInNs / minSamplingPeriodInNs); + } ALOGI("Test batching for %d ms", (int)(batchingPeriodInNs / 1000 / 1000)); @@ -448,7 +451,7 @@ class SensorsHidlTestBase : public testing::TestWithParam<std::string> { false /*change collection*/); // 0.8 + 0.2 times the batching period - usleep(batchingPeriodInNs / 1000 * 8 / 10); + usleep(batchingPeriodInNs / 1000 * 2 / 10); ASSERT_EQ(flush(handle), Result::OK); // plus some time for the event to deliver |