Merge "Add presubmit tests to NNAPI -- hardware/interfaces/neuralnetworks"
diff --git a/audio/effect/5.0/xml/api/current.txt b/audio/effect/5.0/xml/api/current.txt
index 473bb10..ef467c9 100644
--- a/audio/effect/5.0/xml/api/current.txt
+++ b/audio/effect/5.0/xml/api/current.txt
@@ -1,27 +1,27 @@
// Signature format: 2.0
package audio.effects.V5_0 {
- public class Audioeffectsconf {
- ctor public Audioeffectsconf();
+ public class AudioEffectsConf {
+ ctor public AudioEffectsConf();
method public audio.effects.V5_0.EffectsType getEffects();
method public audio.effects.V5_0.LibrariesType getLibraries();
- method public audio.effects.V5_0.Audioeffectsconf.Postprocess getPostprocess();
- method public audio.effects.V5_0.Audioeffectsconf.Preprocess getPreprocess();
+ method public audio.effects.V5_0.AudioEffectsConf.Postprocess getPostprocess();
+ method public audio.effects.V5_0.AudioEffectsConf.Preprocess getPreprocess();
method public audio.effects.V5_0.VersionType getVersion();
method public void setEffects(audio.effects.V5_0.EffectsType);
method public void setLibraries(audio.effects.V5_0.LibrariesType);
- method public void setPostprocess(audio.effects.V5_0.Audioeffectsconf.Postprocess);
- method public void setPreprocess(audio.effects.V5_0.Audioeffectsconf.Preprocess);
+ method public void setPostprocess(audio.effects.V5_0.AudioEffectsConf.Postprocess);
+ method public void setPreprocess(audio.effects.V5_0.AudioEffectsConf.Preprocess);
method public void setVersion(audio.effects.V5_0.VersionType);
}
- public static class Audioeffectsconf.Postprocess {
- ctor public Audioeffectsconf.Postprocess();
+ public static class AudioEffectsConf.Postprocess {
+ ctor public AudioEffectsConf.Postprocess();
method public java.util.List<audio.effects.V5_0.StreamPostprocessType> getStream();
}
- public static class Audioeffectsconf.Preprocess {
- ctor public Audioeffectsconf.Preprocess();
+ public static class AudioEffectsConf.Preprocess {
+ ctor public AudioEffectsConf.Preprocess();
method public java.util.List<audio.effects.V5_0.StreamPreprocessType> getStream();
}
@@ -123,7 +123,7 @@
public class XmlParser {
ctor public XmlParser();
- method public static audio.effects.V5_0.Audioeffectsconf read(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+ method public static audio.effects.V5_0.AudioEffectsConf read(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public static String readText(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public static void skip(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
}
diff --git a/camera/device/3.5/default/CameraDeviceSession.cpp b/camera/device/3.5/default/CameraDeviceSession.cpp
index d9c6eef..873ddd0 100644
--- a/camera/device/3.5/default/CameraDeviceSession.cpp
+++ b/camera/device/3.5/default/CameraDeviceSession.cpp
@@ -186,111 +186,118 @@
}
ATRACE_END();
- if (status == BufferRequestStatus::OK || status == BufferRequestStatus::FAILED_PARTIAL) {
- if (bufRets.size() != num_buffer_reqs) {
- ALOGE("%s: expect %d buffer requests returned, only got %zu",
- __FUNCTION__, num_buffer_reqs, bufRets.size());
- return CAMERA3_BUF_REQ_FAILED_UNKNOWN;
- }
-
- for (size_t i = 0; i < num_buffer_reqs; i++) {
- // maybe we can query all streams in one call to avoid frequent locking device here?
- Camera3Stream* stream = getStreamPointer(bufRets[i].streamId);
- if (stream == nullptr) {
- ALOGE("%s: unknown streamId %d", __FUNCTION__, bufRets[i].streamId);
- return CAMERA3_BUF_REQ_FAILED_UNKNOWN;
- }
- returned_buf_reqs[i].stream = stream;
- }
-
- std::vector<int> importedFences;
- std::vector<std::pair<buffer_handle_t, int>> importedBuffers;
- for (size_t i = 0; i < num_buffer_reqs; i++) {
- int streamId = bufRets[i].streamId;
- switch (bufRets[i].val.getDiscriminator()) {
- case StreamBuffersVal::hidl_discriminator::error:
- returned_buf_reqs[i].num_output_buffers = 0;
- switch (bufRets[i].val.error()) {
- case StreamBufferRequestError::NO_BUFFER_AVAILABLE:
- returned_buf_reqs[i].status = CAMERA3_PS_BUF_REQ_NO_BUFFER_AVAILABLE;
- break;
- case StreamBufferRequestError::MAX_BUFFER_EXCEEDED:
- returned_buf_reqs[i].status = CAMERA3_PS_BUF_REQ_MAX_BUFFER_EXCEEDED;
- break;
- case StreamBufferRequestError::STREAM_DISCONNECTED:
- returned_buf_reqs[i].status = CAMERA3_PS_BUF_REQ_STREAM_DISCONNECTED;
- break;
- case StreamBufferRequestError::UNKNOWN_ERROR:
- returned_buf_reqs[i].status = CAMERA3_PS_BUF_REQ_UNKNOWN_ERROR;
- break;
- default:
- ALOGE("%s: Unknown StreamBufferRequestError %d",
- __FUNCTION__, bufRets[i].val.error());
- cleanupInflightBufferFences(importedFences, importedBuffers);
- return CAMERA3_BUF_REQ_FAILED_UNKNOWN;
- }
- break;
- case StreamBuffersVal::hidl_discriminator::buffers: {
- const hidl_vec<StreamBuffer>& hBufs = bufRets[i].val.buffers();
- camera3_stream_buffer_t* outBufs = returned_buf_reqs[i].output_buffers;
- for (size_t b = 0; b < hBufs.size(); b++) {
- const StreamBuffer& hBuf = hBufs[b];
- camera3_stream_buffer_t& outBuf = outBufs[b];
- // maybe add importBuffers API to avoid frequent locking device?
- Status s = importBuffer(streamId,
- hBuf.bufferId, hBuf.buffer.getNativeHandle(),
- /*out*/&(outBuf.buffer),
- /*allowEmptyBuf*/false);
- if (s != Status::OK) {
- ALOGE("%s: import stream %d bufferId %" PRIu64 " failed!",
- __FUNCTION__, streamId, hBuf.bufferId);
- cleanupInflightBufferFences(importedFences, importedBuffers);
- // Buffer import should never fail - restart HAL since something is very
- // wrong.
- assert(false);
- return CAMERA3_BUF_REQ_FAILED_UNKNOWN;
- }
-
- pushBufferId(*(outBuf.buffer), hBuf.bufferId, streamId);
- importedBuffers.push_back(std::make_pair(*(outBuf.buffer), streamId));
-
- if (!sHandleImporter.importFence(
- hBuf.acquireFence,
- outBuf.acquire_fence)) {
- ALOGE("%s: stream %d bufferId %" PRIu64 "acquire fence is invalid",
- __FUNCTION__, streamId, hBuf.bufferId);
- cleanupInflightBufferFences(importedFences, importedBuffers);
- return CAMERA3_BUF_REQ_FAILED_UNKNOWN;
- }
- importedFences.push_back(outBuf.acquire_fence);
- outBuf.stream = returned_buf_reqs[i].stream;
- outBuf.status = CAMERA3_BUFFER_STATUS_OK;
- outBuf.release_fence = -1;
- }
- returned_buf_reqs[i].status = CAMERA3_PS_BUF_REQ_OK;
- } break;
- default:
- ALOGE("%s: unknown StreamBuffersVal discrimator!", __FUNCTION__);
- cleanupInflightBufferFences(importedFences, importedBuffers);
- return CAMERA3_BUF_REQ_FAILED_UNKNOWN;
- }
- }
-
- *num_returned_buf_reqs = num_buffer_reqs;
-
- return (status == BufferRequestStatus::OK) ?
- CAMERA3_BUF_REQ_OK : CAMERA3_BUF_REQ_FAILED_PARTIAL;
- }
-
switch (status) {
case BufferRequestStatus::FAILED_CONFIGURING:
return CAMERA3_BUF_REQ_FAILED_CONFIGURING;
case BufferRequestStatus::FAILED_ILLEGAL_ARGUMENTS:
return CAMERA3_BUF_REQ_FAILED_ILLEGAL_ARGUMENTS;
- case BufferRequestStatus::FAILED_UNKNOWN:
default:
- return CAMERA3_BUF_REQ_FAILED_UNKNOWN;
+ break; // Other status Handled by following code
}
+
+ if (status != BufferRequestStatus::OK && status != BufferRequestStatus::FAILED_PARTIAL &&
+ status != BufferRequestStatus::FAILED_UNKNOWN) {
+ ALOGE("%s: unknown buffer request error code %d", __FUNCTION__, status);
+ return CAMERA3_BUF_REQ_FAILED_UNKNOWN;
+ }
+
+ // Only OK, FAILED_PARTIAL and FAILED_UNKNOWN reaches here
+ if (bufRets.size() != num_buffer_reqs) {
+ ALOGE("%s: expect %d buffer requests returned, only got %zu",
+ __FUNCTION__, num_buffer_reqs, bufRets.size());
+ return CAMERA3_BUF_REQ_FAILED_UNKNOWN;
+ }
+
+ *num_returned_buf_reqs = num_buffer_reqs;
+ for (size_t i = 0; i < num_buffer_reqs; i++) {
+ // maybe we can query all streams in one call to avoid frequent locking device here?
+ Camera3Stream* stream = getStreamPointer(bufRets[i].streamId);
+ if (stream == nullptr) {
+ ALOGE("%s: unknown streamId %d", __FUNCTION__, bufRets[i].streamId);
+ return CAMERA3_BUF_REQ_FAILED_UNKNOWN;
+ }
+ returned_buf_reqs[i].stream = stream;
+ }
+
+ // Handle failed streams
+ for (size_t i = 0; i < num_buffer_reqs; i++) {
+ if (bufRets[i].val.getDiscriminator() == StreamBuffersVal::hidl_discriminator::error) {
+ returned_buf_reqs[i].num_output_buffers = 0;
+ switch (bufRets[i].val.error()) {
+ case StreamBufferRequestError::NO_BUFFER_AVAILABLE:
+ returned_buf_reqs[i].status = CAMERA3_PS_BUF_REQ_NO_BUFFER_AVAILABLE;
+ break;
+ case StreamBufferRequestError::MAX_BUFFER_EXCEEDED:
+ returned_buf_reqs[i].status = CAMERA3_PS_BUF_REQ_MAX_BUFFER_EXCEEDED;
+ break;
+ case StreamBufferRequestError::STREAM_DISCONNECTED:
+ returned_buf_reqs[i].status = CAMERA3_PS_BUF_REQ_STREAM_DISCONNECTED;
+ break;
+ case StreamBufferRequestError::UNKNOWN_ERROR:
+ returned_buf_reqs[i].status = CAMERA3_PS_BUF_REQ_UNKNOWN_ERROR;
+ break;
+ default:
+ ALOGE("%s: Unknown StreamBufferRequestError %d",
+ __FUNCTION__, bufRets[i].val.error());
+ return CAMERA3_BUF_REQ_FAILED_UNKNOWN;
+ }
+ }
+ }
+
+ if (status == BufferRequestStatus::FAILED_UNKNOWN) {
+ return CAMERA3_BUF_REQ_FAILED_UNKNOWN;
+ }
+
+ // Only BufferRequestStatus::OK and BufferRequestStatus::FAILED_PARTIAL reaches here
+ std::vector<int> importedFences;
+ std::vector<std::pair<buffer_handle_t, int>> importedBuffers;
+ for (size_t i = 0; i < num_buffer_reqs; i++) {
+ if (bufRets[i].val.getDiscriminator() !=
+ StreamBuffersVal::hidl_discriminator::buffers) {
+ continue;
+ }
+ int streamId = bufRets[i].streamId;
+ const hidl_vec<StreamBuffer>& hBufs = bufRets[i].val.buffers();
+ camera3_stream_buffer_t* outBufs = returned_buf_reqs[i].output_buffers;
+ for (size_t b = 0; b < hBufs.size(); b++) {
+ const StreamBuffer& hBuf = hBufs[b];
+ camera3_stream_buffer_t& outBuf = outBufs[b];
+ // maybe add importBuffers API to avoid frequent locking device?
+ Status s = importBuffer(streamId,
+ hBuf.bufferId, hBuf.buffer.getNativeHandle(),
+ /*out*/&(outBuf.buffer),
+ /*allowEmptyBuf*/false);
+ if (s != Status::OK) {
+ ALOGE("%s: import stream %d bufferId %" PRIu64 " failed!",
+ __FUNCTION__, streamId, hBuf.bufferId);
+ cleanupInflightBufferFences(importedFences, importedBuffers);
+ // Buffer import should never fail - restart HAL since something is very
+ // wrong.
+ assert(false);
+ return CAMERA3_BUF_REQ_FAILED_UNKNOWN;
+ }
+
+ pushBufferId(*(outBuf.buffer), hBuf.bufferId, streamId);
+ importedBuffers.push_back(std::make_pair(*(outBuf.buffer), streamId));
+
+ if (!sHandleImporter.importFence(
+ hBuf.acquireFence,
+ outBuf.acquire_fence)) {
+ ALOGE("%s: stream %d bufferId %" PRIu64 "acquire fence is invalid",
+ __FUNCTION__, streamId, hBuf.bufferId);
+ cleanupInflightBufferFences(importedFences, importedBuffers);
+ return CAMERA3_BUF_REQ_FAILED_UNKNOWN;
+ }
+ importedFences.push_back(outBuf.acquire_fence);
+ outBuf.stream = returned_buf_reqs[i].stream;
+ outBuf.status = CAMERA3_BUFFER_STATUS_OK;
+ outBuf.release_fence = -1;
+ }
+ returned_buf_reqs[i].status = CAMERA3_PS_BUF_REQ_OK;
+ }
+
+ return (status == BufferRequestStatus::OK) ?
+ CAMERA3_BUF_REQ_OK : CAMERA3_BUF_REQ_FAILED_PARTIAL;
}
void CameraDeviceSession::returnStreamBuffers(
diff --git a/camera/device/3.5/types.hal b/camera/device/3.5/types.hal
index 7cb9727..e3c2350 100644
--- a/camera/device/3.5/types.hal
+++ b/camera/device/3.5/types.hal
@@ -120,7 +120,9 @@
/**
* Method call failed for all streams and no buffers are returned at all.
- * Failure due to unknown reason.
+ * Failure due to unknown reason, or all streams has individual failing
+ * reason. For the latter case, check per stream status for each returned
+ * StreamBufferRet.
*/
FAILED_UNKNOWN = 4,
};
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index b9828fb..2f9fb6e 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -113,7 +113,7 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.camera.provider</name>
- <version>2.5</version>
+ <version>2.4-5</version>
<interface>
<name>ICameraProvider</name>
<regex-instance>[^/]+/[0-9]+</regex-instance>
diff --git a/current.txt b/current.txt
index fd55d7c..a128669 100644
--- a/current.txt
+++ b/current.txt
@@ -444,7 +444,7 @@
09ab9b24994429d9bb32a3fb420b6f6be3e47eb655139a2c08c4e80d3f33ff95 android.hardware.camera.device@3.5::ICameraDevice
06237de53c42890029e3f8fe7d1480d078469c0d07608e51c37b4d485d342992 android.hardware.camera.device@3.5::ICameraDeviceCallback
08c68b196e2fc4e5ba67ba0d0917bde828a87cbe2cffec19d04733972da9eb49 android.hardware.camera.device@3.5::ICameraDeviceSession
-d487ab209944df8987eeca70cf09307fc1429cedf64b0ea9e77c61d8caeb8c15 android.hardware.camera.device@3.5::types
+acaba39216973e58949f50978762bcda1c29f5f7e0bca3e08db21f0767356130 android.hardware.camera.device@3.5::types
74ec7732fdacb22292c907b49f8f933510851ea1b3ed195c4dcdff35a20387f5 android.hardware.camera.metadata@3.4::types
0fb39a7809ad1c52b3efbbed5ef4749b06c2a4f1f19cdc3efa2e3d9b28f1205c android.hardware.camera.provider@2.5::ICameraProvider
f5777403d65135a5407723671bc7a864cdca83aea13ee3ce2894b95e6588ca3a android.hardware.camera.provider@2.5::types
@@ -508,7 +508,7 @@
92714960d1a53fc2ec557302b41c7cc93d2636d8364a44bd0f85be0c92927ff8 android.hardware.neuralnetworks@1.2::IExecutionCallback
83885d366f22ada42c00d8854f0b7e7ba4cf73ddf80bb0d8e168ce132cec57ea android.hardware.neuralnetworks@1.2::IPreparedModel
e1c734d1545e1a4ae749ff1dd9704a8e594c59aea7c8363159dc258e93e0df3b android.hardware.neuralnetworks@1.2::IPreparedModelCallback
-313b341f1f6196a48cf304eaf067f67510c1ebc04df8c7cd536db5611df5c5c2 android.hardware.neuralnetworks@1.2::types
+769f8650631eef7a3ceedc8cf130f4b99eb52fe698a11609d55de32985a3dddf android.hardware.neuralnetworks@1.2::types
cf7a4ba516a638f9b82a249c91fb603042c2d9ca43fd5aad9cf6c0401ed2a5d7 android.hardware.nfc@1.2::INfc
abf98c2ae08bf765db54edc8068e36d52eb558cff6706b6fd7c18c65a1f3fc18 android.hardware.nfc@1.2::types
4cb252dc6372a874aef666b92a6e9529915aa187521a700f0789065c3c702ead android.hardware.power.stats@1.0::IPowerStats
@@ -550,6 +550,6 @@
067b22efc50529a88d650fe7400603429d1164a47ee96a17476fdb0aadd6b4d3 android.hardware.wifi.supplicant@1.2::ISupplicant
120211371fdd29fb134837071d432a302d7b60e9b95af611dd8dde86bd1f77ee android.hardware.wifi.supplicant@1.2::ISupplicantP2pIface
7efe2b057e9f9387b3500e67af97942aa7c8008e6ee7d8dcaae4107fda84016b android.hardware.wifi.supplicant@1.2::ISupplicantStaIface
-eb569df2e80f8e276a91a510c75e83fbf957ff1988691726418d44c2be01c520 android.hardware.wifi.supplicant@1.2::ISupplicantStaIfaceCallback
+09e08b5d12b109562ecdd8882532fd1f2c4639588e07769d5c7396b7c5b9f34f android.hardware.wifi.supplicant@1.2::ISupplicantStaIfaceCallback
efbb061c969fa9553d243da6ee23b83fe5d4aa663a7b8896adc52e2b015bc2f3 android.hardware.wifi.supplicant@1.2::ISupplicantStaNetwork
-4851210036650ce6c86498c012db5ff618afce8508a2b06a0e9b902d1840f4bd android.hardware.wifi.supplicant@1.2::types
+cfa81f229b69f9011c58f48264fcb552447430fe68610eac514e811e65bc306a android.hardware.wifi.supplicant@1.2::types
diff --git a/gnss/1.1/default/Android.bp b/gnss/1.1/default/Android.bp
index 44aed2b..8c3aac4 100644
--- a/gnss/1.1/default/Android.bp
+++ b/gnss/1.1/default/Android.bp
@@ -18,4 +18,7 @@
"android.hardware.gnss@1.1",
"android.hardware.gnss@1.0",
],
+ static_libs: [
+ "android.hardware.gnss@common-default-lib",
+ ],
}
diff --git a/gnss/1.1/default/Gnss.cpp b/gnss/1.1/default/Gnss.cpp
index bbf1cd3..4abe707 100644
--- a/gnss/1.1/default/Gnss.cpp
+++ b/gnss/1.1/default/Gnss.cpp
@@ -4,9 +4,9 @@
#include <log/log.h>
#include "Gnss.h"
-#include "GnssConstants.h"
#include "GnssDebug.h"
#include "GnssMeasurement.h"
+#include "Utils.h"
namespace android {
namespace hardware {
@@ -14,6 +14,7 @@
namespace V1_1 {
namespace implementation {
+using ::android::hardware::gnss::common::Utils;
using GnssSvFlags = IGnssCallback::GnssSvFlags;
const uint32_t MIN_INTERVAL_MILLIS = 100;
@@ -43,7 +44,7 @@
auto svStatus = this->getMockSvStatus();
this->reportSvStatus(svStatus);
- auto location = this->getMockLocation();
+ auto location = Utils::getMockLocation();
this->reportLocation(location);
std::this_thread::sleep_for(std::chrono::milliseconds(mMinIntervalMs));
@@ -193,44 +194,17 @@
return true;
}
-Return<GnssLocation> Gnss::getMockLocation() const {
- GnssLocation location = {.gnssLocationFlags = 0xFF,
- .latitudeDegrees = kMockLatitudeDegrees,
- .longitudeDegrees = kMockLongitudeDegrees,
- .altitudeMeters = kMockAltitudeMeters,
- .speedMetersPerSec = kMockSpeedMetersPerSec,
- .bearingDegrees = kMockBearingDegrees,
- .horizontalAccuracyMeters = kMockHorizontalAccuracyMeters,
- .verticalAccuracyMeters = kMockVerticalAccuracyMeters,
- .speedAccuracyMetersPerSecond = kMockSpeedAccuracyMetersPerSecond,
- .bearingAccuracyDegrees = kMockBearingAccuracyDegrees,
- .timestamp = kMockTimestamp};
- return location;
-}
-
-Return<GnssSvInfo> Gnss::getSvInfo(int16_t svid, GnssConstellationType type, float cN0DbHz,
- float elevationDegrees, float azimuthDegrees) const {
- GnssSvInfo svInfo = {.svid = svid,
- .constellation = type,
- .cN0Dbhz = cN0DbHz,
- .elevationDegrees = elevationDegrees,
- .azimuthDegrees = azimuthDegrees,
- .svFlag = GnssSvFlags::USED_IN_FIX | GnssSvFlags::HAS_EPHEMERIS_DATA |
- GnssSvFlags::HAS_ALMANAC_DATA};
- return svInfo;
-}
-
Return<GnssSvStatus> Gnss::getMockSvStatus() const {
std::unique_lock<std::recursive_mutex> lock(mGnssConfiguration->getMutex());
GnssSvInfo mockGnssSvInfoList[] = {
- getSvInfo(3, GnssConstellationType::GPS, 32.5, 59.1, 166.5),
- getSvInfo(5, GnssConstellationType::GPS, 27.0, 29.0, 56.5),
- getSvInfo(17, GnssConstellationType::GPS, 30.5, 71.0, 77.0),
- getSvInfo(26, GnssConstellationType::GPS, 24.1, 28.0, 253.0),
- getSvInfo(5, GnssConstellationType::GLONASS, 20.5, 11.5, 116.0),
- getSvInfo(17, GnssConstellationType::GLONASS, 21.5, 28.5, 186.0),
- getSvInfo(18, GnssConstellationType::GLONASS, 28.3, 38.8, 69.0),
- getSvInfo(10, GnssConstellationType::GLONASS, 25.0, 66.0, 247.0)};
+ Utils::getSvInfo(3, GnssConstellationType::GPS, 32.5, 59.1, 166.5),
+ Utils::getSvInfo(5, GnssConstellationType::GPS, 27.0, 29.0, 56.5),
+ Utils::getSvInfo(17, GnssConstellationType::GPS, 30.5, 71.0, 77.0),
+ Utils::getSvInfo(26, GnssConstellationType::GPS, 24.1, 28.0, 253.0),
+ Utils::getSvInfo(5, GnssConstellationType::GLONASS, 20.5, 11.5, 116.0),
+ Utils::getSvInfo(17, GnssConstellationType::GLONASS, 21.5, 28.5, 186.0),
+ Utils::getSvInfo(18, GnssConstellationType::GLONASS, 28.3, 38.8, 69.0),
+ Utils::getSvInfo(10, GnssConstellationType::GLONASS, 25.0, 66.0, 247.0)};
GnssSvStatus svStatus = {.numSvs = sizeof(mockGnssSvInfoList) / sizeof(GnssSvInfo)};
for (uint32_t i = 0; i < svStatus.numSvs; i++) {
diff --git a/gnss/1.1/default/Gnss.h b/gnss/1.1/default/Gnss.h
index 99af34c..21b66a2 100644
--- a/gnss/1.1/default/Gnss.h
+++ b/gnss/1.1/default/Gnss.h
@@ -84,10 +84,7 @@
// Methods from ::android::hidl::base::V1_0::IBase follow.
private:
- Return<GnssLocation> getMockLocation() const;
Return<GnssSvStatus> getMockSvStatus() const;
- Return<GnssSvInfo> getSvInfo(int16_t svid, GnssConstellationType type, float cN0DbHz,
- float elevationDegress, float azimuthDegress) const;
Return<void> reportLocation(const GnssLocation&) const;
Return<void> reportSvStatus(const GnssSvStatus&) const;
diff --git a/gnss/1.1/default/GnssDebug.cpp b/gnss/1.1/default/GnssDebug.cpp
index 62870e4..471ed24 100644
--- a/gnss/1.1/default/GnssDebug.cpp
+++ b/gnss/1.1/default/GnssDebug.cpp
@@ -18,9 +18,11 @@
#include <log/log.h>
-#include "GnssConstants.h"
+#include "Constants.h"
#include "GnssDebug.h"
+using namespace ::android::hardware::gnss::common;
+
namespace android {
namespace hardware {
namespace gnss {
diff --git a/gnss/1.1/vts/functional/Android.bp b/gnss/1.1/vts/functional/Android.bp
index 9892eca..147a470 100644
--- a/gnss/1.1/vts/functional/Android.bp
+++ b/gnss/1.1/vts/functional/Android.bp
@@ -25,6 +25,7 @@
static_libs: [
"android.hardware.gnss@1.0",
"android.hardware.gnss@1.1",
+ "android.hardware.gnss@common-vts-lib",
],
test_suites: ["general-tests"],
}
diff --git a/gnss/1.1/vts/functional/gnss_hal_test.cpp b/gnss/1.1/vts/functional/gnss_hal_test.cpp
index 433f5cb..381ac1d 100644
--- a/gnss/1.1/vts/functional/gnss_hal_test.cpp
+++ b/gnss/1.1/vts/functional/gnss_hal_test.cpp
@@ -17,8 +17,10 @@
#define LOG_TAG "GnssHalTest"
#include <gnss_hal_test.h>
-
#include <chrono>
+#include "Utils.h"
+
+using ::android::hardware::gnss::common::Utils;
// Implementations for the main test class for GNSS HAL
GnssHalTest::GnssHalTest()
@@ -124,69 +126,7 @@
void GnssHalTest::CheckLocation(GnssLocation& location, bool check_speed) {
bool check_more_accuracies = (info_called_count_ > 0 && last_info_.yearOfHw >= 2017);
- EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG);
- EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE);
- if (check_speed) {
- EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED);
- }
- EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_HORIZONTAL_ACCURACY);
- // New uncertainties available in O must be provided,
- // at least when paired with modern hardware (2017+)
- if (check_more_accuracies) {
- EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY);
- if (check_speed) {
- EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY);
- if (location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) {
- EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY);
- }
- }
- }
- EXPECT_GE(location.latitudeDegrees, -90.0);
- EXPECT_LE(location.latitudeDegrees, 90.0);
- EXPECT_GE(location.longitudeDegrees, -180.0);
- EXPECT_LE(location.longitudeDegrees, 180.0);
- EXPECT_GE(location.altitudeMeters, -1000.0);
- EXPECT_LE(location.altitudeMeters, 30000.0);
- if (check_speed) {
- EXPECT_GE(location.speedMetersPerSec, 0.0);
- EXPECT_LE(location.speedMetersPerSec, 5.0); // VTS tests are stationary.
-
- // Non-zero speeds must be reported with an associated bearing
- if (location.speedMetersPerSec > 0.0) {
- EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING);
- }
- }
-
- /*
- * Tolerating some especially high values for accuracy estimate, in case of
- * first fix with especially poor geometry (happens occasionally)
- */
- EXPECT_GT(location.horizontalAccuracyMeters, 0.0);
- EXPECT_LE(location.horizontalAccuracyMeters, 250.0);
-
- /*
- * Some devices may define bearing as -180 to +180, others as 0 to 360.
- * Both are okay & understandable.
- */
- if (location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) {
- EXPECT_GE(location.bearingDegrees, -180.0);
- EXPECT_LE(location.bearingDegrees, 360.0);
- }
- if (location.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY) {
- EXPECT_GT(location.verticalAccuracyMeters, 0.0);
- EXPECT_LE(location.verticalAccuracyMeters, 500.0);
- }
- if (location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY) {
- EXPECT_GT(location.speedAccuracyMetersPerSecond, 0.0);
- EXPECT_LE(location.speedAccuracyMetersPerSecond, 50.0);
- }
- if (location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY) {
- EXPECT_GT(location.bearingAccuracyDegrees, 0.0);
- EXPECT_LE(location.bearingAccuracyDegrees, 360.0);
- }
-
- // Check timestamp > 1.48e12 (47 years in msec - 1970->2017+)
- EXPECT_GT(location.timestamp, 1.48e12);
+ Utils::checkLocation(location, check_speed, check_more_accuracies);
}
void GnssHalTest::StartAndCheckLocations(int count) {
diff --git a/gnss/2.0/default/Android.bp b/gnss/2.0/default/Android.bp
index 985aa2b..f327197 100644
--- a/gnss/2.0/default/Android.bp
+++ b/gnss/2.0/default/Android.bp
@@ -40,4 +40,7 @@
"android.hardware.gnss@1.0",
"android.hardware.gnss@1.1",
],
+ static_libs: [
+ "android.hardware.gnss@common-default-lib",
+ ],
}
diff --git a/gnss/2.0/default/Gnss.cpp b/gnss/2.0/default/Gnss.cpp
index 217f0f3..1efc9f5 100644
--- a/gnss/2.0/default/Gnss.cpp
+++ b/gnss/2.0/default/Gnss.cpp
@@ -23,8 +23,10 @@
#include "GnssConfiguration.h"
#include "GnssMeasurement.h"
#include "GnssVisibilityControl.h"
+#include "Utils.h"
using ::android::hardware::Status;
+using ::android::hardware::gnss::common::Utils;
using ::android::hardware::gnss::visibility_control::V1_0::implementation::GnssVisibilityControl;
namespace android {
@@ -33,9 +35,17 @@
namespace V2_0 {
namespace implementation {
+using GnssSvFlags = IGnssCallback::GnssSvFlags;
+
sp<V2_0::IGnssCallback> Gnss::sGnssCallback_2_0 = nullptr;
sp<V1_1::IGnssCallback> Gnss::sGnssCallback_1_1 = nullptr;
+Gnss::Gnss() : mMinIntervalMs(1000) {}
+
+Gnss::~Gnss() {
+ stop();
+}
+
// Methods from V1_0::IGnss follow.
Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>&) {
// TODO implement
@@ -43,13 +53,29 @@
}
Return<bool> Gnss::start() {
- // TODO implement
- return bool{};
+ if (mIsActive) {
+ ALOGW("Gnss has started. Restarting...");
+ stop();
+ }
+
+ mIsActive = true;
+ mThread = std::thread([this]() {
+ while (mIsActive == true) {
+ const auto location = Utils::getMockLocation();
+ this->reportLocation(location);
+
+ std::this_thread::sleep_for(std::chrono::milliseconds(mMinIntervalMs));
+ }
+ });
+ return true;
}
Return<bool> Gnss::stop() {
- // TODO implement
- return bool{};
+ mIsActive = false;
+ if (mThread.joinable()) {
+ mThread.join();
+ }
+ return true;
}
Return<void> Gnss::cleanup() {
@@ -164,8 +190,7 @@
Return<bool> Gnss::setPositionMode_1_1(V1_0::IGnss::GnssPositionMode,
V1_0::IGnss::GnssPositionRecurrence, uint32_t, uint32_t,
uint32_t, bool) {
- // TODO implement
- return bool{};
+ return true;
}
Return<sp<V1_1::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_1_1() {
@@ -243,6 +268,16 @@
return true;
}
+Return<void> Gnss::reportLocation(const GnssLocation& location) const {
+ std::unique_lock<std::mutex> lock(mMutex);
+ if (sGnssCallback_1_1 == nullptr) {
+ ALOGE("%s: sGnssCallback is null.", __func__);
+ return Void();
+ }
+ sGnssCallback_1_1->gnssLocationCb(location);
+ return Void();
+}
+
} // namespace implementation
} // namespace V2_0
} // namespace gnss
diff --git a/gnss/2.0/default/Gnss.h b/gnss/2.0/default/Gnss.h
index 890b026..7d9e783 100644
--- a/gnss/2.0/default/Gnss.h
+++ b/gnss/2.0/default/Gnss.h
@@ -20,6 +20,9 @@
#include <android/hardware/gnss/2.0/IGnss.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
+#include <atomic>
+#include <mutex>
+#include <thread>
namespace android {
namespace hardware {
@@ -35,7 +38,14 @@
using ::android::hardware::Return;
using ::android::hardware::Void;
+using GnssConstellationType = V1_0::GnssConstellationType;
+using GnssLocation = V1_0::GnssLocation;
+using GnssSvInfo = V1_0::IGnssCallback::GnssSvInfo;
+using GnssSvStatus = V1_0::IGnssCallback::GnssSvStatus;
+
struct Gnss : public IGnss {
+ Gnss();
+ ~Gnss();
// Methods from V1_0::IGnss follow.
Return<bool> setCallback(const sp<V1_0::IGnssCallback>& callback) override;
Return<bool> start() override;
@@ -69,7 +79,7 @@
uint32_t preferredTimeMs, bool lowPowerMode) override;
Return<sp<V1_1::IGnssConfiguration>> getExtensionGnssConfiguration_1_1() override;
Return<sp<V1_1::IGnssMeasurement>> getExtensionGnssMeasurement_1_1() override;
- Return<bool> injectBestLocation(const V1_0::GnssLocation& location) override;
+ Return<bool> injectBestLocation(const GnssLocation& location) override;
// Methods from V2_0::IGnss follow.
Return<sp<V2_0::IGnssConfiguration>> getExtensionGnssConfiguration_2_0() override;
@@ -83,8 +93,13 @@
override;
private:
- static sp<V2_0::IGnssCallback> sGnssCallback_2_0;
- static sp<V1_1::IGnssCallback> sGnssCallback_1_1;
+ Return<void> reportLocation(const GnssLocation&) const;
+ static sp<V2_0::IGnssCallback> sGnssCallback_2_0;
+ static sp<V1_1::IGnssCallback> sGnssCallback_1_1;
+ std::atomic<long> mMinIntervalMs;
+ std::atomic<bool> mIsActive;
+ std::thread mThread;
+ mutable std::mutex mMutex;
};
} // namespace implementation
diff --git a/gnss/2.0/vts/functional/Android.bp b/gnss/2.0/vts/functional/Android.bp
index 684b381..278d87b 100644
--- a/gnss/2.0/vts/functional/Android.bp
+++ b/gnss/2.0/vts/functional/Android.bp
@@ -28,5 +28,6 @@
"android.hardware.gnss@1.0",
"android.hardware.gnss@1.1",
"android.hardware.gnss@2.0",
+ "android.hardware.gnss@common-vts-lib",
],
}
diff --git a/gnss/2.0/vts/functional/gnss_hal_test.cpp b/gnss/2.0/vts/functional/gnss_hal_test.cpp
index 3a48c9e..1580c28 100644
--- a/gnss/2.0/vts/functional/gnss_hal_test.cpp
+++ b/gnss/2.0/vts/functional/gnss_hal_test.cpp
@@ -17,8 +17,10 @@
#define LOG_TAG "GnssHalTest"
#include <gnss_hal_test.h>
-
#include <chrono>
+#include "Utils.h"
+
+using ::android::hardware::gnss::common::Utils;
// Implementations for the main test class for GNSS HAL
GnssHalTest::GnssHalTest()
@@ -77,9 +79,88 @@
EXPECT_EQ(name_called_count_, 1);
}
+void GnssHalTest::StopAndClearLocations() {
+ const auto result = gnss_hal_->stop();
+
+ EXPECT_TRUE(result.isOk());
+ EXPECT_TRUE(result);
+
+ /*
+ * Clear notify/waiting counter, allowing up till the timeout after
+ * the last reply for final startup messages to arrive (esp. system
+ * info.)
+ */
+ while (wait(TIMEOUT_SEC) == std::cv_status::no_timeout) {
+ }
+ location_called_count_ = 0;
+}
+
+void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_power_mode) {
+ const int kPreferredAccuracy = 0; // Ideally perfect (matches GnssLocationProvider)
+ const int kPreferredTimeMsec = 0; // Ideally immediate
+
+ const auto result = gnss_hal_->setPositionMode_1_1(
+ IGnss::GnssPositionMode::MS_BASED, IGnss::GnssPositionRecurrence::RECURRENCE_PERIODIC,
+ min_interval_msec, kPreferredAccuracy, kPreferredTimeMsec, low_power_mode);
+
+ ASSERT_TRUE(result.isOk());
+ EXPECT_TRUE(result);
+}
+
+bool GnssHalTest::StartAndCheckFirstLocation() {
+ const auto result = gnss_hal_->start();
+
+ EXPECT_TRUE(result.isOk());
+ EXPECT_TRUE(result);
+
+ /*
+ * GnssLocationProvider support of AGPS SUPL & XtraDownloader is not available in VTS,
+ * so allow time to demodulate ephemeris over the air.
+ */
+ const int kFirstGnssLocationTimeoutSeconds = 75;
+
+ wait(kFirstGnssLocationTimeoutSeconds);
+ EXPECT_EQ(location_called_count_, 1);
+
+ if (location_called_count_ > 0) {
+ // don't require speed on first fix
+ CheckLocation(last_location_, false);
+ return true;
+ }
+ return false;
+}
+
+void GnssHalTest::CheckLocation(const GnssLocation& location, bool check_speed) {
+ const bool check_more_accuracies = (info_called_count_ > 0 && last_info_.yearOfHw >= 2017);
+
+ Utils::checkLocation(location, check_speed, check_more_accuracies);
+}
+
+void GnssHalTest::StartAndCheckLocations(int count) {
+ const int kMinIntervalMsec = 500;
+ const int kLocationTimeoutSubsequentSec = 2;
+ const bool kLowPowerMode = false;
+
+ SetPositionMode(kMinIntervalMsec, kLowPowerMode);
+
+ EXPECT_TRUE(StartAndCheckFirstLocation());
+
+ for (int i = 1; i < count; i++) {
+ EXPECT_EQ(std::cv_status::no_timeout, wait(kLocationTimeoutSubsequentSec));
+ EXPECT_EQ(location_called_count_, i + 1);
+ // Don't cause confusion by checking details if no location yet
+ if (location_called_count_ > 0) {
+ // Should be more than 1 location by now, but if not, still don't check first fix speed
+ CheckLocation(last_location_, location_called_count_ > 1);
+ }
+ }
+}
+
void GnssHalTest::notify() {
- std::unique_lock<std::mutex> lock(mtx_);
- notify_count_++;
+ {
+ std::unique_lock<std::mutex> lock(mtx_);
+ notify_count_++;
+ }
cv_.notify_one();
}
diff --git a/gnss/2.0/vts/functional/gnss_hal_test.h b/gnss/2.0/vts/functional/gnss_hal_test.h
index 5649b45..2c16651 100644
--- a/gnss/2.0/vts/functional/gnss_hal_test.h
+++ b/gnss/2.0/vts/functional/gnss_hal_test.h
@@ -130,9 +130,51 @@
*/
void SetUpGnssCallback();
+ /*
+ * StartAndCheckFirstLocation:
+ * Helper function to start location, and check the first one.
+ *
+ * <p> Note this leaves the Location request active, to enable Stop call vs. other call
+ * reordering tests.
+ *
+ * returns true if a location was successfully generated
+ */
+ bool StartAndCheckFirstLocation();
+
+ /*
+ * CheckLocation:
+ * Helper function to vet Location fields
+ *
+ * check_speed: true if speed related fields are also verified.
+ */
+ void CheckLocation(const GnssLocation& location, const bool check_speed);
+
+ /*
+ * StartAndCheckLocations:
+ * Helper function to collect, and check a number of
+ * normal ~1Hz locations.
+ *
+ * Note this leaves the Location request active, to enable Stop call vs. other call
+ * reordering tests.
+ */
+ void StartAndCheckLocations(int count);
+
+ /*
+ * StopAndClearLocations:
+ * Helper function to stop locations, and clear any remaining notifications
+ */
+ void StopAndClearLocations();
+
+ /*
+ * SetPositionMode:
+ * Helper function to set positioning mode and verify output
+ */
+ void SetPositionMode(const int min_interval_msec, const bool low_power_mode);
+
sp<IGnss> gnss_hal_; // GNSS HAL to call into
sp<IGnssCallback> gnss_cb_; // Primary callback interface
+ // TODO: make these variables thread-safe.
/* Count of calls to set the following items, and the latest item (used by
* test.)
*/
diff --git a/gnss/common/OWNERS b/gnss/common/OWNERS
new file mode 100644
index 0000000..3ed36da
--- /dev/null
+++ b/gnss/common/OWNERS
@@ -0,0 +1,7 @@
+wyattriley@google.com
+gomo@google.com
+smalkos@google.com
+yuhany@google.com
+
+# VTS team
+yim@google.com
diff --git a/gnss/common/utils/default/Android.bp b/gnss/common/utils/default/Android.bp
new file mode 100644
index 0000000..4ea97fa
--- /dev/null
+++ b/gnss/common/utils/default/Android.bp
@@ -0,0 +1,33 @@
+//
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_static {
+ name: "android.hardware.gnss@common-default-lib",
+ vendor_available: true,
+ relative_install_path: "hw",
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ ],
+ srcs: [
+ "Utils.cpp",
+ ],
+ export_include_dirs: ["include"],
+ shared_libs: [
+ "android.hardware.gnss@1.0",
+ ],
+}
diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp
new file mode 100644
index 0000000..b9a06e8
--- /dev/null
+++ b/gnss/common/utils/default/Utils.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Constants.h>
+#include <Utils.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace common {
+
+using GnssSvFlags = V1_0::IGnssCallback::GnssSvFlags;
+
+GnssLocation Utils::getMockLocation() {
+ GnssLocation location = {.gnssLocationFlags = 0xFF,
+ .latitudeDegrees = kMockLatitudeDegrees,
+ .longitudeDegrees = kMockLongitudeDegrees,
+ .altitudeMeters = kMockAltitudeMeters,
+ .speedMetersPerSec = kMockSpeedMetersPerSec,
+ .bearingDegrees = kMockBearingDegrees,
+ .horizontalAccuracyMeters = kMockHorizontalAccuracyMeters,
+ .verticalAccuracyMeters = kMockVerticalAccuracyMeters,
+ .speedAccuracyMetersPerSecond = kMockSpeedAccuracyMetersPerSecond,
+ .bearingAccuracyDegrees = kMockBearingAccuracyDegrees,
+ .timestamp = kMockTimestamp};
+ return location;
+}
+
+GnssSvInfo Utils::getSvInfo(int16_t svid, GnssConstellationType type, float cN0DbHz,
+ float elevationDegrees, float azimuthDegrees) {
+ GnssSvInfo svInfo = {.svid = svid,
+ .constellation = type,
+ .cN0Dbhz = cN0DbHz,
+ .elevationDegrees = elevationDegrees,
+ .azimuthDegrees = azimuthDegrees,
+ .svFlag = GnssSvFlags::USED_IN_FIX | GnssSvFlags::HAS_EPHEMERIS_DATA |
+ GnssSvFlags::HAS_ALMANAC_DATA};
+ return svInfo;
+}
+
+} // namespace common
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gnss/1.1/default/GnssConstants.h b/gnss/common/utils/default/include/Constants.h
similarity index 78%
rename from gnss/1.1/default/GnssConstants.h
rename to gnss/common/utils/default/include/Constants.h
index 9ce1a12..000a9ec 100644
--- a/gnss/1.1/default/GnssConstants.h
+++ b/gnss/common/utils/default/include/Constants.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,14 +14,15 @@
* limitations under the License.
*/
-#ifndef android_hardware_gnss_V1_1_GnssConstants_H_
-#define android_hardware_gnss_V1_1_GnssConstants_H_
+#ifndef android_hardware_gnss_common_Constants_H_
+#define android_hardware_gnss_common_Constants_H_
+
+#include <cstdint>
namespace android {
namespace hardware {
namespace gnss {
-namespace V1_1 {
-namespace implementation {
+namespace common {
const float kMockLatitudeDegrees = 37.4219999;
const float kMockLongitudeDegrees = -122.0840575;
@@ -34,10 +35,9 @@
const float kMockBearingAccuracyDegrees = 90;
const int64_t kMockTimestamp = 1519930775453L;
-} // namespace implementation
-} // namespace V1_1
+} // namespace common
} // namespace gnss
} // namespace hardware
} // namespace android
-#endif // android_hardware_gnss_V1_1_GnssConstants_H_
+#endif // android_hardware_gnss_common_Constants_H_
diff --git a/gnss/common/utils/default/include/Utils.h b/gnss/common/utils/default/include/Utils.h
new file mode 100644
index 0000000..47c8812
--- /dev/null
+++ b/gnss/common/utils/default/include/Utils.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef android_hardware_gnss_common_default_Utils_H_
+#define android_hardware_gnss_common_default_Utils_H_
+
+#include <android/hardware/gnss/1.0/IGnss.h>
+
+using GnssConstellationType = ::android::hardware::gnss::V1_0::GnssConstellationType;
+using GnssLocation = ::android::hardware::gnss::V1_0::GnssLocation;
+using GnssSvInfo = ::android::hardware::gnss::V1_0::IGnssCallback::GnssSvInfo;
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace common {
+
+struct Utils {
+ static GnssLocation getMockLocation();
+ static GnssSvInfo getSvInfo(int16_t svid, GnssConstellationType type, float cN0DbHz,
+ float elevationDegrees, float azimuthDegrees);
+};
+
+} // namespace common
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // android_hardware_gnss_common_default_Utils_H_
diff --git a/gnss/common/utils/vts/Android.bp b/gnss/common/utils/vts/Android.bp
new file mode 100644
index 0000000..99d8cf9
--- /dev/null
+++ b/gnss/common/utils/vts/Android.bp
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_static {
+ name: "android.hardware.gnss@common-vts-lib",
+ vendor_available: true,
+ relative_install_path: "hw",
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ ],
+ srcs: [
+ "Utils.cpp",
+ ],
+ export_include_dirs: ["include"],
+ shared_libs: [
+ "android.hardware.gnss@1.0",
+ ],
+ static_libs: [
+ "libgtest",
+ ],
+}
diff --git a/gnss/common/utils/vts/Utils.cpp b/gnss/common/utils/vts/Utils.cpp
new file mode 100644
index 0000000..24d6883
--- /dev/null
+++ b/gnss/common/utils/vts/Utils.cpp
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Utils.h>
+#include "gtest/gtest.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace common {
+
+using V1_0::GnssLocationFlags;
+
+void Utils::checkLocation(const GnssLocation& location, bool check_speed,
+ bool check_more_accuracies) {
+ EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG);
+ EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE);
+ if (check_speed) {
+ EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED);
+ }
+ EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_HORIZONTAL_ACCURACY);
+ // New uncertainties available in O must be provided,
+ // at least when paired with modern hardware (2017+)
+ if (check_more_accuracies) {
+ EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY);
+ if (check_speed) {
+ EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY);
+ if (location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) {
+ EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY);
+ }
+ }
+ }
+ EXPECT_GE(location.latitudeDegrees, -90.0);
+ EXPECT_LE(location.latitudeDegrees, 90.0);
+ EXPECT_GE(location.longitudeDegrees, -180.0);
+ EXPECT_LE(location.longitudeDegrees, 180.0);
+ EXPECT_GE(location.altitudeMeters, -1000.0);
+ EXPECT_LE(location.altitudeMeters, 30000.0);
+ if (check_speed) {
+ EXPECT_GE(location.speedMetersPerSec, 0.0);
+ EXPECT_LE(location.speedMetersPerSec, 5.0); // VTS tests are stationary.
+
+ // Non-zero speeds must be reported with an associated bearing
+ if (location.speedMetersPerSec > 0.0) {
+ EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING);
+ }
+ }
+
+ /*
+ * Tolerating some especially high values for accuracy estimate, in case of
+ * first fix with especially poor geometry (happens occasionally)
+ */
+ EXPECT_GT(location.horizontalAccuracyMeters, 0.0);
+ EXPECT_LE(location.horizontalAccuracyMeters, 250.0);
+
+ /*
+ * Some devices may define bearing as -180 to +180, others as 0 to 360.
+ * Both are okay & understandable.
+ */
+ if (location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) {
+ EXPECT_GE(location.bearingDegrees, -180.0);
+ EXPECT_LE(location.bearingDegrees, 360.0);
+ }
+ if (location.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY) {
+ EXPECT_GT(location.verticalAccuracyMeters, 0.0);
+ EXPECT_LE(location.verticalAccuracyMeters, 500.0);
+ }
+ if (location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY) {
+ EXPECT_GT(location.speedAccuracyMetersPerSecond, 0.0);
+ EXPECT_LE(location.speedAccuracyMetersPerSecond, 50.0);
+ }
+ if (location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY) {
+ EXPECT_GT(location.bearingAccuracyDegrees, 0.0);
+ EXPECT_LE(location.bearingAccuracyDegrees, 360.0);
+ }
+
+ // Check timestamp > 1.48e12 (47 years in msec - 1970->2017+)
+ EXPECT_GT(location.timestamp, 1.48e12);
+}
+
+} // namespace common
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gnss/common/utils/vts/include/Utils.h b/gnss/common/utils/vts/include/Utils.h
new file mode 100644
index 0000000..f8eeff6
--- /dev/null
+++ b/gnss/common/utils/vts/include/Utils.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef android_hardware_gnss_common_vts_Utils_H_
+#define android_hardware_gnss_common_vts_Utils_H_
+
+#include <android/hardware/gnss/1.0/IGnss.h>
+
+using GnssLocation = ::android::hardware::gnss::V1_0::GnssLocation;
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace common {
+
+struct Utils {
+ static void checkLocation(const GnssLocation& location, bool check_speed,
+ bool check_more_accuracies);
+};
+
+} // namespace common
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // android_hardware_gnss_common_vts_Utils_H_
diff --git a/health/storage/1.0/vts/functional/VtsHalHealthStorageV1_0TargetTest.cpp b/health/storage/1.0/vts/functional/VtsHalHealthStorageV1_0TargetTest.cpp
index 5ad561c..946e5f2 100644
--- a/health/storage/1.0/vts/functional/VtsHalHealthStorageV1_0TargetTest.cpp
+++ b/health/storage/1.0/vts/functional/VtsHalHealthStorageV1_0TargetTest.cpp
@@ -36,7 +36,7 @@
const uint64_t kDevGcTimeoutSec = 120;
const std::chrono::seconds kDevGcTimeout{kDevGcTimeoutSec};
// Time accounted for RPC calls.
-const std::chrono::milliseconds kRpcTime{100};
+const std::chrono::milliseconds kRpcTime{1000};
template <typename R>
std::string toString(std::chrono::duration<R, std::milli> time) {
@@ -90,11 +90,8 @@
template <typename R, typename P>
void waitForResult(std::chrono::duration<R, P> timeout, Result expected) {
std::unique_lock<std::mutex> lock(mMutex);
- if (waitLocked(&lock, timeout)) {
- EXPECT_EQ(expected, mResult);
- } else {
- LOG(INFO) << "timeout after " << toString(timeout);
- }
+ ASSERT_TRUE(waitLocked(&lock, timeout)) << "timeout after " << toString(timeout);
+ EXPECT_EQ(expected, mResult);
}
private:
diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal
index 06bdc6a..ab17598 100644
--- a/neuralnetworks/1.2/types.hal
+++ b/neuralnetworks/1.2/types.hal
@@ -342,7 +342,7 @@
* * * input.scale * filter.scale).
*
* Available since API level 29:
- * * Quantized with symetric per channel quantization for the filter:
+ * * Quantized with symmetric per channel quantization for the filter:
* * * {@link OperandType::TENSOR_QUANT8_ASYMM} for input, and output.
* * * {@link OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL} for filter.
* * * {@link OperandType::TENSOR_INT32} for bias (scale set to 0.0,
@@ -491,7 +491,7 @@
* * * input.scale * filter.scale).
*
* Available since API level 29:
- * * Quantized with symetric per channel quantization for the filter:
+ * * Quantized with symmetric per channel quantization for the filter:
* * * {@link OperandType::TENSOR_QUANT8_ASYMM} for input, and output.
* * * {@link OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL} for filter.
* * * {@link OperandType::TENSOR_INT32} for bias (scale set to 0.0,
@@ -3018,7 +3018,7 @@
* * * {@link OperandType::TENSOR_INT32} for bias (with scale set to
* * * input.scale * filter.scale).
*
- * * Quantized with symetric per channel quantization for the filter:
+ * * Quantized with symmetric per channel quantization for the filter:
* * * {@link OperandType::TENSOR_QUANT8_ASYMM} for input, and output.
* * * {@link OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL} for filter.
* * * {@link OperandType::TENSOR_INT32} for bias (scale set to 0.0,
@@ -4204,10 +4204,21 @@
* The output dimensions are functions of the filter dimensions, stride, and
* padding.
*
- * Supported tensor {@link OperandType}:
- * * {@link OperandType::TENSOR_FLOAT16}
- * * {@link OperandType::TENSOR_FLOAT32}
- * * {@link OperandType::TENSOR_QUANT8_ASYMM}
+ * Supported tensor {@link OperandCode} configurations:
+ * * 32 bit Floating point :
+ * * * {@link OperandType::TENSOR_FLOAT32} for input, filter, output, and bias.
+ *
+ * * Quantized:
+ * * * {@link OperandType::TENSOR_QUANT8_ASYMM} for input, filter, and output.
+ * * * {@link OperandType::TENSOR_INT32} for bias (with scale set to
+ * * * input.scale * filter.scale).
+ *
+ * Available since API level 29:
+ * * Quantized with symmetric per channel quantization for the filter:
+ * * * {@link OperandType::TENSOR_QUANT8_ASYMM} for input, and output.
+ * * * {@link OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL} for filter.
+ * * * {@link OperandType::TENSOR_INT32} for bias (scale set to 0.0,
+ * * * each value scaling is separate and equal to input.scale * filter.scales[channel]).
*
* Supported tensor rank: 4, with "NHWC" or "NCHW" data layout.
* With the default data layout NHWC, the data is stored in the order of:
@@ -4221,14 +4232,20 @@
* specifying the input.
* * 1: A 4-D tensor, of shape
* [depth_out, filter_height, filter_width, depth_in], specifying the
- * filter.
+ * filter. For tensor of type
+ * {@link OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL} the channel
+ * dimension (extraParams.channelQuant.channelDim) must be set to 0.
* * 2: A 1-D tensor, of shape [depth_out], specifying the bias. For input
* tensor of type {@link OperandType::TENSOR_FLOAT32} or
* {@link OperandType::TENSOR_FLOAT16}, the bias should be of the
* same type. For input tensor of type
* {@link OperandType::TENSOR_QUANT8_ASYMM}, the bias should be
* of {@link OperandType::TENSOR_INT32}, with zeroPoint of 0 and
- * bias_scale == input_scale * filter_scale.
+ * bias_scale == input_scale * filter_scale. For filter tensor of
+ * {@link OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL}, the bias
+ * must be of {@link OperandType::TENSOR_INT32}, with zeroPoint of
+ * 0 and bias_scale of 0. The actual scale of each value 'i' is equal
+ * to bias_scale[i] = input_scale * filter_scale[i].
* * 3: An {@link OperandType::INT32} scalar, specifying the padding on
* the left, in the ‘width’ dimension.
* * 4: An {@link OperandType::INT32} scalar, specifying the padding on
@@ -4252,14 +4269,20 @@
* specifying the input.
* * 1: A 4-D tensor, of shape
* [depth_out, filter_height, filter_width, depth_in], specifying the
- * filter.
+ * filter. For tensor of type
+ * {@link OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL} the channel
+ * dimension (extraParams.channelQuant.channelDim) must be set to 0.
* * 2: A 1-D tensor, of shape [depth_out], specifying the bias. For input
* tensor of type {@link OperandType::TENSOR_FLOAT32} or
* {@link OperandType::TENSOR_FLOAT16}, the bias should be of the
* same type. For input tensor of type
* {@link OperandType::TENSOR_QUANT8_ASYMM}, the bias should be
* of {@link OperandType::TENSOR_INT32}, with zeroPoint of 0 and
- * bias_scale == input_scale * filter_scale.
+ * bias_scale == input_scale * filter_scale. For filter tensor of
+ * {@link OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL}, the bias
+ * must be of {@link OperandType::TENSOR_INT32}, with zeroPoint of
+ * 0 and bias_scale of 0. The actual scale of each value 'i' is equal
+ * to bias_scale[i] = input_scale * filter_scale[i].
* * 3: An {@link OperandType::TENSOR_INT32} tensor, specifying the output
* tensor shape.
* * 4: An {@link OperandType::INT32} scalar, specifying the implicit
@@ -4279,7 +4302,9 @@
* * 0: The output 4-D tensor, of shape
* [batches, out_height, out_width, depth_out]. For output tensor of
* {@link OperandType::TENSOR_QUANT8_ASYMM}, the following condition
- * must be satisfied: output_scale > input_scale * filter_scale.
+ * must be satisfied: output_scale > input_scale * filter_scale (for
+ * filter tensor of {@link OperandType::TENSOR_QUANT8_SYMM_PER_CHANNEL}
+ * this condition must be true for all filter scales).
*
* Available since API level 29.
*/
diff --git a/wifi/supplicant/1.2/Android.bp b/wifi/supplicant/1.2/Android.bp
index addcc2a..a0fc2b1 100644
--- a/wifi/supplicant/1.2/Android.bp
+++ b/wifi/supplicant/1.2/Android.bp
@@ -24,7 +24,6 @@
"DppFailureCode",
"DppNetRole",
"DppProgressCode",
- "DppSuccessCode",
],
gen_java: true,
}
diff --git a/wifi/supplicant/1.2/ISupplicantStaIfaceCallback.hal b/wifi/supplicant/1.2/ISupplicantStaIfaceCallback.hal
index 5d5cccf..3eac398 100644
--- a/wifi/supplicant/1.2/ISupplicantStaIfaceCallback.hal
+++ b/wifi/supplicant/1.2/ISupplicantStaIfaceCallback.hal
@@ -37,7 +37,7 @@
/**
* Indicates DPP configuration sent success event (Configurator mode).
*/
- oneway onDppSuccess(DppSuccessCode code);
+ oneway onDppSuccessConfigSent();
/**
* Indicates a DPP progress event.
diff --git a/wifi/supplicant/1.2/types.hal b/wifi/supplicant/1.2/types.hal
index eaf2546..303af19 100644
--- a/wifi/supplicant/1.2/types.hal
+++ b/wifi/supplicant/1.2/types.hal
@@ -35,13 +35,6 @@
};
/**
- * DppSuccessCode: Success codes for DPP (Easy Connect)
- */
-enum DppSuccessCode : uint32_t {
- CONFIGURATION_SENT,
-};
-
-/**
* DppProgressCode: Progress codes for DPP (Easy Connect)
*/
enum DppProgressCode : uint32_t {
diff --git a/wifi/supplicant/1.2/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.2/vts/functional/supplicant_sta_iface_hidl_test.cpp
index 4425281..2ff7751 100644
--- a/wifi/supplicant/1.2/vts/functional/supplicant_sta_iface_hidl_test.cpp
+++ b/wifi/supplicant/1.2/vts/functional/supplicant_sta_iface_hidl_test.cpp
@@ -40,7 +40,6 @@
using ::android::hardware::wifi::supplicant::V1_2::DppFailureCode;
using ::android::hardware::wifi::supplicant::V1_2::DppNetRole;
using ::android::hardware::wifi::supplicant::V1_2::DppProgressCode;
-using ::android::hardware::wifi::supplicant::V1_2::DppSuccessCode;
using ::android::hardware::wifi::supplicant::V1_2::ISupplicantStaIface;
using ::android::hardware::wifi::supplicant::V1_2::ISupplicantStaIfaceCallback;
using ::android::hardware::wifi::supplicant::V1_2::ISupplicantStaNetwork;
@@ -64,7 +63,7 @@
ANY_CALLBACK = -2,
INVALID = -1,
- EVENT_SUCCESS = 0,
+ EVENT_SUCCESS_CONFIG_SENT = 0,
EVENT_SUCCESS_CONFIG_RECEIVED,
EVENT_PROGRESS,
EVENT_FAILURE,
@@ -202,9 +201,7 @@
DppAkm /* securityAkm */) override {
return Void();
}
- Return<void> onDppSuccess(DppSuccessCode /* code */) override {
- return Void();
- }
+ Return<void> onDppSuccessConfigSent() override { return Void(); }
Return<void> onDppProgress(DppProgressCode /* code */) override {
return Void();
}
@@ -226,10 +223,10 @@
parent_.notify();
return Void();
}
- Return<void> onDppSuccess(DppSuccessCode code) override {
- parent_.code = (uint32_t)code;
- parent_.dppCallbackType =
- SupplicantStaIfaceHidlTest::DppCallbackType::EVENT_SUCCESS;
+ Return<void> onDppSuccessConfigSent() override {
+ parent_.code = 0;
+ parent_.dppCallbackType = SupplicantStaIfaceHidlTest::DppCallbackType::
+ EVENT_SUCCESS_CONFIG_SENT;
parent_.notify();
return Void();
}