Merge "Update VehicleProperty documentation." into main
diff --git a/camera/provider/aidl/vts/device_cb.cpp b/camera/provider/aidl/vts/device_cb.cpp
index bfd1cd1..940b4af 100644
--- a/camera/provider/aidl/vts/device_cb.cpp
+++ b/camera/provider/aidl/vts/device_cb.cpp
@@ -421,12 +421,19 @@
}
for (const auto& buffer : results.outputBuffers) {
+ std::unique_lock<std::mutex> l(mLock);
CameraAidlTest::InFlightRequest::StreamBufferAndTimestamp streamBufferAndTimestamp;
- auto outstandingBuffers = mUseHalBufManager ? mOutstandingBufferIds :
+ auto& outstandingBuffers = mUseHalBufManager ? mOutstandingBufferIds :
request->mOutstandingBufferIds;
auto bufferId = mUseHalBufManager ? buffer.bufferId : results.frameNumber;
- auto outputBuffer = outstandingBuffers.empty() ? ::android::makeFromAidl(buffer.buffer) :
- outstandingBuffers[buffer.streamId][bufferId];
+ const native_handle_t *outputBuffer = nullptr;
+ if (outstandingBuffers.empty()) {
+ outputBuffer = ::android::makeFromAidl(buffer.buffer);
+ } else if (outstandingBuffers[buffer.streamId].contains(bufferId)) {
+ outputBuffer = outstandingBuffers[buffer.streamId][bufferId];
+ } else {
+ ALOGV("%s: Invalid bufferId: %" PRId64, __FUNCTION__, bufferId);
+ }
streamBufferAndTimestamp.buffer = {buffer.streamId,
bufferId,
outputBuffer,
diff --git a/contexthub/aidl/default/ContextHub.cpp b/contexthub/aidl/default/ContextHub.cpp
index c1af0a3..7eb51d0 100644
--- a/contexthub/aidl/default/ContextHub.cpp
+++ b/contexthub/aidl/default/ContextHub.cpp
@@ -15,6 +15,7 @@
*/
#include "contexthub-impl/ContextHub.h"
+#include "aidl/android/hardware/contexthub/IContextHubCallback.h"
#ifndef LOG_TAG
#define LOG_TAG "CHRE"
@@ -22,6 +23,8 @@
#include <inttypes.h>
#include <log/log.h>
+#include <optional>
+#include <thread>
using ::ndk::ScopedAStatus;
@@ -62,6 +65,9 @@
},
};
+//! Mutex used to ensure callbacks are called after the initial function returns.
+std::mutex gCallbackMutex;
+
} // anonymous namespace
ScopedAStatus ContextHub::getContextHubs(std::vector<ContextHubInfo>* out_contextHubInfos) {
@@ -297,8 +303,8 @@
mMaxValidSessionId = in_size;
}
- _aidl_return->at(0) = 0;
- _aidl_return->at(1) = in_size;
+ (*_aidl_return)[0] = 0;
+ (*_aidl_return)[1] = in_size;
return ScopedAStatus::ok();
};
@@ -308,7 +314,7 @@
// We are not calling onCloseEndpointSession on failure because the remote endpoints (our
// mock endpoints) always accept the session.
- std::shared_ptr<IEndpointCallback> callback = nullptr;
+ std::weak_ptr<IEndpointCallback> callback;
{
std::unique_lock<std::mutex> lock(mEndpointMutex);
if (in_sessionId > mMaxValidSessionId) {
@@ -355,23 +361,27 @@
.serviceDescriptor = in_serviceDescriptor,
});
- if (mEndpointCallback != nullptr) {
- callback = mEndpointCallback;
+ if (mEndpointCallback == nullptr) {
+ return ScopedAStatus::ok();
}
+ callback = mEndpointCallback;
}
- if (callback != nullptr) {
- callback->onEndpointSessionOpenComplete(in_sessionId);
- }
+ std::unique_lock<std::mutex> lock(gCallbackMutex);
+ std::thread{[callback, in_sessionId]() {
+ std::unique_lock<std::mutex> lock(gCallbackMutex);
+ if (auto cb = callback.lock(); cb != nullptr) {
+ cb->onEndpointSessionOpenComplete(in_sessionId);
+ }
+ }}.detach();
return ScopedAStatus::ok();
};
ScopedAStatus ContextHub::sendMessageToEndpoint(int32_t in_sessionId, const Message& in_msg) {
- bool foundSession = false;
- std::shared_ptr<IEndpointCallback> callback = nullptr;
+ std::weak_ptr<IEndpointCallback> callback;
{
std::unique_lock<std::mutex> lock(mEndpointMutex);
-
+ bool foundSession = false;
for (const EndpointSession& session : mEndpointSessions) {
if (session.sessionId == in_sessionId) {
foundSession = true;
@@ -379,27 +389,38 @@
}
}
- if (mEndpointCallback != nullptr) {
- callback = mEndpointCallback;
- }
- }
-
- if (!foundSession) {
- ALOGE("sendMessageToEndpoint: session ID %" PRId32 " is invalid", in_sessionId);
- return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
- }
-
- if (callback != nullptr) {
- if (in_msg.flags & Message::FLAG_REQUIRES_DELIVERY_STATUS) {
- MessageDeliveryStatus msgStatus = {};
- msgStatus.messageSequenceNumber = in_msg.sequenceNumber;
- msgStatus.errorCode = ErrorCode::OK;
- callback->onMessageDeliveryStatusReceived(in_sessionId, msgStatus);
+ if (!foundSession) {
+ ALOGE("sendMessageToEndpoint: session ID %" PRId32 " is invalid", in_sessionId);
+ return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
- // Echo the message back
- callback->onMessageReceived(in_sessionId, in_msg);
+ if (mEndpointCallback == nullptr) {
+ return ScopedAStatus::ok();
+ }
+ callback = mEndpointCallback;
}
+
+ std::unique_lock<std::mutex> lock(gCallbackMutex);
+ if ((in_msg.flags & Message::FLAG_REQUIRES_DELIVERY_STATUS) != 0) {
+ MessageDeliveryStatus msgStatus = {};
+ msgStatus.messageSequenceNumber = in_msg.sequenceNumber;
+ msgStatus.errorCode = ErrorCode::OK;
+
+ std::thread{[callback, in_sessionId, msgStatus]() {
+ std::unique_lock<std::mutex> lock(gCallbackMutex);
+ if (auto cb = callback.lock(); cb != nullptr) {
+ cb->onMessageDeliveryStatusReceived(in_sessionId, msgStatus);
+ }
+ }}.detach();
+ }
+
+ // Echo the message back
+ std::thread{[callback, in_sessionId, in_msg]() {
+ std::unique_lock<std::mutex> lock(gCallbackMutex);
+ if (auto cb = callback.lock(); cb != nullptr) {
+ cb->onMessageReceived(in_sessionId, in_msg);
+ }
+ }}.detach();
return ScopedAStatus::ok();
};
diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
index 090d4fe..02f0653 100644
--- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
+++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
@@ -492,7 +492,11 @@
}
Status onMessageReceived(int32_t /* sessionId */, const Message& message) override {
- mMessages.push_back(message);
+ {
+ std::unique_lock<std::mutex> lock(mMutex);
+ mMessages.push_back(message);
+ }
+ mCondVar.notify_one();
return Status::ok();
}
@@ -513,21 +517,30 @@
}
Status onEndpointSessionOpenComplete(int32_t /* sessionId */) override {
- mWasOnEndpointSessionOpenCompleteCalled = true;
+ {
+ std::unique_lock<std::mutex> lock(mMutex);
+ mWasOnEndpointSessionOpenCompleteCalled = true;
+ }
+ mCondVar.notify_one();
return Status::ok();
}
- std::vector<Message> getMessages() { return mMessages; }
-
bool wasOnEndpointSessionOpenCompleteCalled() {
return mWasOnEndpointSessionOpenCompleteCalled;
}
+
void resetWasOnEndpointSessionOpenCompleteCalled() {
mWasOnEndpointSessionOpenCompleteCalled = false;
}
+ std::mutex& getMutex() { return mMutex; }
+ std::condition_variable& getCondVar() { return mCondVar; }
+ std::vector<Message> getMessages() { return mMessages; }
+
private:
std::vector<Message> mMessages;
+ std::mutex mMutex;
+ std::condition_variable mCondVar;
bool mWasOnEndpointSessionOpenCompleteCalled = false;
};
@@ -690,14 +703,12 @@
EXPECT_GE(range[1] - range[0] + 1, requestedRange);
// Open the session
- cb->resetWasOnEndpointSessionOpenCompleteCalled();
int32_t sessionId = range[1] + 10; // invalid
EXPECT_FALSE(contextHub
->openEndpointSession(sessionId, destinationEndpoint->id,
initiatorEndpoint.id,
/* in_serviceDescriptor= */ String16("ECHO"))
.isOk());
- EXPECT_FALSE(cb->wasOnEndpointSessionOpenCompleteCalled());
}
TEST_P(ContextHubAidl, OpenEndpointSessionAndSendMessageEchoesBack) {
@@ -710,6 +721,8 @@
EXPECT_TRUE(status.isOk());
}
+ std::unique_lock<std::mutex> lock(cb->getMutex());
+
// Register the endpoint
EndpointInfo initiatorEndpoint;
initiatorEndpoint.id.id = 8;
@@ -750,6 +763,7 @@
initiatorEndpoint.id,
/* in_serviceDescriptor= */ String16("ECHO"))
.isOk());
+ cb->getCondVar().wait(lock);
EXPECT_TRUE(cb->wasOnEndpointSessionOpenCompleteCalled());
// Send the message
@@ -760,6 +774,7 @@
ASSERT_TRUE(contextHub->sendMessageToEndpoint(sessionId, message).isOk());
// Check for echo
+ cb->getCondVar().wait(lock);
EXPECT_FALSE(cb->getMessages().empty());
EXPECT_EQ(cb->getMessages().back().content.back(), 42);
}
diff --git a/gnss/aidl/default/GnssDebug.cpp b/gnss/aidl/default/GnssDebug.cpp
index 5ae6edd..185bfe4 100644
--- a/gnss/aidl/default/GnssDebug.cpp
+++ b/gnss/aidl/default/GnssDebug.cpp
@@ -126,9 +126,46 @@
.ephemerisAgeSeconds = 12,
.serverPredictionIsAvailable = true,
.serverPredictionAgeSeconds = 30};
+ SatelliteData satelliteData10 = {
+ .svid = 2,
+ .constellation = GnssConstellationType::GALILEO,
+ .ephemerisType = SatelliteEphemerisType::EPHEMERIS,
+ .ephemerisSource = SatellitePvt::SatelliteEphemerisSource::SERVER_LONG_TERM,
+ .ephemerisHealth = SatelliteEphemerisHealth::GOOD,
+ .ephemerisAgeSeconds = 12,
+ .serverPredictionIsAvailable = true,
+ .serverPredictionAgeSeconds = 30};
+ SatelliteData satelliteData11 = {
+ .svid = 4,
+ .constellation = GnssConstellationType::GALILEO,
+ .ephemerisType = SatelliteEphemerisType::EPHEMERIS,
+ .ephemerisSource = SatellitePvt::SatelliteEphemerisSource::SERVER_LONG_TERM,
+ .ephemerisHealth = SatelliteEphemerisHealth::GOOD,
+ .ephemerisAgeSeconds = 12,
+ .serverPredictionIsAvailable = true,
+ .serverPredictionAgeSeconds = 30};
+ SatelliteData satelliteData12 = {
+ .svid = 10,
+ .constellation = GnssConstellationType::GALILEO,
+ .ephemerisType = SatelliteEphemerisType::EPHEMERIS,
+ .ephemerisSource = SatellitePvt::SatelliteEphemerisSource::SERVER_LONG_TERM,
+ .ephemerisHealth = SatelliteEphemerisHealth::GOOD,
+ .ephemerisAgeSeconds = 12,
+ .serverPredictionIsAvailable = true,
+ .serverPredictionAgeSeconds = 30};
+ SatelliteData satelliteData13 = {
+ .svid = 29,
+ .constellation = GnssConstellationType::GALILEO,
+ .ephemerisType = SatelliteEphemerisType::EPHEMERIS,
+ .ephemerisSource = SatellitePvt::SatelliteEphemerisSource::SERVER_LONG_TERM,
+ .ephemerisHealth = SatelliteEphemerisHealth::GOOD,
+ .ephemerisAgeSeconds = 12,
+ .serverPredictionIsAvailable = true,
+ .serverPredictionAgeSeconds = 30};
std::vector<SatelliteData> satelliteDataArrayDebug = {
- satelliteData1, satelliteData2, satelliteData3, satelliteData4, satelliteData5,
- satelliteData6, satelliteData7, satelliteData8, satelliteData9};
+ satelliteData1, satelliteData2, satelliteData3, satelliteData4, satelliteData5,
+ satelliteData6, satelliteData7, satelliteData8, satelliteData9, satelliteData10,
+ satelliteData11, satelliteData12, satelliteData13};
debugData->position = positionDebug;
debugData->time = timeDebug;
debugData->satelliteDataArray = satelliteDataArrayDebug;
diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp
index 0dd8b32..f7deb29 100644
--- a/gnss/aidl/vts/gnss_hal_test.cpp
+++ b/gnss/aidl/vts/gnss_hal_test.cpp
@@ -276,35 +276,43 @@
}
/*
- * FindStrongFrequentBlockableSource:
+ * FindStrongFrequentSource:
*
- * Search through a GnssSvStatus list for the strongest blockable satellite observed enough times
+ * Search through a GnssSvStatus list for the strongest satellite observed enough times per
+ * constellation
*
- * returns the strongest source,
- * or a source with constellation == UNKNOWN if none are found sufficient times
+ * returns the strongest sources for each constellation,
+ * or an empty vector if none are found sufficient times
*/
-BlocklistedSource GnssHalTest::FindStrongFrequentBlockableSource(
+std::vector<BlocklistedSource> GnssHalTest::FindStrongFrequentSources(
const std::list<hidl_vec<IGnssCallback_2_1::GnssSvInfo>> sv_info_list,
const int min_observations) {
- return FindStrongFrequentBlockableSource(convertToAidl(sv_info_list), min_observations);
+ return FindStrongFrequentSources(convertToAidl(sv_info_list), min_observations);
}
-BlocklistedSource GnssHalTest::FindStrongFrequentBlockableSource(
+bool GnssHalTest::isBlockableConstellation(const GnssConstellationType constellation,
+ const bool isCnBuild) {
+ if (constellation == GnssConstellationType::GPS) {
+ return false;
+ }
+ if (isCnBuild && (constellation == GnssConstellationType::BEIDOU)) {
+ // Do not blocklist BDS on CN builds
+ return false;
+ }
+ return true;
+}
+
+std::vector<BlocklistedSource> GnssHalTest::FindStrongFrequentSources(
const std::list<std::vector<IGnssCallback::GnssSvInfo>> sv_info_list,
const int min_observations) {
- std::map<ComparableBlocklistedSource, SignalCounts> mapSignals;
+ ALOGD("Find strongest sv from %d sv_info_list with %d min_observations.",
+ (int)sv_info_list.size(), min_observations);
- bool isCnBuild = Utils::isCnBuild();
- ALOGD("isCnBuild: %s", isCnBuild ? "true" : "false");
+ std::map<ComparableBlocklistedSource, SignalCounts> mapSignals;
for (const auto& sv_info_vec : sv_info_list) {
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
const auto& gnss_sv = sv_info_vec[iSv];
- if ((gnss_sv.svFlag & (int)IGnssCallback::GnssSvFlags::USED_IN_FIX) &&
- (gnss_sv.constellation != GnssConstellationType::GPS)) {
- if (isCnBuild && (gnss_sv.constellation == GnssConstellationType::BEIDOU)) {
- // Do not blocklist BDS on CN builds
- continue;
- }
+ if (gnss_sv.svFlag & (int)IGnssCallback::GnssSvFlags::USED_IN_FIX) {
ComparableBlocklistedSource source;
source.id.svid = gnss_sv.svid;
source.id.constellation = gnss_sv.constellation;
@@ -326,27 +334,76 @@
}
}
- float max_cn0_dbhz_with_sufficient_count = 0.;
- int total_observation_count = 0;
- int blocklisted_source_count_observation = 0;
+ // the Cn0 of the strongest SV per constellation
+ std::unordered_map<GnssConstellationType, float> max_cn0_map;
+ // # of total observations of all signals per constellation
+ std::unordered_map<GnssConstellationType, int> total_observation_count_map;
+ // # of observations of the strongest sv per constellation
+ std::unordered_map<GnssConstellationType, int> source_observation_count_map;
+ // the source to blocklist per constellation
+ std::unordered_map<GnssConstellationType, ComparableBlocklistedSource> source_map;
+ // # of signals per constellation
+ std::unordered_map<GnssConstellationType, int> signal_count_map;
- ComparableBlocklistedSource source_to_blocklist; // initializes to zero = UNKNOWN constellation
for (auto const& pairSignal : mapSignals) {
- total_observation_count += pairSignal.second.observations;
- if ((pairSignal.second.observations >= min_observations) &&
- (pairSignal.second.max_cn0_dbhz > max_cn0_dbhz_with_sufficient_count)) {
- source_to_blocklist = pairSignal.first;
- blocklisted_source_count_observation = pairSignal.second.observations;
- max_cn0_dbhz_with_sufficient_count = pairSignal.second.max_cn0_dbhz;
+ ComparableBlocklistedSource source = pairSignal.first;
+ total_observation_count_map[source.id.constellation] += pairSignal.second.observations;
+ signal_count_map[source.id.constellation]++;
+ if (pairSignal.second.observations < min_observations) {
+ continue;
+ }
+ if (pairSignal.second.max_cn0_dbhz > max_cn0_map[source.id.constellation]) {
+ source_map[source.id.constellation] = pairSignal.first;
+ source_observation_count_map[source.id.constellation] = pairSignal.second.observations;
+ max_cn0_map[source.id.constellation] = pairSignal.second.max_cn0_dbhz;
}
}
- ALOGD("Among %d observations, chose svid %d, constellation %d, "
- "with %d observations at %.1f max CNo",
- total_observation_count, source_to_blocklist.id.svid,
- (int)source_to_blocklist.id.constellation, blocklisted_source_count_observation,
- max_cn0_dbhz_with_sufficient_count);
- return source_to_blocklist.id;
+ std::vector<BlocklistedSource> sources;
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 4) {
+ /* For AIDL version <= 4 (launched-in-15 or earlier), only blocklist 1 sv */
+ float max_cn0 = 0;
+ ComparableBlocklistedSource source_to_blocklist;
+ for (auto const& pair : source_map) {
+ GnssConstellationType constellation = pair.first;
+ ComparableBlocklistedSource source = pair.second;
+ if (max_cn0_map[constellation] > max_cn0) {
+ max_cn0 = max_cn0_map[constellation];
+ source_to_blocklist = source;
+ }
+ }
+ if (source_to_blocklist.id.constellation != GnssConstellationType::UNKNOWN) {
+ ALOGD("In constellation %d, among %d observed SVs, svid %d is chosen to blocklist. "
+ "It has %d observations with max Cn0: %.1f among %d total observations of this "
+ "constellation.",
+ (int)source_to_blocklist.id.constellation,
+ signal_count_map[source_to_blocklist.id.constellation],
+ source_to_blocklist.id.svid,
+ source_observation_count_map[source_to_blocklist.id.constellation], max_cn0,
+ total_observation_count_map[source_to_blocklist.id.constellation]);
+ sources.push_back(source_to_blocklist.id);
+ }
+ } else {
+ /* For AIDL version >= 5 (launched-in-16 or later), blocklist 1 sv per constellation */
+ for (auto const& pair : source_map) {
+ ComparableBlocklistedSource source = pair.second;
+ if (signal_count_map[source.id.constellation] < 4) {
+ // Skip the constellation with a small number of signals
+ // 4 is arbitrarily chosen to avoid affecting constellations with a limited coverage
+ continue;
+ }
+ ALOGD("In constellation %d, among %d observed SVs, svid %d is chosen to blocklist. "
+ "It has %d observations with max Cn0: %.1f among %d total observations of this "
+ "constellation.",
+ (int)source.id.constellation, signal_count_map[source.id.constellation],
+ source.id.svid, source_observation_count_map[source.id.constellation],
+ max_cn0_map[source.id.constellation],
+ total_observation_count_map[source.id.constellation]);
+ sources.push_back(source.id);
+ }
+ }
+
+ return sources;
}
GnssConstellationType GnssHalTest::startLocationAndGetBlockableConstellation(
diff --git a/gnss/aidl/vts/gnss_hal_test.h b/gnss/aidl/vts/gnss_hal_test.h
index dec5856..c41620a 100644
--- a/gnss/aidl/vts/gnss_hal_test.h
+++ b/gnss/aidl/vts/gnss_hal_test.h
@@ -81,14 +81,17 @@
std::list<std::vector<android::hardware::gnss::IGnssCallback::GnssSvInfo>> convertToAidl(
const std::list<hidl_vec<android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo>>&
sv_info_list);
- android::hardware::gnss::BlocklistedSource FindStrongFrequentBlockableSource(
+ std::vector<android::hardware::gnss::BlocklistedSource> FindStrongFrequentSources(
const std::list<hidl_vec<android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo>>
sv_info_list,
const int min_observations);
- android::hardware::gnss::BlocklistedSource FindStrongFrequentBlockableSource(
+ std::vector<android::hardware::gnss::BlocklistedSource> FindStrongFrequentSources(
const std::list<std::vector<android::hardware::gnss::IGnssCallback::GnssSvInfo>>
sv_info_list,
const int min_observations);
+ bool isBlockableConstellation(
+ const android::hardware::gnss::GnssConstellationType constellation,
+ const bool isCnBuild);
void checkGnssMeasurementClockFields(const android::hardware::gnss::GnssData& measurement);
void checkGnssMeasurementFlags(const android::hardware::gnss::GnssMeasurement& measurement);
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index a2e81d1..781476fd 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -615,7 +615,7 @@
* BlocklistIndividualSatellites:
*
* 1) Turns on location, waits for 3 locations, ensuring they are valid, and checks corresponding
- * GnssStatus for common satellites (strongest and one other.)
+ * GnssStatus for common satellites (strongest one in each constellation.)
* 2a & b) Turns off location, and blocklists common satellites.
* 3) Restart location, wait for 3 locations, ensuring they are valid, and checks corresponding
* GnssStatus does not use those satellites.
@@ -633,6 +633,7 @@
return;
}
+ const int kWarmUpLocations = 3;
const int kLocationsToAwait = 3;
const int kRetriesToUnBlocklist = 10;
@@ -641,7 +642,7 @@
} else {
aidl_gnss_cb_->location_cbq_.reset();
}
- StartAndCheckLocations(kLocationsToAwait);
+ StartAndCheckLocations(kLocationsToAwait + kWarmUpLocations);
int location_called_count = (aidl_gnss_hal_->getInterfaceVersion() <= 1)
? gnss_cb_->location_cbq_.calledCount()
: aidl_gnss_cb_->location_cbq_.calledCount();
@@ -650,37 +651,50 @@
int sv_info_list_cbq_size = (aidl_gnss_hal_->getInterfaceVersion() <= 1)
? gnss_cb_->sv_info_list_cbq_.size()
: aidl_gnss_cb_->sv_info_list_cbq_.size();
- EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait);
+ EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait + kWarmUpLocations);
ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations (%d received)",
- sv_info_list_cbq_size, kLocationsToAwait, location_called_count);
+ sv_info_list_cbq_size, kLocationsToAwait + kWarmUpLocations, location_called_count);
/*
- * Identify strongest SV seen at least kLocationsToAwait -1 times
- * Why -1? To avoid test flakiness in case of (plausible) slight flakiness in strongest signal
- * observability (one epoch RF null)
+ * Identify strongest SV per constellation seen seen at least kLocationsToAwait -1 times.
+ *
+ * Why not (kLocationsToAwait + kWarmUpLocations)? To avoid test flakiness in case of
+ * (plausible) slight flakiness in strongest signal observability (one epoch RF null)
*/
const int kGnssSvInfoListTimeout = 2;
- BlocklistedSource source_to_blocklist;
+ std::vector<BlocklistedSource> sources_to_blocklist;
if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ // Discard kWarmUpLocations sv_info_vec
+ std::list<hidl_vec<IGnssCallback_2_1::GnssSvInfo>> tmp;
+ int count =
+ gnss_cb_->sv_info_list_cbq_.retrieve(tmp, kWarmUpLocations, kGnssSvInfoListTimeout);
+ ASSERT_EQ(count, kWarmUpLocations);
+
+ // Retrieve (sv_info_list_cbq_size - kWarmUpLocations) sv_info_vec
std::list<hidl_vec<IGnssCallback_2_1::GnssSvInfo>> sv_info_vec_list;
- int count = gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec_list, sv_info_list_cbq_size,
- kGnssSvInfoListTimeout);
- ASSERT_EQ(count, sv_info_list_cbq_size);
- source_to_blocklist =
- FindStrongFrequentBlockableSource(sv_info_vec_list, kLocationsToAwait - 1);
+ count = gnss_cb_->sv_info_list_cbq_.retrieve(
+ sv_info_vec_list, sv_info_list_cbq_size - kWarmUpLocations, kGnssSvInfoListTimeout);
+ ASSERT_EQ(count, sv_info_list_cbq_size - kWarmUpLocations);
+ sources_to_blocklist = FindStrongFrequentSources(sv_info_vec_list, kLocationsToAwait - 1);
} else {
+ // Discard kWarmUpLocations sv_info_vec
+ std::list<std::vector<IGnssCallback::GnssSvInfo>> tmp;
+ int count = aidl_gnss_cb_->sv_info_list_cbq_.retrieve(tmp, kWarmUpLocations,
+ kGnssSvInfoListTimeout);
+ ASSERT_EQ(count, kWarmUpLocations);
+
+ // Retrieve (sv_info_list_cbq_size - kWarmUpLocations) sv_info_vec
std::list<std::vector<IGnssCallback::GnssSvInfo>> sv_info_vec_list;
- int count = aidl_gnss_cb_->sv_info_list_cbq_.retrieve(
- sv_info_vec_list, sv_info_list_cbq_size, kGnssSvInfoListTimeout);
- ASSERT_EQ(count, sv_info_list_cbq_size);
- source_to_blocklist =
- FindStrongFrequentBlockableSource(sv_info_vec_list, kLocationsToAwait - 1);
+ count = aidl_gnss_cb_->sv_info_list_cbq_.retrieve(
+ sv_info_vec_list, sv_info_list_cbq_size - kWarmUpLocations, kGnssSvInfoListTimeout);
+ ASSERT_EQ(count, sv_info_list_cbq_size - kWarmUpLocations);
+ sources_to_blocklist = FindStrongFrequentSources(sv_info_vec_list, kLocationsToAwait - 1);
}
- if (source_to_blocklist.constellation == GnssConstellationType::UNKNOWN) {
- // Cannot find a blockable satellite. Let the test pass.
- ALOGD("Cannot find a blockable satellite. Letting the test pass.");
+ if (sources_to_blocklist.empty()) {
+ // Cannot find a satellite to blocklist. Let the test pass.
+ ALOGD("Cannot find a satellite to blocklist. Letting the test pass.");
return;
}
@@ -693,9 +707,7 @@
ASSERT_NE(gnss_configuration_hal, nullptr);
std::vector<BlocklistedSource> sources;
- sources.resize(1);
- sources[0] = source_to_blocklist;
-
+ sources = sources_to_blocklist;
status = gnss_configuration_hal->setBlocklist(sources);
ASSERT_TRUE(status.isOk());
@@ -726,26 +738,47 @@
EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait);
ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations (%d received)",
sv_info_list_cbq_size, kLocationsToAwait, location_called_count);
+ bool isCnBuild = Utils::isCnBuild();
for (int i = 0; i < sv_info_list_cbq_size; ++i) {
if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
hidl_vec<IGnssCallback_2_1::GnssSvInfo> sv_info_vec;
gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout);
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
auto& gnss_sv = sv_info_vec[iSv];
- EXPECT_FALSE(
- (gnss_sv.v2_0.v1_0.svid == source_to_blocklist.svid) &&
- (static_cast<GnssConstellationType>(gnss_sv.v2_0.constellation) ==
- source_to_blocklist.constellation) &&
- (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX));
+ if (!(gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)) {
+ continue;
+ }
+ for (auto const& source : sources_to_blocklist) {
+ if (isBlockableConstellation(source.constellation, isCnBuild)) {
+ EXPECT_FALSE((gnss_sv.v2_0.v1_0.svid == source.svid) &&
+ (static_cast<GnssConstellationType>(
+ gnss_sv.v2_0.constellation) == source.constellation));
+ } else if ((gnss_sv.v2_0.v1_0.svid == source.svid) &&
+ (static_cast<GnssConstellationType>(gnss_sv.v2_0.constellation) ==
+ source.constellation)) {
+ ALOGW("Found constellation %d, svid %d blocklisted but still used-in-fix.",
+ source.constellation, source.svid);
+ }
+ }
}
} else {
std::vector<IGnssCallback::GnssSvInfo> sv_info_vec;
aidl_gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout);
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
auto& gnss_sv = sv_info_vec[iSv];
- EXPECT_FALSE((gnss_sv.svid == source_to_blocklist.svid) &&
- (gnss_sv.constellation == source_to_blocklist.constellation) &&
- (gnss_sv.svFlag & (int)IGnssCallback::GnssSvFlags::USED_IN_FIX));
+ if (!(gnss_sv.svFlag & (int)IGnssCallback::GnssSvFlags::USED_IN_FIX)) {
+ continue;
+ }
+ for (auto const& source : sources_to_blocklist) {
+ if (isBlockableConstellation(source.constellation, isCnBuild)) {
+ EXPECT_FALSE((gnss_sv.svid == source.svid) &&
+ (gnss_sv.constellation == source.constellation));
+ } else if ((gnss_sv.svid == source.svid) &&
+ (gnss_sv.constellation == source.constellation)) {
+ ALOGW("Found constellation %d, svid %d blocklisted but still used-in-fix.",
+ gnss_sv.constellation, gnss_sv.svid);
+ }
+ }
}
}
}
@@ -795,12 +828,15 @@
gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout);
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
auto& gnss_sv = sv_info_vec[iSv];
- if ((gnss_sv.v2_0.v1_0.svid == source_to_blocklist.svid) &&
- (static_cast<GnssConstellationType>(gnss_sv.v2_0.constellation) ==
- source_to_blocklist.constellation) &&
- (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)) {
- strongest_sv_is_reobserved = true;
- break;
+ for (auto const& source : sources_to_blocklist) {
+ if ((gnss_sv.v2_0.v1_0.svid == source.svid) &&
+ (static_cast<GnssConstellationType>(gnss_sv.v2_0.constellation) ==
+ source.constellation) &&
+ (gnss_sv.v2_0.v1_0.svFlag &
+ IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)) {
+ strongest_sv_is_reobserved = true;
+ break;
+ }
}
}
} else {
@@ -808,11 +844,13 @@
aidl_gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout);
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
auto& gnss_sv = sv_info_vec[iSv];
- if ((gnss_sv.svid == source_to_blocklist.svid) &&
- (gnss_sv.constellation == source_to_blocklist.constellation) &&
- (gnss_sv.svFlag & (int)IGnssCallback::GnssSvFlags::USED_IN_FIX)) {
- strongest_sv_is_reobserved = true;
- break;
+ for (auto const& source : sources_to_blocklist) {
+ if ((gnss_sv.svid == source.svid) &&
+ (gnss_sv.constellation == source.constellation) &&
+ (gnss_sv.svFlag & (int)IGnssCallback::GnssSvFlags::USED_IN_FIX)) {
+ strongest_sv_is_reobserved = true;
+ break;
+ }
}
}
}
diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp
index 8303d93..740bc59 100644
--- a/gnss/common/utils/default/Utils.cpp
+++ b/gnss/common/utils/default/Utils.cpp
@@ -338,16 +338,25 @@
std::vector<GnssSvInfo> Utils::getMockSvInfoList() {
std::vector<GnssSvInfo> gnssSvInfoList = {
+ // svid in [1, 32] for GPS
getMockSvInfo(3, GnssConstellationType::GPS, 32.5, 27.5, 59.1, 166.5, kGpsL1FreqHz),
getMockSvInfo(5, GnssConstellationType::GPS, 27.0, 22.0, 29.0, 56.5, kGpsL1FreqHz),
getMockSvInfo(17, GnssConstellationType::GPS, 30.5, 25.5, 71.0, 77.0, kGpsL5FreqHz),
getMockSvInfo(26, GnssConstellationType::GPS, 24.1, 19.1, 28.0, 253.0, kGpsL5FreqHz),
+ // svid in [1, 36] for GAL
+ getMockSvInfo(2, GnssConstellationType::GALILEO, 33.5, 27.5, 59.1, 166.5, kGalE1FreqHz),
+ getMockSvInfo(4, GnssConstellationType::GALILEO, 28.0, 22.0, 29.0, 56.5, kGalE1FreqHz),
+ getMockSvInfo(10, GnssConstellationType::GALILEO, 35.5, 25.5, 71.0, 77.0, kGalE1FreqHz),
+ getMockSvInfo(29, GnssConstellationType::GALILEO, 34.1, 19.1, 28.0, 253.0,
+ kGalE1FreqHz),
+ // "1 <= svid <= 25 || 93 <= svid <= 106" for GLO
getMockSvInfo(5, GnssConstellationType::GLONASS, 20.5, 15.5, 11.5, 116.0, kGloG1FreqHz),
getMockSvInfo(17, GnssConstellationType::GLONASS, 21.5, 16.5, 28.5, 186.0,
kGloG1FreqHz),
getMockSvInfo(18, GnssConstellationType::GLONASS, 28.3, 25.3, 38.8, 69.0, kGloG1FreqHz),
getMockSvInfo(10, GnssConstellationType::GLONASS, 25.0, 20.0, 66.0, 247.0,
kGloG1FreqHz),
+ // "1 <= X <= 14" for IRNSS
getMockSvInfo(3, GnssConstellationType::IRNSS, 22.0, 19.7, 35.0, 112.0, kIrnssL5FreqHz),
};
return gnssSvInfoList;
diff --git a/gnss/common/utils/default/include/Constants.h b/gnss/common/utils/default/include/Constants.h
index 489413e..e6605c4 100644
--- a/gnss/common/utils/default/include/Constants.h
+++ b/gnss/common/utils/default/include/Constants.h
@@ -31,6 +31,7 @@
const int64_t kMockTimestamp = 1519930775453L;
const float kGpsL1FreqHz = 1575.42 * 1e6;
const float kGpsL5FreqHz = 1176.45 * 1e6;
+const float kGalE1FreqHz = 1575.42 * 1e6;
const float kGloG1FreqHz = 1602.0 * 1e6;
const float kIrnssL5FreqHz = 1176.45 * 1e6;
diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerServiceWriter.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerServiceWriter.h
index b50b84b..9dce140 100644
--- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerServiceWriter.h
+++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerServiceWriter.h
@@ -116,6 +116,13 @@
mCommandsResults.emplace_back(std::move(clientTargetPropertyWithBrightness));
}
+ void setDisplayLuts(int64_t display, std::vector<DisplayLuts::LayerLut> layerLuts) {
+ DisplayLuts displayLuts;
+ displayLuts.display = display;
+ displayLuts.layerLuts = std::move(layerLuts);
+ mCommandsResults.emplace_back(std::move(displayLuts));
+ }
+
std::vector<CommandResultPayload> getPendingCommandResults() {
return std::move(mCommandsResults);
}
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 3fa23cc..4e0ce29 100644
--- a/security/keymint/support/include/remote_prov/remote_prov_utils.h
+++ b/security/keymint/support/include/remote_prov/remote_prov_utils.h
@@ -222,6 +222,15 @@
const std::vector<uint8_t>& csr2,
std::string_view instanceName2);
+/** Checks whether the component name in the configuration descriptor in the leaf certificate
+ * of the primary KeyMint instance's DICE certificate chain contains "keymint"
+ */
+ErrMsgOr<bool> verifyComponentNameInKeyMintDiceChain(const std::vector<uint8_t>& csr);
+
+/** Checks whether the DICE chain in the CSR has a certificate with a non-normal mode. */
+ErrMsgOr<bool> hasNonNormalModeInDiceChain(const std::vector<uint8_t>& csr,
+ std::string_view instanceName);
+
/** Verify the DICE chain. */
ErrMsgOr<std::vector<BccEntryData>> validateBcc(const cppbor::Array* bcc,
hwtrust::DiceChain::Kind kind, bool allowAnyMode,
diff --git a/security/keymint/support/remote_prov_utils.cpp b/security/keymint/support/remote_prov_utils.cpp
index 15b2144..eaeec32 100644
--- a/security/keymint/support/remote_prov_utils.cpp
+++ b/security/keymint/support/remote_prov_utils.cpp
@@ -45,6 +45,7 @@
constexpr int32_t kBccPayloadKeyUsage = -4670553;
constexpr int kP256AffinePointSize = 32;
constexpr uint32_t kNumTeeDeviceInfoEntries = 14;
+constexpr std::string_view kKeyMintComponentName = "keymint";
using EC_KEY_Ptr = bssl::UniquePtr<EC_KEY>;
using EVP_PKEY_Ptr = bssl::UniquePtr<EVP_PKEY>;
@@ -882,7 +883,7 @@
return diceChain->IsProper();
}
-std::string hexlify(const std::vector<unsigned char>& bytes) {
+std::string hexlify(const std::vector<uint8_t>& bytes) {
std::stringstream ss;
ss << std::hex << std::setfill('0');
@@ -944,4 +945,55 @@
return *result;
}
+ErrMsgOr<bool> verifyComponentNameInKeyMintDiceChain(const std::vector<uint8_t>& encodedCsr) {
+ auto diceChainKind = getDiceChainKind();
+ if (!diceChainKind) {
+ return diceChainKind.message();
+ }
+
+ auto csr = hwtrust::Csr::validate(encodedCsr, *diceChainKind, false /*isFactory*/,
+ false /*allowAnyMode*/, deviceSuffix(DEFAULT_INSTANCE_NAME));
+ if (!csr.ok()) {
+ return csr.error().message();
+ }
+
+ auto diceChain = csr->getDiceChain();
+ if (!diceChain.ok()) {
+ return diceChain.error().message();
+ }
+
+ auto satisfied = diceChain->componentNameContains(kKeyMintComponentName);
+ if (!satisfied.ok()) {
+ return satisfied.error().message();
+ }
+
+ return *satisfied;
+}
+
+ErrMsgOr<bool> hasNonNormalModeInDiceChain(const std::vector<uint8_t>& encodedCsr,
+ std::string_view instanceName) {
+ auto diceChainKind = getDiceChainKind();
+ if (!diceChainKind) {
+ return diceChainKind.message();
+ }
+
+ auto csr = hwtrust::Csr::validate(encodedCsr, *diceChainKind, false /*isFactory*/,
+ true /*allowAnyMode*/, deviceSuffix(instanceName));
+ if (!csr.ok()) {
+ return csr.error().message();
+ }
+
+ auto diceChain = csr->getDiceChain();
+ if (!diceChain.ok()) {
+ return diceChain.error().message();
+ }
+
+ auto hasNonNormalModeInDiceChain = diceChain->hasNonNormalMode();
+ if (!hasNonNormalModeInDiceChain.ok()) {
+ return hasNonNormalModeInDiceChain.error().message();
+ }
+
+ return *hasNonNormalModeInDiceChain;
+}
+
} // namespace aidl::android::hardware::security::keymint::remote_prov
diff --git a/security/keymint/support/remote_prov_utils_test.cpp b/security/keymint/support/remote_prov_utils_test.cpp
index c6080cd..d86a678 100644
--- a/security/keymint/support/remote_prov_utils_test.cpp
+++ b/security/keymint/support/remote_prov_utils_test.cpp
@@ -408,6 +408,157 @@
0x35, 0x2e, 0x34, 0x32, 0x3a, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x6c, 0x65, 0x61,
0x73, 0x65, 0x2d, 0x6b, 0x65, 0x79, 0x73};
+inline const std::vector<uint8_t> kCsrWithKeyMintInComponentName{
+ 0x85, 0x01, 0xa0, 0x82, 0xa5, 0x01, 0x02, 0x03, 0x26, 0x20, 0x01, 0x21, 0x58, 0x20, 0x44,
+ 0xfd, 0xdd, 0xf1, 0x8a, 0x78, 0xa0, 0xbe, 0x37, 0x49, 0x51, 0x85, 0xfb, 0x7a, 0x16, 0xca,
+ 0xc1, 0x00, 0xb3, 0x78, 0x13, 0x4a, 0x90, 0x4c, 0x5a, 0xa1, 0x3b, 0xfc, 0xea, 0xb6, 0xf3,
+ 0x16, 0x22, 0x58, 0x20, 0x12, 0x7f, 0xf5, 0xe2, 0x14, 0xbd, 0x5d, 0x51, 0xd3, 0x7f, 0x2f,
+ 0x1f, 0x9c, 0xc2, 0x18, 0x31, 0x94, 0x13, 0x52, 0x31, 0x3d, 0x43, 0xc9, 0x39, 0xbc, 0xc9,
+ 0x06, 0xb0, 0xb2, 0xa9, 0x0e, 0x59, 0x84, 0x43, 0xa1, 0x01, 0x26, 0xa0, 0x59, 0x01, 0x0e,
+ 0xa9, 0x01, 0x66, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x02, 0x67, 0x73, 0x75, 0x62, 0x6a,
+ 0x65, 0x63, 0x74, 0x3a, 0x00, 0x47, 0x44, 0x50, 0x58, 0x20, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x3a, 0x00, 0x47,
+ 0x44, 0x52, 0x58, 0x20, 0x88, 0x44, 0x82, 0xb6, 0x6c, 0x9c, 0xcb, 0x2e, 0xe8, 0xdc, 0xb4,
+ 0xe9, 0xd3, 0xf7, 0x87, 0x63, 0x03, 0xaa, 0x90, 0x9d, 0xd9, 0xcb, 0xc3, 0x81, 0x03, 0x5b,
+ 0xa9, 0xa2, 0x75, 0xe8, 0xfa, 0x50, 0x3a, 0x00, 0x47, 0x44, 0x53, 0x58, 0x1e, 0xa1, 0x3a,
+ 0x00, 0x01, 0x11, 0x71, 0x77, 0x4d, 0x6f, 0x72, 0x65, 0x20, 0x74, 0x68, 0x61, 0x6e, 0x20,
+ 0x6a, 0x75, 0x73, 0x74, 0x20, 0x6b, 0x65, 0x79, 0x6d, 0x69, 0x6e, 0x74, 0x3f, 0x3a, 0x00,
+ 0x47, 0x44, 0x54, 0x58, 0x20, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,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26, 0xa0, 0x59, 0x02, 0x10,
+ 0x82, 0x58, 0x20, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
+ 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
+ 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x59, 0x01, 0xea, 0x84, 0x03, 0x67, 0x6b, 0x65, 0x79, 0x6d,
+ 0x69, 0x6e, 0x74, 0xae, 0x65, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x66, 0x47, 0x6f, 0x6f, 0x67,
+ 0x6c, 0x65, 0x65, 0x66, 0x75, 0x73, 0x65, 0x64, 0x01, 0x65, 0x6d, 0x6f, 0x64, 0x65, 0x6c,
+ 0x65, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x66, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x66, 0x64,
+ 0x65, 0x76, 0x69, 0x63, 0x65, 0x67, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x65, 0x70,
+ 0x69, 0x78, 0x65, 0x6c, 0x68, 0x76, 0x62, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x65, 0x67,
+ 0x72, 0x65, 0x65, 0x6e, 0x6a, 0x6f, 0x73, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
+ 0x62, 0x31, 0x32, 0x6c, 0x6d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x65,
+ 0x72, 0x66, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x6d, 0x76, 0x62, 0x6d, 0x65, 0x74, 0x61,
+ 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x4f, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
+ 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69,
+ 0x74, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x63, 0x74, 0x65, 0x65, 0x70, 0x62, 0x6f,
+ 0x6f, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x1a,
+ 0x01, 0x34, 0x8c, 0x62, 0x70, 0x62, 0x6f, 0x6f, 0x74, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x72,
+ 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x66, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x72, 0x73,
+ 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x70, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x6c, 0x65, 0x76,
+ 0x65, 0x6c, 0x1a, 0x01, 0x34, 0x8c, 0x61, 0x72, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f,
+ 0x70, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x1a, 0x01, 0x34, 0x8c,
+ 0x63, 0x82, 0xa6, 0x01, 0x02, 0x03, 0x26, 0x20, 0x01, 0x21, 0x58, 0x20, 0x40, 0x9a, 0x39,
+ 0x4d, 0xe2, 0xc5, 0x48, 0x58, 0x6e, 0xaa, 0x17, 0x81, 0x8a, 0xba, 0xc4, 0xea, 0x20, 0x23,
+ 0xc4, 0xf3, 0xdc, 0xfa, 0x78, 0x9f, 0x5b, 0x7d, 0x30, 0xd2, 0x3d, 0x6f, 0x42, 0xa8, 0x22,
+ 0x58, 0x20, 0x3e, 0x85, 0x73, 0xe5, 0x86, 0x57, 0x45, 0x72, 0xcd, 0xf2, 0xe8, 0x62, 0x93,
+ 0xf3, 0xea, 0xbf, 0x21, 0x57, 0xa9, 0x25, 0xe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, 0x85, 0x6e, 0x03, 0x45, 0x55, 0x28, 0xf7,
+ 0x64, 0x0b, 0xbd, 0x7c, 0x3a, 0x69, 0xf1, 0x80, 0x1a, 0xf3, 0x93, 0x7e, 0x82, 0xfc, 0xa5,
+ 0x3b, 0x69, 0x98, 0xf1, 0xde, 0x06, 0xb6, 0x72, 0x78, 0x0b, 0xdb, 0xbb, 0x97, 0x20, 0x04,
+ 0x98, 0xb0, 0xd4, 0x07, 0x83, 0x65, 0xfb, 0xf8, 0x9c, 0xa1, 0x6b, 0x66, 0x69, 0x6e, 0x67,
+ 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x78, 0x3b, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x31,
+ 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x31, 0x2f, 0x64, 0x65, 0x76, 0x69, 0x63,
+ 0x65, 0x31, 0x3a, 0x31, 0x31, 0x2f, 0x69, 0x64, 0x2f, 0x32, 0x30, 0x32, 0x31, 0x30, 0x38,
+ 0x30, 0x35, 0x2e, 0x34, 0x32, 0x3a, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x6c, 0x65,
+ 0x61, 0x73, 0x65, 0x2d, 0x6b, 0x65, 0x79, 0x73};
+
+inline std::vector<uint8_t> kCsrWithDebugMode{
+ 0x85, 0x01, 0xa0, 0x82, 0xa5, 0x01, 0x02, 0x03, 0x26, 0x20, 0x01, 0x21, 0x58, 0x20, 0x03,
+ 0x09, 0xad, 0x0d, 0x07, 0xec, 0x59, 0xfc, 0x14, 0x31, 0x21, 0x1f, 0xbc, 0x8e, 0x44, 0xe7,
+ 0x0f, 0xa9, 0xb7, 0x5a, 0x57, 0x38, 0x5f, 0x76, 0x8a, 0xa3, 0x38, 0x2c, 0xf0, 0x1b, 0x37,
+ 0x15, 0x22, 0x58, 0x20, 0x82, 0xae, 0x09, 0x76, 0x9c, 0x1d, 0x18, 0x39, 0x5d, 0x09, 0xf8,
+ 0x19, 0x86, 0x70, 0x60, 0x12, 0x1e, 0x06, 0xb3, 0x68, 0x4a, 0x27, 0x2c, 0x79, 0xd3, 0x83,
+ 0xb8, 0x54, 0x5b, 0x9f, 0xc0, 0x9f, 0x84, 0x43, 0xa1, 0x01, 0x26, 0xa0, 0x59, 0x01, 0x04,
+ 0xa9, 0x01, 0x66, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x02, 0x67, 0x73, 0x75, 0x62, 0x6a,
+ 0x65, 0x63, 0x74, 0x3a, 0x00, 0x47, 0x44, 0x50, 0x58, 0x20, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x3a, 0x00, 0x47,
+ 0x44, 0x52, 0x58, 0x20, 0xb8, 0x96, 0x54, 0xe2, 0x2c, 0xa4, 0xd2, 0x4a, 0x9c, 0x0e, 0x45,
+ 0x11, 0xc8, 0xf2, 0x63, 0xf0, 0x66, 0x0d, 0x2e, 0x20, 0x48, 0x96, 0x90, 0x14, 0xf4, 0x54,
+ 0x63, 0xc4, 0xf4, 0x39, 0x30, 0x38, 0x3a, 0x00, 0x47, 0x44, 0x53, 0x55, 0xa1, 0x3a, 0x00,
+ 0x01, 0x11, 0x71, 0x6e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x6e,
+ 0x61, 0x6d, 0x65, 0x3a, 0x00, 0x47, 0x44, 0x54, 0x58, 0x20, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,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, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
+ 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x59, 0x01, 0xe9, 0x84, 0x03,
+ 0x67, 0x6b, 0x65, 0x79, 0x6d, 0x69, 0x6e, 0x74, 0xae, 0x65, 0x62, 0x72, 0x61, 0x6e, 0x64,
+ 0x66, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x65, 0x66, 0x75, 0x73, 0x65, 0x64, 0x01, 0x65,
+ 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x65, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x66, 0x64, 0x65, 0x76,
+ 0x69, 0x63, 0x65, 0x66, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x67, 0x70, 0x72, 0x6f, 0x64,
+ 0x75, 0x63, 0x74, 0x65, 0x70, 0x69, 0x78, 0x65, 0x6c, 0x68, 0x76, 0x62, 0x5f, 0x73, 0x74,
+ 0x61, 0x74, 0x65, 0x65, 0x67, 0x72, 0x65, 0x65, 0x6e, 0x6a, 0x6f, 0x73, 0x5f, 0x76, 0x65,
+ 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x62, 0x31, 0x32, 0x6c, 0x6d, 0x61, 0x6e, 0x75, 0x66, 0x61,
+ 0x63, 0x74, 0x75, 0x72, 0x65, 0x72, 0x66, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x6d, 0x76,
+ 0x62, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x4f, 0x11, 0x22,
+ 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x6e, 0x73,
+ 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x63, 0x74,
+ 0x65, 0x65, 0x70, 0x62, 0x6f, 0x6f, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x6c,
+ 0x65, 0x76, 0x65, 0x6c, 0x1a, 0x01, 0x34, 0x8c, 0x62, 0x70, 0x62, 0x6f, 0x6f, 0x74, 0x6c,
+ 0x6f, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x66, 0x6c, 0x6f, 0x63,
+ 0x6b, 0x65, 0x64, 0x72, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x70, 0x61, 0x74, 0x63,
+ 0x68, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x1a, 0x01, 0x34, 0x8c, 0x61, 0x72, 0x76, 0x65,
+ 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x70, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x6c, 0x65, 0x76, 0x65,
+ 0x6c, 0x1a, 0x01, 0x34, 0x8c, 0x63, 0x82, 0xa6, 0x01, 0x02, 0x03, 0x26, 0x20, 0x01, 0x21,
+ 0x58, 0x20, 0x78, 0xa9, 0x66, 0xc0, 0xc1, 0x92, 0xc9, 0x0d, 0x74, 0xbf, 0x81, 0x99, 0xe6,
+ 0x7c, 0x61, 0xb2, 0xc3, 0x41, 0x27, 0x4e, 0x92, 0xd8, 0xd8, 0xf8, 0x34, 0x43, 0x81, 0xe1,
+ 0x9c, 0x5f, 0xed, 0xbb, 0x22, 0x58, 0x20, 0x80, 0x05, 0x96, 0xe5, 0x65, 0x7e, 0xa8, 0x5b,
+ 0x58, 0xf7, 0x2c, 0xb8, 0x28, 0x95, 0x34, 0x7a, 0x88, 0xd5, 0xe2, 0x1c, 0x20, 0x01, 0xd7,
+ 0x60, 0xfe, 0xec, 0xf1, 0x3f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0e, 0x9f, 0x11, 0xc9, 0x04, 0xa7, 0xdf, 0xe1, 0x21, 0x1e, 0xc1,
+ 0x10, 0x10, 0x64, 0xf7, 0xeb, 0xcc, 0x3a, 0x4c, 0xa6, 0xdf, 0xd8, 0xf5, 0xcc, 0x0d, 0x34,
+ 0xa4, 0x32, 0xf4, 0x0a, 0xd7, 0x83, 0x1e, 0x30, 0x0d, 0x68, 0x6a, 0xb4, 0xc1, 0xa1, 0x6b,
+ 0x66, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x78, 0x3b, 0x62, 0x72,
+ 0x61, 0x6e, 0x64, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x31, 0x2f, 0x64,
+ 0x65, 0x76, 0x69, 0x63, 0x65, 0x31, 0x3a, 0x31, 0x31, 0x2f, 0x69, 0x64, 0x2f, 0x32, 0x30,
+ 0x32, 0x31, 0x30, 0x38, 0x30, 0x35, 0x2e, 0x34, 0x32, 0x3a, 0x75, 0x73, 0x65, 0x72, 0x2f,
+ 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x2d, 0x6b, 0x65, 0x79, 0x73};
+
inline const std::vector<uint8_t> kCsrWithSharedUdsRoot1{
0x85, 0x01, 0xa0, 0x82, 0xa5, 0x01, 0x02, 0x03, 0x26, 0x20, 0x01, 0x21, 0x58, 0x20, 0x96,
0xf9, 0xf7, 0x16, 0xa7, 0xe2, 0x20, 0xe3, 0x6e, 0x19, 0x8e, 0xc0, 0xc4, 0x82, 0xc5, 0xca,
@@ -930,6 +1081,27 @@
ASSERT_FALSE(*notEqual) << "Root public keys in DICE chains match.";
}
+TEST(RemoteProvUtilsTest, componentNameInLeafCertificateOfDiceChainContainsKeyMint) {
+ auto result = verifyComponentNameInKeyMintDiceChain(kCsrWithKeyMintInComponentName);
+ ASSERT_TRUE(result) << result.message();
+ ASSERT_TRUE(*result) << "Leaf Certificate in CSR does not contain 'keymint' in component name";
+
+ auto result2 = verifyComponentNameInKeyMintDiceChain(kCsrWithUdsCerts);
+ ASSERT_TRUE(result2) << result2.message();
+ ASSERT_FALSE(*result2) << "Leaf Certificate in CSR contains 'keymint' in component name";
+}
+
+TEST(RemoteProvUtilsTest, checkModeOnCertificatesInDiceChain) {
+ auto hasNonNormalMode = hasNonNormalModeInDiceChain(kCsrWithDebugMode, DEFAULT_INSTANCE_NAME);
+ ASSERT_TRUE(hasNonNormalMode) << hasNonNormalMode.message();
+ ASSERT_TRUE(*hasNonNormalMode);
+
+ auto hasNonNormalModeInDiceChain2 =
+ hasNonNormalModeInDiceChain(kCsrWithUdsCerts, DEFAULT_INSTANCE_NAME);
+ ASSERT_TRUE(hasNonNormalModeInDiceChain2) << hasNonNormalModeInDiceChain2.message();
+ ASSERT_FALSE(*hasNonNormalModeInDiceChain2);
+}
+
TEST(RemoteProvUtilsTest, parseFullyQualifiedInstanceNames) {
ASSERT_EQ(deviceSuffix(RKPVM_INSTANCE_NAME), "avf");
ASSERT_EQ(deviceSuffix(DEFAULT_INSTANCE_NAME), "default");
diff --git a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
index d9bd0d8..f40a752 100644
--- a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
+++ b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
@@ -238,6 +238,7 @@
* on the device.
*/
// @VsrTest = 3.10-015
+// @VsrTest = 3.10-018.001
TEST(NonParameterizedTests, requireDiceOnDefaultInstanceIfStrongboxPresent) {
int vsr_api_level = get_vsr_api_level();
if (vsr_api_level < 35) {
@@ -270,12 +271,10 @@
// @VsrTest = 7.1-003.001
TEST(NonParameterizedTests, equalUdsPubInDiceCertChainForRkpVmAndPrimaryKeyMintInstances) {
int apiLevel = get_vsr_api_level();
- if (apiLevel < 202504) {
- if (!AServiceManager_isDeclared(RKPVM_INSTANCE_NAME.c_str())) {
- GTEST_SKIP() << "The RKP VM (" << RKPVM_INSTANCE_NAME
- << ") is not present on this device.";
- }
- } else {
+ if (apiLevel < 202504 && !AServiceManager_isDeclared(RKPVM_INSTANCE_NAME.c_str())) {
+ GTEST_SKIP() << "The RKP VM (" << RKPVM_INSTANCE_NAME << ") is not present on this device.";
+ }
+ if (apiLevel >= 202504) {
ASSERT_TRUE(AServiceManager_isDeclared(RKPVM_INSTANCE_NAME.c_str()));
}
@@ -311,6 +310,40 @@
ASSERT_TRUE(*equal) << "Primary KeyMint and RKP VM RPCs have different UDS public keys";
}
+/**
+ * Suppose that there is a StrongBox KeyMint instance on the device.
+ *
+ * Then, this test verifies that "keymint" is a substring of the component name in the configuration
+ * descriptor in the leaf certificate of the DICE chain for the primary ("default") KeyMint
+ * instance.
+ */
+// @VsrTest = 3.10-018.003
+TEST(NonParameterizedTests, componentNameInConfigurationDescriptorForPrimaryKeyMintInstance) {
+ int vsr_api_level = get_vsr_api_level();
+ if (vsr_api_level < 202504) {
+ GTEST_SKIP() << "Applies only to VSR API level 202504 or newer, this device is: "
+ << vsr_api_level;
+ }
+
+ if (!AServiceManager_isDeclared(KEYMINT_STRONGBOX_INSTANCE_NAME.c_str())) {
+ GTEST_SKIP() << "Strongbox is not present on this device.";
+ }
+
+ ::ndk::SpAIBinder binder(AServiceManager_waitForService(DEFAULT_INSTANCE_NAME.c_str()));
+ std::shared_ptr<IRemotelyProvisionedComponent> rpc =
+ IRemotelyProvisionedComponent::fromBinder(binder);
+ ASSERT_NE(rpc, nullptr);
+
+ bytevec challenge = randomBytes(64);
+ bytevec csr;
+ auto status = rpc->generateCertificateRequestV2({} /* keysToSign */, challenge, &csr);
+ EXPECT_TRUE(status.isOk()) << status.getDescription();
+
+ auto result = verifyComponentNameInKeyMintDiceChain(csr);
+ ASSERT_TRUE(result) << result.message();
+ ASSERT_TRUE(*result);
+}
+
using GetHardwareInfoTests = VtsRemotelyProvisionedComponentTests;
INSTANTIATE_REM_PROV_AIDL_TEST(GetHardwareInfoTests);
@@ -816,6 +849,37 @@
};
/**
+ * Check that ro.boot.vbmeta.device_state is not "locked" or ro.boot.verifiedbootstate
+ * is not "green" if and only if the mode on at least one certificate in the DICE chain
+ * is non-normal.
+ */
+TEST_P(CertificateRequestV2Test, unlockedBootloaderStatesImpliesNonnormalDiceChain) {
+ auto challenge = randomBytes(MAX_CHALLENGE_SIZE);
+ bytevec csr;
+ auto status =
+ provisionable_->generateCertificateRequestV2({} /* keysToSign */, challenge, &csr);
+ ASSERT_TRUE(status.isOk()) << status.getDescription();
+
+ auto isProper = isCsrWithProperDiceChain(csr, GetParam());
+ ASSERT_TRUE(isProper) << isProper.message();
+ if (!*isProper) {
+ GTEST_SKIP() << "Skipping test: Only a proper DICE chain has a mode set.";
+ }
+
+ auto nonNormalMode = hasNonNormalModeInDiceChain(csr, GetParam());
+ ASSERT_TRUE(nonNormalMode) << nonNormalMode.message();
+
+ auto deviceState = ::android::base::GetProperty("ro.boot.vbmeta.device_state", "");
+ auto verifiedBootState = ::android::base::GetProperty("ro.boot.verifiedbootstate", "");
+
+ ASSERT_EQ(deviceState != "locked" || verifiedBootState != "green", *nonNormalMode)
+ << "ro.boot.vbmeta.device_state = '" << deviceState
+ << "' and ro.boot.verifiedbootstate = '" << verifiedBootState << "', but it is "
+ << *nonNormalMode
+ << " that the DICE chain has a certificate with a non-normal mode set.";
+}
+
+/**
* Generate an empty certificate request with all possible length of challenge, and decrypt and
* verify the structure and content.
*/