Merge "p2p: add groupAdd method accepts the group configuration"
diff --git a/atrace/1.0/vts/functional/Android.bp b/atrace/1.0/vts/functional/Android.bp
index 6b50fb5..d3f4276 100644
--- a/atrace/1.0/vts/functional/Android.bp
+++ b/atrace/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalAtraceV1_0TargetTest.cpp"],
static_libs: ["android.hardware.atrace@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/audio/core/2.0/vts/functional/Android.bp b/audio/core/2.0/vts/functional/Android.bp
index d1ddaff..cfa637b 100644
--- a/audio/core/2.0/vts/functional/Android.bp
+++ b/audio/core/2.0/vts/functional/Android.bp
@@ -29,4 +29,5 @@
"libicuuc_stubdata",
"libxml2",
],
+ test_suites: ["general-tests"],
}
diff --git a/audio/core/4.0/vts/functional/Android.bp b/audio/core/4.0/vts/functional/Android.bp
index e3b376c..7be888f 100644
--- a/audio/core/4.0/vts/functional/Android.bp
+++ b/audio/core/4.0/vts/functional/Android.bp
@@ -35,4 +35,5 @@
header_libs: [
"android.hardware.audio.common.util@all-versions",
],
+ test_suites: ["general-tests"],
}
diff --git a/audio/effect/2.0/vts/functional/Android.bp b/audio/effect/2.0/vts/functional/Android.bp
index 51d2e11..1760e01 100644
--- a/audio/effect/2.0/vts/functional/Android.bp
+++ b/audio/effect/2.0/vts/functional/Android.bp
@@ -32,4 +32,5 @@
"libicuuc_stubdata",
"libxml2",
],
+ test_suites: ["general-tests"],
}
diff --git a/audio/effect/4.0/vts/functional/Android.bp b/audio/effect/4.0/vts/functional/Android.bp
index 96ded69..d6f8643 100644
--- a/audio/effect/4.0/vts/functional/Android.bp
+++ b/audio/effect/4.0/vts/functional/Android.bp
@@ -35,4 +35,5 @@
header_libs: [
"android.hardware.audio.common.util@all-versions",
],
+ test_suites: ["general-tests"],
}
diff --git a/authsecret/1.0/vts/functional/Android.bp b/authsecret/1.0/vts/functional/Android.bp
index de9f560..f2b3a8a 100644
--- a/authsecret/1.0/vts/functional/Android.bp
+++ b/authsecret/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalAuthSecretV1_0TargetTest.cpp"],
static_libs: ["android.hardware.authsecret@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/automotive/audiocontrol/1.0/vts/functional/Android.bp b/automotive/audiocontrol/1.0/vts/functional/Android.bp
index c6e0d8e..3cb6340 100644
--- a/automotive/audiocontrol/1.0/vts/functional/Android.bp
+++ b/automotive/audiocontrol/1.0/vts/functional/Android.bp
@@ -16,16 +16,14 @@
cc_test {
name: "VtsHalAudioControlV1_0TargetTest",
-
srcs: [
"VtsHalAudioControlV1_0TargetTest.cpp",
],
-
defaults: [
"VtsHalTargetTestDefaults",
],
-
static_libs: [
"android.hardware.automotive.audiocontrol@1.0",
],
+ test_suites: ["general-tests"],
}
diff --git a/automotive/evs/1.0/vts/functional/Android.bp b/automotive/evs/1.0/vts/functional/Android.bp
index 5d696fc..2ef33fd 100644
--- a/automotive/evs/1.0/vts/functional/Android.bp
+++ b/automotive/evs/1.0/vts/functional/Android.bp
@@ -16,21 +16,17 @@
cc_test {
name: "VtsHalEvsV1_0TargetTest",
-
srcs: [
"VtsHalEvsV1_0TargetTest.cpp",
"FrameHandler.cpp",
"FormatConvert.cpp"
],
-
defaults: ["VtsHalTargetTestDefaults"],
-
shared_libs: [
"libui",
],
-
static_libs: ["android.hardware.automotive.evs@1.0"],
-
+ test_suites: ["general-tests"],
cflags: [
"-O0",
"-g",
diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp
index 7802ef0..a11d452 100644
--- a/automotive/vehicle/2.0/default/Android.bp
+++ b/automotive/vehicle/2.0/default/Android.bp
@@ -95,6 +95,7 @@
"tests/VmsUtils_test.cpp",
],
header_libs: ["libbase_headers"],
+ test_suites: ["general-tests"],
}
cc_binary {
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
index 5007a6d..7909ac1 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
@@ -381,8 +381,8 @@
// kHvacPowerProperties.
.configArray =
{
- 0x12400500, // HVAC_FAN_SPEED
- 0x12400501 // HVAC_FAN_DIRECTION
+ toInt(VehicleProperty::HVAC_FAN_SPEED),
+ toInt(VehicleProperty::HVAC_FAN_DIRECTION)
}},
.initialValue = {.int32Values = {1}}},
diff --git a/biometrics/fingerprint/2.1/vts/functional/Android.bp b/biometrics/fingerprint/2.1/vts/functional/Android.bp
index bee3657..60228f2 100644
--- a/biometrics/fingerprint/2.1/vts/functional/Android.bp
+++ b/biometrics/fingerprint/2.1/vts/functional/Android.bp
@@ -19,5 +19,6 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalBiometricsFingerprintV2_1TargetTest.cpp"],
static_libs: ["android.hardware.biometrics.fingerprint@2.1"],
+ test_suites: ["general-tests"],
}
diff --git a/bluetooth/1.0/default/Android.bp b/bluetooth/1.0/default/Android.bp
index 48bbadf..f4b1e7b 100644
--- a/bluetooth/1.0/default/Android.bp
+++ b/bluetooth/1.0/default/Android.bp
@@ -94,6 +94,7 @@
"android.hardware.bluetooth-hci",
"libgmock",
],
+ test_suites: ["general-tests"],
}
cc_test_host {
diff --git a/bluetooth/1.0/vts/functional/Android.bp b/bluetooth/1.0/vts/functional/Android.bp
index 2e60588..54039e5 100644
--- a/bluetooth/1.0/vts/functional/Android.bp
+++ b/bluetooth/1.0/vts/functional/Android.bp
@@ -22,4 +22,5 @@
"android.hardware.bluetooth@1.0",
"libbluetooth-types",
],
+ test_suites: ["general-tests"],
}
diff --git a/bluetooth/a2dp/1.0/vts/functional/Android.bp b/bluetooth/a2dp/1.0/vts/functional/Android.bp
index f1ffc45..e50e167 100644
--- a/bluetooth/a2dp/1.0/vts/functional/Android.bp
+++ b/bluetooth/a2dp/1.0/vts/functional/Android.bp
@@ -23,4 +23,5 @@
"android.hardware.bluetooth.a2dp@1.0",
"libbluetooth-types",
],
+ test_suites: ["general-tests"],
}
diff --git a/boot/1.0/vts/functional/Android.bp b/boot/1.0/vts/functional/Android.bp
index 2ef89f3..5d1a9cb 100644
--- a/boot/1.0/vts/functional/Android.bp
+++ b/boot/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalBootV1_0TargetTest.cpp"],
static_libs: ["android.hardware.boot@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/broadcastradio/1.0/vts/functional/Android.bp b/broadcastradio/1.0/vts/functional/Android.bp
index 7040a01..9ba9fbe 100644
--- a/broadcastradio/1.0/vts/functional/Android.bp
+++ b/broadcastradio/1.0/vts/functional/Android.bp
@@ -22,4 +22,5 @@
"android.hardware.broadcastradio@1.0",
"android.hardware.broadcastradio@vts-utils-lib",
],
+ test_suites: ["general-tests"],
}
diff --git a/broadcastradio/1.1/vts/functional/Android.bp b/broadcastradio/1.1/vts/functional/Android.bp
index 9240cf0..0a02a69 100644
--- a/broadcastradio/1.1/vts/functional/Android.bp
+++ b/broadcastradio/1.1/vts/functional/Android.bp
@@ -25,4 +25,5 @@
"android.hardware.broadcastradio@vts-utils-lib",
"libgmock",
],
+ test_suites: ["general-tests"],
}
diff --git a/broadcastradio/2.0/default/Android.bp b/broadcastradio/2.0/default/Android.bp
index 900454e..840c4b8 100644
--- a/broadcastradio/2.0/default/Android.bp
+++ b/broadcastradio/2.0/default/Android.bp
@@ -43,7 +43,6 @@
"libbase",
"libhidlbase",
"libhidltransport",
- "liblog",
"libutils",
],
}
diff --git a/broadcastradio/2.0/default/BroadcastRadio.cpp b/broadcastradio/2.0/default/BroadcastRadio.cpp
index 0148fec..28a0dd5 100644
--- a/broadcastradio/2.0/default/BroadcastRadio.cpp
+++ b/broadcastradio/2.0/default/BroadcastRadio.cpp
@@ -13,15 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#define LOG_TAG "BcRadioDef.module"
-#define LOG_NDEBUG 0
-
#include "BroadcastRadio.h"
-#include <log/log.h>
-
#include "resources.h"
+#include <android-base/logging.h>
+
namespace android {
namespace hardware {
namespace broadcastradio {
@@ -66,7 +63,6 @@
mAmFmConfig(gDefaultAmFmConfig) {}
Return<void> BroadcastRadio::getProperties(getProperties_cb _hidl_cb) {
- ALOGV("%s", __func__);
_hidl_cb(mProperties);
return {};
}
@@ -77,8 +73,6 @@
}
Return<void> BroadcastRadio::getAmFmRegionConfig(bool full, getAmFmRegionConfig_cb _hidl_cb) {
- ALOGV("%s(%d)", __func__, full);
-
if (full) {
AmFmRegionConfig config = {};
config.ranges = hidl_vec<AmFmBandRange>({
@@ -96,8 +90,6 @@
}
Return<void> BroadcastRadio::getDabRegionConfig(getDabRegionConfig_cb _hidl_cb) {
- ALOGV("%s", __func__);
-
hidl_vec<DabTableEntry> config = {
{"5A", 174928}, {"7D", 194064}, {"8A", 195936}, {"8B", 197648}, {"9A", 202928},
{"9B", 204640}, {"9C", 206352}, {"10B", 211648}, {"10C", 213360}, {"10D", 215072},
@@ -111,7 +103,7 @@
Return<void> BroadcastRadio::openSession(const sp<ITunerCallback>& callback,
openSession_cb _hidl_cb) {
- ALOGV("%s", __func__);
+ LOG(DEBUG) << "opening new session...";
/* For the needs of default implementation it's fine to instantiate new session object
* out of the lock scope. If your implementation needs it, use reentrant lock.
@@ -122,7 +114,7 @@
auto oldSession = mSession.promote();
if (oldSession != nullptr) {
- ALOGI("Closing previously opened tuner");
+ LOG(INFO) << "closing previously opened tuner";
oldSession->close();
mSession = nullptr;
}
@@ -134,14 +126,14 @@
}
Return<void> BroadcastRadio::getImage(uint32_t id, getImage_cb _hidl_cb) {
- ALOGV("%s(%x)", __func__, id);
+ LOG(DEBUG) << "fetching image " << std::hex << id;
if (id == resources::demoPngId) {
_hidl_cb(std::vector<uint8_t>(resources::demoPng, std::end(resources::demoPng)));
return {};
}
- ALOGI("Image %x doesn't exists", id);
+ LOG(INFO) << "image " << std::hex << id << " doesn't exists";
_hidl_cb({});
return {};
}
@@ -149,7 +141,7 @@
Return<void> BroadcastRadio::registerAnnouncementListener(
const hidl_vec<AnnouncementType>& enabled, const sp<IAnnouncementListener>& /* listener */,
registerAnnouncementListener_cb _hidl_cb) {
- ALOGV("%s(%s)", __func__, toString(enabled).c_str());
+ LOG(DEBUG) << "registering announcement listener for " << toString(enabled);
_hidl_cb(Result::NOT_SUPPORTED, nullptr);
return {};
diff --git a/broadcastradio/2.0/default/TunerSession.cpp b/broadcastradio/2.0/default/TunerSession.cpp
index da97562..2ba4d02 100644
--- a/broadcastradio/2.0/default/TunerSession.cpp
+++ b/broadcastradio/2.0/default/TunerSession.cpp
@@ -14,15 +14,12 @@
* limitations under the License.
*/
-#define LOG_TAG "BcRadioDef.tuner"
-#define LOG_NDEBUG 0
-
#include "TunerSession.h"
#include "BroadcastRadio.h"
+#include <android-base/logging.h>
#include <broadcastradio-utils-2x/Utils.h>
-#include <log/log.h>
namespace android {
namespace hardware {
@@ -68,7 +65,7 @@
}
void TunerSession::tuneInternalLocked(const ProgramSelector& sel) {
- ALOGV("%s(%s)", __func__, toString(sel).c_str());
+ LOG(VERBOSE) << "tune (internal) to " << toString(sel);
VirtualProgram virtualProgram;
ProgramInfo programInfo;
@@ -93,17 +90,18 @@
}
Return<Result> TunerSession::tune(const ProgramSelector& sel) {
- ALOGV("%s(%s)", __func__, toString(sel).c_str());
+ LOG(DEBUG) << "tune to " << toString(sel);
+
lock_guard<mutex> lk(mMut);
if (mIsClosed) return Result::INVALID_STATE;
if (!utils::isSupported(module().mProperties, sel)) {
- ALOGW("Selector not supported");
+ LOG(WARNING) << "selector not supported: " << toString(sel);
return Result::NOT_SUPPORTED;
}
if (!utils::isValid(sel)) {
- ALOGE("ProgramSelector is not valid");
+ LOG(ERROR) << "selector is not valid: " << toString(sel);
return Result::INVALID_ARGUMENTS;
}
@@ -119,8 +117,9 @@
return Result::OK;
}
-Return<Result> TunerSession::scan(bool directionUp, bool /* skipSubChannel */) {
- ALOGV("%s", __func__);
+Return<Result> TunerSession::scan(bool directionUp, bool skipSubChannel) {
+ LOG(DEBUG) << "seek up=" << directionUp << " skipSubChannel=" << skipSubChannel;
+
lock_guard<mutex> lk(mMut);
if (mIsClosed) return Result::INVALID_STATE;
@@ -130,8 +129,8 @@
if (list.empty()) {
mIsTuneCompleted = false;
- auto task = [this, directionUp]() {
- ALOGI("Performing failed seek up=%d", directionUp);
+ auto task = [this]() {
+ LOG(DEBUG) << "program list is empty, seek couldn't stop";
mCallback->onTuneFailed(Result::TIMEOUT, {});
};
@@ -162,7 +161,7 @@
mIsTuneCompleted = false;
auto task = [this, tuneTo, directionUp]() {
- ALOGI("Performing seek up=%d", directionUp);
+ LOG(VERBOSE) << "executing seek up=" << directionUp;
lock_guard<mutex> lk(mMut);
tuneInternalLocked(tuneTo);
@@ -173,21 +172,21 @@
}
Return<Result> TunerSession::step(bool directionUp) {
- ALOGV("%s", __func__);
+ LOG(DEBUG) << "step up=" << directionUp;
lock_guard<mutex> lk(mMut);
if (mIsClosed) return Result::INVALID_STATE;
cancelLocked();
if (!utils::hasId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY)) {
- ALOGE("Can't step in anything else than AM/FM");
+ LOG(WARNING) << "can't step in anything else than AM/FM";
return Result::NOT_SUPPORTED;
}
auto stepTo = utils::getId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY);
auto range = getAmFmRangeLocked();
if (!range) {
- ALOGE("Can't find current band");
+ LOG(ERROR) << "can't find current band";
return Result::INTERNAL_ERROR;
}
@@ -201,7 +200,7 @@
mIsTuneCompleted = false;
auto task = [this, stepTo]() {
- ALOGI("Performing step to %s", std::to_string(stepTo).c_str());
+ LOG(VERBOSE) << "executing step to " << stepTo;
lock_guard<mutex> lk(mMut);
@@ -213,7 +212,7 @@
}
void TunerSession::cancelLocked() {
- ALOGV("%s", __func__);
+ LOG(VERBOSE) << "cancelling current operations...";
mThread.cancelAll();
if (utils::getType(mCurrentProgram.primaryId) != IdentifierType::INVALID) {
@@ -222,7 +221,6 @@
}
Return<void> TunerSession::cancel() {
- ALOGV("%s", __func__);
lock_guard<mutex> lk(mMut);
if (mIsClosed) return {};
@@ -232,7 +230,7 @@
}
Return<Result> TunerSession::startProgramListUpdates(const ProgramFilter& filter) {
- ALOGV("%s(%s)", __func__, toString(filter).c_str());
+ LOG(DEBUG) << "requested program list updates, filter=" << toString(filter);
lock_guard<mutex> lk(mMut);
if (mIsClosed) return Result::INVALID_STATE;
@@ -259,41 +257,37 @@
}
Return<void> TunerSession::stopProgramListUpdates() {
- ALOGV("%s", __func__);
+ LOG(DEBUG) << "requested program list updates to stop";
return {};
}
Return<void> TunerSession::isConfigFlagSet(ConfigFlag flag, isConfigFlagSet_cb _hidl_cb) {
- ALOGV("%s(%s)", __func__, toString(flag).c_str());
+ LOG(VERBOSE) << __func__ << " " << toString(flag);
_hidl_cb(Result::NOT_SUPPORTED, false);
return {};
}
Return<Result> TunerSession::setConfigFlag(ConfigFlag flag, bool value) {
- ALOGV("%s(%s, %d)", __func__, toString(flag).c_str(), value);
+ LOG(VERBOSE) << __func__ << " " << toString(flag) << " " << value;
return Result::NOT_SUPPORTED;
}
Return<void> TunerSession::setParameters(const hidl_vec<VendorKeyValue>& /* parameters */,
setParameters_cb _hidl_cb) {
- ALOGV("%s", __func__);
-
_hidl_cb({});
return {};
}
Return<void> TunerSession::getParameters(const hidl_vec<hidl_string>& /* keys */,
getParameters_cb _hidl_cb) {
- ALOGV("%s", __func__);
-
_hidl_cb({});
return {};
}
Return<void> TunerSession::close() {
- ALOGV("%s", __func__);
+ LOG(DEBUG) << "closing session...";
lock_guard<mutex> lk(mMut);
if (mIsClosed) return {};
@@ -304,7 +298,7 @@
std::optional<AmFmBandRange> TunerSession::getAmFmRangeLocked() const {
if (!mIsTuneCompleted) {
- ALOGW("tune operation in process");
+ LOG(WARNING) << "tune operation is in process";
return {};
}
if (!utils::hasId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY)) return {};
diff --git a/broadcastradio/2.0/default/VirtualProgram.cpp b/broadcastradio/2.0/default/VirtualProgram.cpp
index acde704..a971927 100644
--- a/broadcastradio/2.0/default/VirtualProgram.cpp
+++ b/broadcastradio/2.0/default/VirtualProgram.cpp
@@ -13,15 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#define LOG_TAG "BcRadioDef.VirtualProgram"
-
#include "VirtualProgram.h"
#include "resources.h"
#include <android-base/logging.h>
#include <broadcastradio-utils-2x/Utils.h>
-#include <log/log.h>
namespace android {
namespace hardware {
@@ -72,7 +69,7 @@
info.physicallyTunedTo = selectId(IdentifierType::SXM_CHANNEL);
break;
default:
- LOG(FATAL) << "Unsupported program type: " << toString(pType);
+ LOG(FATAL) << "unsupported program type: " << toString(pType);
}
info.infoFlags |= ProgramInfoFlags::TUNED;
diff --git a/broadcastradio/2.0/default/VirtualRadio.cpp b/broadcastradio/2.0/default/VirtualRadio.cpp
index f601d41..0b65979 100644
--- a/broadcastradio/2.0/default/VirtualRadio.cpp
+++ b/broadcastradio/2.0/default/VirtualRadio.cpp
@@ -13,13 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#define LOG_TAG "BcRadioDef.VirtualRadio"
-//#define LOG_NDEBUG 0
-
#include "VirtualRadio.h"
#include <broadcastradio-utils-2x/Utils.h>
-#include <log/log.h>
namespace android {
namespace hardware {
diff --git a/broadcastradio/2.0/default/service.cpp b/broadcastradio/2.0/default/service.cpp
index 7e677a1..af96dad 100644
--- a/broadcastradio/2.0/default/service.cpp
+++ b/broadcastradio/2.0/default/service.cpp
@@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#define LOG_TAG "BcRadioDef.service"
-
#include <android-base/logging.h>
#include <hidl/HidlTransportSupport.h>
@@ -26,7 +24,9 @@
using android::hardware::broadcastradio::V2_0::implementation::BroadcastRadio;
using android::hardware::broadcastradio::V2_0::implementation::gAmFmRadio;
-int main(int /* argc */, char** /* argv */) {
+int main() {
+ android::base::SetDefaultTag("BcRadioDef");
+ android::base::SetMinimumLogSeverity(android::base::VERBOSE);
configureRpcThreadpool(4, true);
BroadcastRadio broadcastRadio(gAmFmRadio);
diff --git a/broadcastradio/2.0/vts/functional/Android.bp b/broadcastradio/2.0/vts/functional/Android.bp
index 6940bca..3e18a54 100644
--- a/broadcastradio/2.0/vts/functional/Android.bp
+++ b/broadcastradio/2.0/vts/functional/Android.bp
@@ -28,4 +28,5 @@
"android.hardware.broadcastradio@vts-utils-lib",
"libgmock",
],
+ test_suites: ["general-tests"],
}
diff --git a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
index 3d7039d..c523013 100644
--- a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
+++ b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-#define LOG_TAG "BcRadio.vts"
-#define LOG_NDEBUG 0
#define EGMOCK_VERBOSE 1
#include <VtsHalHidlTargetTestBase.h>
@@ -446,7 +444,7 @@
EXPECT_EQ(Result::OK, result);
EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune);
- ALOGD("current program info: %s", toString(infoCb).c_str());
+ LOG(DEBUG) << "current program info: " << toString(infoCb);
// it should tune exactly to what was requested
auto freqs = utils::getAllIds(infoCb.selector, IdentifierType::AMFM_FREQUENCY);
@@ -823,11 +821,11 @@
using android::hardware::broadcastradio::V2_0::vts::gEnv;
using android::hardware::broadcastradio::V2_0::IBroadcastRadio;
using android::hardware::broadcastradio::vts::BroadcastRadioHidlEnvironment;
+ android::base::SetDefaultTag("BcRadio.vts");
+ android::base::SetMinimumLogSeverity(android::base::VERBOSE);
gEnv = new BroadcastRadioHidlEnvironment<IBroadcastRadio>;
::testing::AddGlobalTestEnvironment(gEnv);
::testing::InitGoogleTest(&argc, argv);
gEnv->init(&argc, argv);
- int status = RUN_ALL_TESTS();
- ALOGI("Test result = %d", status);
- return status;
+ return RUN_ALL_TESTS();
}
diff --git a/broadcastradio/common/tests/Android.bp b/broadcastradio/common/tests/Android.bp
index 3ba31db..ef8733c 100644
--- a/broadcastradio/common/tests/Android.bp
+++ b/broadcastradio/common/tests/Android.bp
@@ -36,6 +36,7 @@
"android.hardware.broadcastradio@1.1",
"android.hardware.broadcastradio@2.0",
],
+ test_suites: ["general-tests"],
}
cc_test {
@@ -59,6 +60,7 @@
shared_libs: [
"android.hardware.broadcastradio@2.0",
],
+ test_suites: ["general-tests"],
}
cc_test {
@@ -73,4 +75,5 @@
"WorkerThread_test.cpp",
],
static_libs: ["android.hardware.broadcastradio@common-utils-lib"],
+ test_suites: ["general-tests"],
}
diff --git a/broadcastradio/common/utils/Android.bp b/broadcastradio/common/utils/Android.bp
index 33ba7da..32e06d7 100644
--- a/broadcastradio/common/utils/Android.bp
+++ b/broadcastradio/common/utils/Android.bp
@@ -29,7 +29,6 @@
export_include_dirs: ["include"],
shared_libs: [
"libbase",
- "liblog",
"libutils",
],
}
diff --git a/broadcastradio/common/utils/WorkerThread.cpp b/broadcastradio/common/utils/WorkerThread.cpp
index bfcbb39..31f4d3f 100644
--- a/broadcastradio/common/utils/WorkerThread.cpp
+++ b/broadcastradio/common/utils/WorkerThread.cpp
@@ -14,13 +14,8 @@
* limitations under the License.
*/
-#define LOG_TAG "WorkerThread"
-//#define LOG_NDEBUG 0
-
#include <broadcastradio-utils/WorkerThread.h>
-#include <log/log.h>
-
namespace android {
using std::chrono::milliseconds;
@@ -39,7 +34,6 @@
WorkerThread::WorkerThread() : mIsTerminating(false), mThread(&WorkerThread::threadLoop, this) {}
WorkerThread::~WorkerThread() {
- ALOGV("%s", __func__);
{
lock_guard<mutex> lk(mMut);
mIsTerminating = true;
@@ -49,8 +43,6 @@
}
void WorkerThread::schedule(function<void()> task, milliseconds delay) {
- ALOGV("%s", __func__);
-
auto when = steady_clock::now() + delay;
lock_guard<mutex> lk(mMut);
@@ -59,14 +51,11 @@
}
void WorkerThread::cancelAll() {
- ALOGV("%s", __func__);
-
lock_guard<mutex> lk(mMut);
priority_queue<Task>().swap(mTasks); // empty queue
}
void WorkerThread::threadLoop() {
- ALOGV("%s", __func__);
while (!mIsTerminating) {
unique_lock<mutex> lk(mMut);
if (mTasks.empty()) {
diff --git a/broadcastradio/common/utils2x/Utils.cpp b/broadcastradio/common/utils2x/Utils.cpp
index f292c08..7892653 100644
--- a/broadcastradio/common/utils2x/Utils.cpp
+++ b/broadcastradio/common/utils2x/Utils.cpp
@@ -14,12 +14,10 @@
* limitations under the License.
*/
#define LOG_TAG "BcRadioDef.utils"
-//#define LOG_NDEBUG 0
#include <broadcastradio-utils-2x/Utils.h>
#include <android-base/logging.h>
-#include <log/log.h>
namespace android {
namespace hardware {
@@ -130,7 +128,7 @@
case IdentifierType::SXM_SERVICE_ID:
return haveEqualIds(a, b, IdentifierType::SXM_SERVICE_ID);
default: // includes all vendor types
- ALOGW("Unsupported program type: %s", toString(type).c_str());
+ LOG(WARNING) << "unsupported program type: " << toString(type);
return false;
}
}
@@ -166,7 +164,7 @@
return val;
}
- ALOGW("Identifier %s not found", toString(type).c_str());
+ LOG(WARNING) << "identifier not found: " << toString(type);
return 0;
}
@@ -205,7 +203,7 @@
auto expect = [&valid](bool condition, std::string message) {
if (!condition) {
valid = false;
- ALOGE("Identifier not valid, expected %s", message.c_str());
+ LOG(ERROR) << "identifier not valid, expected " << message;
}
};
diff --git a/broadcastradio/common/vts/utils/include/broadcastradio-vts-utils/mock-timeout.h b/broadcastradio/common/vts/utils/include/broadcastradio-vts-utils/mock-timeout.h
index 1f716f1..f6cd6ae 100644
--- a/broadcastradio/common/vts/utils/include/broadcastradio-vts-utils/mock-timeout.h
+++ b/broadcastradio/common/vts/utils/include/broadcastradio-vts-utils/mock-timeout.h
@@ -29,7 +29,7 @@
* INTERNAL IMPLEMENTATION - don't use in user code.
*/
#if EGMOCK_VERBOSE
-#define EGMOCK_LOG_(...) ALOGV("egmock: " __VA_ARGS__)
+#define EGMOCK_LOG_(...) LOG(VERBOSE) << "egmock: " << __VA_ARGS__
#else
#define EGMOCK_LOG_(...)
#endif
diff --git a/camera/metadata/3.4/types.hal b/camera/metadata/3.4/types.hal
index 4eb6929..61a399e 100644
--- a/camera/metadata/3.4/types.hal
+++ b/camera/metadata/3.4/types.hal
@@ -113,6 +113,15 @@
= 0x18,
};
+/** android.sensor.info.colorFilterArrangement enumeration values added since v3.2
+ * @see ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT
+ */
+enum CameraMetadataEnumAndroidSensorInfoColorFilterArrangement :
+ @3.2::CameraMetadataEnumAndroidSensorInfoColorFilterArrangement {
+ ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO,
+ ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR,
+};
+
/** android.info.supportedBufferManagementVersion enumeration values
* @see ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION
*/
diff --git a/camera/provider/2.4/vts/functional/Android.bp b/camera/provider/2.4/vts/functional/Android.bp
index eb8d43e..f8f058e 100644
--- a/camera/provider/2.4/vts/functional/Android.bp
+++ b/camera/provider/2.4/vts/functional/Android.bp
@@ -38,6 +38,7 @@
"android.hardware.camera.device@3.3",
"android.hardware.camera.device@3.4",
"android.hardware.camera.device@3.5",
+ "android.hardware.camera.metadata@3.4",
"android.hardware.camera.provider@2.4",
"android.hardware.graphics.allocator@2.0",
"android.hardware.graphics.common@1.0",
@@ -46,4 +47,5 @@
"libgrallocusage",
"libhidlmemory",
],
+ test_suites: ["general-tests"],
}
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index c324d59..bb03d91 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -31,8 +31,11 @@
#include <android/hardware/camera/device/3.5/ICameraDevice.h>
#include <android/hardware/camera/device/3.3/ICameraDeviceSession.h>
#include <android/hardware/camera/device/3.4/ICameraDeviceSession.h>
+#include <android/hardware/camera/device/3.5/ICameraDeviceSession.h>
#include <android/hardware/camera/device/3.4/ICameraDeviceCallback.h>
+#include <android/hardware/camera/device/3.5/ICameraDeviceCallback.h>
#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
+#include <android/hardware/camera/metadata/3.4/types.h>
#include <android/hidl/manager/1.0/IServiceManager.h>
#include <binder/MemoryHeapBase.h>
#include <CameraMetadata.h>
@@ -110,6 +113,7 @@
using ::android::hardware::camera::device::V1_0::ICameraDevicePreviewCallback;
using ::android::hardware::camera::device::V1_0::FrameCallbackFlag;
using ::android::hardware::camera::device::V1_0::HandleTimestampMessage;
+using ::android::hardware::camera::metadata::V3_4::CameraMetadataEnumAndroidSensorInfoColorFilterArrangement;
using ::android::hardware::MessageQueue;
using ::android::hardware::kSynchronizedReadWrite;
using ::android::hidl::allocator::V1_0::IAllocator;
@@ -130,6 +134,7 @@
const int64_t kEmptyFlushTimeoutMSec = 200;
const char kDumpOutput[] = "/dev/null";
const uint32_t kBurstFrameCount = 10;
+const int64_t kBufferReturnTimeoutSec = 1;
struct AvailableStream {
int32_t width;
@@ -541,7 +546,7 @@
hidl_vec<hidl_string> getCameraDeviceNames(sp<ICameraProvider> provider);
- struct EmptyDeviceCb : public V3_4::ICameraDeviceCallback {
+ struct EmptyDeviceCb : public V3_5::ICameraDeviceCallback {
virtual Return<void> processCaptureResult(
const hidl_vec<CaptureResult>& /*results*/) override {
ALOGI("processCaptureResult callback");
@@ -561,21 +566,63 @@
ADD_FAILURE(); // Empty callback should not reach here
return Void();
}
+
+ virtual Return<void> requestStreamBuffers(
+ const hidl_vec<V3_5::BufferRequest>&,
+ requestStreamBuffers_cb _hidl_cb) override {
+ ALOGI("requestStreamBuffers callback");
+ // HAL might want to request buffer after configureStreams, but tests with EmptyDeviceCb
+ // doesn't actually need to send capture requests, so just return an error.
+ hidl_vec<V3_5::StreamBufferRet> emptyBufRets;
+ _hidl_cb(V3_5::BufferRequestStatus::FAILED_UNKNOWN, emptyBufRets);
+ return Void();
+ }
+
+ virtual Return<void> returnStreamBuffers(const hidl_vec<StreamBuffer>&) override {
+ ALOGI("returnStreamBuffers");
+ ADD_FAILURE(); // Empty callback should not reach here
+ return Void();
+ }
+
};
- struct DeviceCb : public V3_4::ICameraDeviceCallback {
+ struct DeviceCb : public V3_5::ICameraDeviceCallback {
DeviceCb(CameraHidlTest *parent, bool checkMonochromeResult) : mParent(parent),
mCheckMonochromeResult(checkMonochromeResult) {}
+
Return<void> processCaptureResult_3_4(
const hidl_vec<V3_4::CaptureResult>& results) override;
Return<void> processCaptureResult(const hidl_vec<CaptureResult>& results) override;
Return<void> notify(const hidl_vec<NotifyMsg>& msgs) override;
+ Return<void> requestStreamBuffers(
+ const hidl_vec<V3_5::BufferRequest>& bufReqs,
+ requestStreamBuffers_cb _hidl_cb) override;
+
+ Return<void> returnStreamBuffers(const hidl_vec<StreamBuffer>& buffers) override;
+
+ void setCurrentStreamConfig(const hidl_vec<V3_2::Stream>& streams,
+ const hidl_vec<V3_2::HalStream>& halStreams);
+
+ void waitForBuffersReturned();
+
private:
bool processCaptureResultLocked(const CaptureResult& results);
- CameraHidlTest *mParent; // Parent object
+ CameraHidlTest *mParent; // Parent object
bool mCheckMonochromeResult;
+ bool hasOutstandingBuffersLocked();
+
+ /* members for requestStreamBuffers() and returnStreamBuffers()*/
+ std::mutex mLock; // protecting members below
+ bool mUseHalBufManager = false;
+ hidl_vec<V3_2::Stream> mStreams;
+ hidl_vec<V3_2::HalStream> mHalStreams;
+ uint64_t mNextBufferId = 1;
+ using OutstandingBuffers = std::unordered_map<uint64_t, hidl_handle>;
+ // size == mStreams.size(). Tracking each streams outstanding buffers
+ std::vector<OutstandingBuffers> mOutstandingBufferIds;
+ std::condition_variable mFlushedCondition;
};
struct TorchProviderCb : public ICameraProviderCallback {
@@ -659,21 +706,27 @@
camera_metadata_t **staticMeta /*out*/);
void castSession(const sp<ICameraDeviceSession> &session, int32_t deviceVersion,
sp<device::V3_3::ICameraDeviceSession> *session3_3 /*out*/,
- sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/);
+ sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/,
+ sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/);
void createStreamConfiguration(const ::android::hardware::hidl_vec<V3_2::Stream>& streams3_2,
StreamConfigurationMode configMode,
::android::hardware::camera::device::V3_2::StreamConfiguration *config3_2,
- ::android::hardware::camera::device::V3_4::StreamConfiguration *config3_4);
+ ::android::hardware::camera::device::V3_4::StreamConfiguration *config3_4,
+ ::android::hardware::camera::device::V3_5::StreamConfiguration *config3_5);
void configurePreviewStreams3_4(const std::string &name, int32_t deviceVersion,
sp<ICameraProvider> provider,
const AvailableStream *previewThreshold,
const std::unordered_set<std::string>& physicalIds,
sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/,
+ sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/,
V3_2::Stream* previewStream /*out*/,
device::V3_4::HalStreamConfiguration *halStreamConfig /*out*/,
bool *supportsPartialResults /*out*/,
- uint32_t *partialResultCount /*out*/);
+ uint32_t *partialResultCount /*out*/,
+ bool *useHalBufManager /*out*/,
+ sp<DeviceCb> *cb /*out*/,
+ uint32_t streamConfigCounter = 0);
void configurePreviewStream(const std::string &name, int32_t deviceVersion,
sp<ICameraProvider> provider,
const AvailableStream *previewThreshold,
@@ -681,7 +734,10 @@
V3_2::Stream *previewStream /*out*/,
HalStreamConfiguration *halStreamConfig /*out*/,
bool *supportsPartialResults /*out*/,
- uint32_t *partialResultCount /*out*/);
+ uint32_t *partialResultCount /*out*/,
+ bool *useHalBufManager /*out*/,
+ sp<DeviceCb> *cb /*out*/,
+ uint32_t streamConfigCounter = 0);
void verifyLogicalCameraMetadata(const std::string& cameraName,
const ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice>& device,
@@ -693,6 +749,14 @@
void verifyMonochromeCameraResult(
const ::android::hardware::camera::common::V1_0::helper::CameraMetadata& metadata);
+ void verifyBuffersReturned(sp<device::V3_2::ICameraDeviceSession> session,
+ int deviceVerison, int32_t streamId, sp<DeviceCb> cb,
+ uint32_t streamConfigCounter = 0);
+
+ void verifyBuffersReturned(sp<device::V3_4::ICameraDeviceSession> session,
+ hidl_vec<int32_t> streamIds, sp<DeviceCb> cb,
+ uint32_t streamConfigCounter = 0);
+
static Status getAvailableOutputStreams(camera_metadata_t *staticMeta,
std::vector<AvailableStream> &outputStreams,
const AvailableStream *threshold = nullptr);
@@ -1092,9 +1156,51 @@
if (request->shutterTimestamp != 0) {
notify = true;
}
+
+ if (mUseHalBufManager) {
+ returnStreamBuffers(results.outputBuffers);
+ }
return notify;
}
+void CameraHidlTest::DeviceCb::setCurrentStreamConfig(
+ const hidl_vec<V3_2::Stream>& streams, const hidl_vec<V3_2::HalStream>& halStreams) {
+ ASSERT_EQ(streams.size(), halStreams.size());
+ ASSERT_NE(streams.size(), 0);
+ for (size_t i = 0; i < streams.size(); i++) {
+ ASSERT_EQ(streams[i].id, halStreams[i].id);
+ }
+ std::lock_guard<std::mutex> l(mLock);
+ mUseHalBufManager = true;
+ mStreams = streams;
+ mHalStreams = halStreams;
+ mOutstandingBufferIds.clear();
+ for (size_t i = 0; i < streams.size(); i++) {
+ mOutstandingBufferIds.emplace_back();
+ }
+}
+
+bool CameraHidlTest::DeviceCb::hasOutstandingBuffersLocked() {
+ if (!mUseHalBufManager) {
+ return false;
+ }
+ for (const auto& outstandingBuffers : mOutstandingBufferIds) {
+ if (!outstandingBuffers.empty()) {
+ return true;
+ }
+ }
+ return false;
+}
+
+void CameraHidlTest::DeviceCb::waitForBuffersReturned() {
+ std::unique_lock<std::mutex> lk(mLock);
+ if (hasOutstandingBuffersLocked()) {
+ auto timeout = std::chrono::seconds(kBufferReturnTimeoutSec);
+ auto st = mFlushedCondition.wait_for(lk, timeout);
+ ASSERT_NE(std::cv_status::timeout, st);
+ }
+}
+
Return<void> CameraHidlTest::DeviceCb::notify(
const hidl_vec<NotifyMsg>& messages) {
std::lock_guard<std::mutex> l(mParent->mLock);
@@ -1137,6 +1243,124 @@
return Void();
}
+Return<void> CameraHidlTest::DeviceCb::requestStreamBuffers(
+ const hidl_vec<V3_5::BufferRequest>& bufReqs,
+ requestStreamBuffers_cb _hidl_cb) {
+ using V3_5::BufferRequestStatus;
+ using V3_5::StreamBufferRet;
+ using V3_5::StreamBufferRequestError;
+ hidl_vec<StreamBufferRet> bufRets;
+ std::unique_lock<std::mutex> l(mLock);
+
+ if (!mUseHalBufManager) {
+ ALOGE("%s: Camera does not support HAL buffer management", __FUNCTION__);
+ ADD_FAILURE();
+ _hidl_cb(BufferRequestStatus::FAILED_ILLEGAL_ARGUMENTS, bufRets);
+ return Void();
+ }
+
+ if (bufReqs.size() > mStreams.size()) {
+ ALOGE("%s: illegal buffer request: too many requests!", __FUNCTION__);
+ ADD_FAILURE();
+ _hidl_cb(BufferRequestStatus::FAILED_ILLEGAL_ARGUMENTS, bufRets);
+ return Void();
+ }
+
+ std::vector<int32_t> indexes(bufReqs.size());
+ for (size_t i = 0; i < bufReqs.size(); i++) {
+ bool found = false;
+ for (size_t idx = 0; idx < mStreams.size(); idx++) {
+ if (bufReqs[i].streamId == mStreams[idx].id) {
+ found = true;
+ indexes[i] = idx;
+ break;
+ }
+ }
+ if (!found) {
+ ALOGE("%s: illegal buffer request: unknown streamId %d!",
+ __FUNCTION__, bufReqs[i].streamId);
+ ADD_FAILURE();
+ _hidl_cb(BufferRequestStatus::FAILED_ILLEGAL_ARGUMENTS, bufRets);
+ return Void();
+ }
+ }
+
+ bool allStreamOk = true;
+ bool atLeastOneStreamOk = false;
+ bufRets.resize(bufReqs.size());
+ for (size_t i = 0; i < bufReqs.size(); i++) {
+ int32_t idx = indexes[i];
+ const auto& stream = mStreams[idx];
+ const auto& halStream = mHalStreams[idx];
+ const V3_5::BufferRequest& bufReq = bufReqs[i];
+ if (mOutstandingBufferIds[idx].size() + bufReq.numBuffersRequested > halStream.maxBuffers) {
+ bufRets[i].streamId = stream.id;
+ bufRets[i].val.error(StreamBufferRequestError::MAX_BUFFER_EXCEEDED);
+ allStreamOk = false;
+ continue;
+ }
+
+ hidl_vec<StreamBuffer> tmpRetBuffers(bufReq.numBuffersRequested);
+ for (size_t i = 0; i < bufReq.numBuffersRequested; i++) {
+ hidl_handle buffer_handle;
+ mParent->allocateGraphicBuffer(stream.width, stream.height,
+ android_convertGralloc1To0Usage(
+ halStream.producerUsage, halStream.consumerUsage),
+ halStream.overrideFormat, &buffer_handle);
+
+ tmpRetBuffers[i] = {stream.id, mNextBufferId, buffer_handle, BufferStatus::OK,
+ nullptr, nullptr};
+ mOutstandingBufferIds[idx].insert(std::make_pair(mNextBufferId++, buffer_handle));
+ }
+ atLeastOneStreamOk = true;
+ bufRets[0].val.buffers(std::move(tmpRetBuffers));
+ }
+
+ if (allStreamOk) {
+ _hidl_cb(BufferRequestStatus::OK, bufRets);
+ } else if (atLeastOneStreamOk) {
+ _hidl_cb(BufferRequestStatus::FAILED_PARTIAL, bufRets);
+ } else {
+ _hidl_cb(BufferRequestStatus::FAILED_UNKNOWN, bufRets);
+ }
+
+ if (!hasOutstandingBuffersLocked()) {
+ l.unlock();
+ mFlushedCondition.notify_one();
+ }
+ return Void();
+}
+
+Return<void> CameraHidlTest::DeviceCb::returnStreamBuffers(
+ const hidl_vec<StreamBuffer>& buffers) {
+ if (!mUseHalBufManager) {
+ ALOGE("%s: Camera does not support HAL buffer management", __FUNCTION__);
+ ADD_FAILURE();
+ }
+
+ std::lock_guard<std::mutex> l(mLock);
+ for (const auto& buf : buffers) {
+ bool found = false;
+ for (size_t idx = 0; idx < mOutstandingBufferIds.size(); idx++) {
+ if (mStreams[idx].id == buf.streamId &&
+ mOutstandingBufferIds[idx].count(buf.bufferId) == 1) {
+ mOutstandingBufferIds[idx].erase(buf.bufferId);
+ // TODO: check do we need to close/delete native handle or assume we have enough
+ // memory to run till the test finish? since we do not capture much requests (and
+ // most of time one buffer is sufficient)
+ found = true;
+ break;
+ }
+ }
+ if (found) {
+ continue;
+ }
+ ALOGE("%s: unknown buffer ID %" PRIu64, __FUNCTION__, buf.bufferId);
+ ADD_FAILURE();
+ }
+ return Void();
+}
+
hidl_vec<hidl_string> CameraHidlTest::getCameraDeviceNames(sp<ICameraProvider> provider) {
std::vector<std::string> cameraDeviceNames;
Return<void> ret;
@@ -2377,14 +2601,18 @@
// cast the 3.3/3.4 interface, and that lower versions can't be cast to it.
sp<device::V3_3::ICameraDeviceSession> sessionV3_3;
sp<device::V3_4::ICameraDeviceSession> sessionV3_4;
- castSession(session, deviceVersion, &sessionV3_3, &sessionV3_4);
- if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_4 ||
- deviceVersion == CAMERA_DEVICE_API_VERSION_3_5) {
+ sp<device::V3_5::ICameraDeviceSession> sessionV3_5;
+ castSession(session, deviceVersion, &sessionV3_3, &sessionV3_4, &sessionV3_5);
+ if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_5) {
+ ASSERT_TRUE(sessionV3_5.get() != nullptr);
+ } else if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_4) {
ASSERT_TRUE(sessionV3_4.get() != nullptr);
} else if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_3) {
ASSERT_TRUE(sessionV3_3.get() != nullptr);
- } else {
+ } else { //V3_2
ASSERT_TRUE(sessionV3_3.get() == nullptr);
+ ASSERT_TRUE(sessionV3_4.get() == nullptr);
+ ASSERT_TRUE(sessionV3_5.get() == nullptr);
}
native_handle_t* raw_handle = native_handle_create(1, 0);
raw_handle->data[0] = open(kDumpOutput, O_RDWR);
@@ -2540,15 +2768,17 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider,
&session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
outputStreams.clear();
ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams));
ASSERT_NE(0u, outputStreams.size());
int32_t streamId = 0;
+ uint32_t streamConfigCounter = 0;
for (auto& it : outputStreams) {
V3_2::Stream stream3_2;
bool isJpeg = static_cast<PixelFormat>(it.format) == PixelFormat::BLOB;
@@ -2561,11 +2791,20 @@
(isJpeg) ? static_cast<V3_2::DataspaceFlags>(Dataspace::V0_JFIF) : 0,
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<V3_2::Stream> streams3_2 = {stream3_2};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams3_2, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [streamId](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ ASSERT_EQ(halConfig.streams[0].v3_3.v3_2.id, streamId);
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[streamId](Status s, device::V3_4::HalStreamConfiguration halConfig) {
ASSERT_EQ(Status::OK, s);
@@ -2617,8 +2856,9 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
outputStreams.clear();
ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams));
@@ -2633,29 +2873,38 @@
GRALLOC1_CONSUMER_USAGE_HWCOMPOSER,
0,
StreamRotation::ROTATION_0};
+ uint32_t streamConfigCounter = 0;
::android::hardware::hidl_vec<V3_2::Stream> streams = {stream3_2};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if(session3_4 != nullptr) {
- ret = session3_4->configureStreams_3_4(config3_4,
- [](Status s, device::V3_4::HalStreamConfiguration) {
- ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
(Status::INTERNAL_ERROR == s));
- });
+ });
+ } else if (session3_4 != nullptr) {
+ ret = session3_4->configureStreams_3_4(config3_4,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ (Status::INTERNAL_ERROR == s));
+ });
} else if(session3_3 != nullptr) {
ret = session3_3->configureStreams_3_3(config3_2,
- [](Status s, device::V3_3::HalStreamConfiguration) {
- ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
- (Status::INTERNAL_ERROR == s));
- });
+ [](Status s, device::V3_3::HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ (Status::INTERNAL_ERROR == s));
+ });
} else {
ret = session->configureStreams(config3_2,
- [](Status s, HalStreamConfiguration) {
- ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
- (Status::INTERNAL_ERROR == s));
- });
+ [](Status s, HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ (Status::INTERNAL_ERROR == s));
+ });
}
ASSERT_TRUE(ret.isOk());
@@ -2669,8 +2918,14 @@
StreamRotation::ROTATION_0};
streams[0] = stream3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if(session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5, [](Status s,
+ device::V3_4::HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ } else if(session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4, [](Status s,
device::V3_4::HalStreamConfiguration) {
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
@@ -2699,8 +2954,14 @@
StreamRotation::ROTATION_0};
streams[0] = stream3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if(session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ } else if(session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration) {
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
@@ -2728,8 +2989,14 @@
static_cast<StreamRotation>(UINT32_MAX)};
streams[0] = stream3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if(session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ } else if(session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration) {
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
@@ -2776,8 +3043,9 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
Status rc = isZSLModeAvailable(staticMeta);
if (Status::METHOD_NOT_SUPPORTED == rc) {
@@ -2807,6 +3075,7 @@
int32_t streamId = 0;
bool hasPrivToY8 = false, hasY8ToY8 = false, hasY8ToBlob = false;
+ uint32_t streamConfigCounter = 0;
for (auto& inputIter : inputOutputMap) {
AvailableStream input;
ASSERT_EQ(Status::OK, findLargestSize(inputStreams, inputIter.inputFormat,
@@ -2857,11 +3126,19 @@
::android::hardware::hidl_vec<V3_2::Stream> streams = {inputStream, zslStream,
outputStream};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(3u, halConfig.streams.size());
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration halConfig) {
ASSERT_EQ(Status::OK, s);
@@ -2923,9 +3200,14 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMetaBuffer /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
- ASSERT_NE(session3_4, nullptr);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
+ if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_4) {
+ ASSERT_NE(session3_4, nullptr);
+ } else {
+ ASSERT_NE(session3_5, nullptr);
+ }
std::unordered_set<int32_t> availableSessionKeys;
auto rc = getSupportedKeys(staticMetaBuffer, ANDROID_REQUEST_AVAILABLE_SESSION_KEYS,
@@ -2964,17 +3246,29 @@
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<V3_4::Stream> streams = {previewStream};
::android::hardware::camera::device::V3_4::StreamConfiguration config;
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
config.streams = streams;
config.operationMode = StreamConfigurationMode::NORMAL_MODE;
const camera_metadata_t *sessionParamsBuffer = sessionParams.getAndLock();
config.sessionParams.setToExternal(
reinterpret_cast<uint8_t *> (const_cast<camera_metadata_t *> (sessionParamsBuffer)),
get_camera_metadata_size(sessionParamsBuffer));
- ret = session3_4->configureStreams_3_4(config,
- [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
- ASSERT_EQ(Status::OK, s);
- ASSERT_EQ(1u, halConfig.streams.size());
- });
+ config3_5.v3_4 = config;
+ config3_5.streamConfigCounter = 0;
+ if (session3_5 != nullptr) {
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ });
+ } else {
+ ret = session3_4->configureStreams_3_4(config,
+ [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ });
+ }
+
ASSERT_TRUE(ret.isOk());
free_camera_metadata(staticMetaBuffer);
@@ -3009,8 +3303,9 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
outputBlobStreams.clear();
ASSERT_EQ(Status::OK,
@@ -3024,6 +3319,7 @@
ASSERT_NE(0u, outputPreviewStreams.size());
int32_t streamId = 0;
+ uint32_t streamConfigCounter = 0;
for (auto& blobIter : outputBlobStreams) {
for (auto& previewIter : outputPreviewStreams) {
V3_2::Stream previewStream = {streamId++,
@@ -3044,11 +3340,19 @@
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<V3_2::Stream> streams = {previewStream,
blobStream};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(2u, halConfig.streams.size());
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration halConfig) {
ASSERT_EQ(Status::OK, s);
@@ -3098,8 +3402,9 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
Status rc = isConstrainedModeAvailable(staticMeta);
if (Status::METHOD_NOT_SUPPORTED == rc) {
@@ -3114,6 +3419,7 @@
ASSERT_EQ(Status::OK, rc);
int32_t streamId = 0;
+ uint32_t streamConfigCounter = 0;
V3_2::Stream stream = {streamId,
StreamType::OUTPUT,
static_cast<uint32_t>(hfrStream.width),
@@ -3123,11 +3429,20 @@
0,
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<V3_2::Stream> streams = {stream};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [streamId](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ ASSERT_EQ(halConfig.streams[0].v3_3.v3_2.id, streamId);
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[streamId](Status s, device::V3_4::HalStreamConfiguration halConfig) {
ASSERT_EQ(Status::OK, s);
@@ -3161,8 +3476,15 @@
StreamRotation::ROTATION_0};
streams[0] = stream;
createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ (Status::INTERNAL_ERROR == s));
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration) {
ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
@@ -3193,8 +3515,14 @@
StreamRotation::ROTATION_0};
streams[0] = stream;
createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration) {
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
@@ -3222,8 +3550,14 @@
StreamRotation::ROTATION_0};
streams[0] = stream;
createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration) {
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
@@ -3273,8 +3607,9 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
outputBlobStreams.clear();
ASSERT_EQ(Status::OK,
@@ -3289,6 +3624,7 @@
ASSERT_NE(0u, outputVideoStreams.size());
int32_t streamId = 0;
+ uint32_t streamConfigCounter = 0;
for (auto& blobIter : outputBlobStreams) {
for (auto& videoIter : outputVideoStreams) {
V3_2::Stream videoStream = {streamId++,
@@ -3308,11 +3644,19 @@
static_cast<V3_2::DataspaceFlags>(Dataspace::V0_JFIF),
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<V3_2::Stream> streams = {videoStream, blobStream};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(2u, halConfig.streams.size());
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration halConfig) {
ASSERT_EQ(Status::OK, s);
@@ -3363,12 +3707,14 @@
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
sp<ICameraDeviceSession> session;
+ sp<DeviceCb> cb;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold, &session /*out*/,
&previewStream /*out*/, &halStreamConfig /*out*/,
&supportsPartialResults /*out*/,
- &partialResultCount /*out*/);
+ &partialResultCount /*out*/, &useHalBufManager /*out*/, &cb /*out*/);
std::shared_ptr<ResultMetadataQueue> resultQueue;
auto resultQueueRet =
@@ -3399,17 +3745,26 @@
ASSERT_TRUE(ret.isOk());
hidl_handle buffer_handle;
- allocateGraphicBuffer(previewStream.width, previewStream.height,
- android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
- halStreamConfig.streams[0].consumerUsage),
- halStreamConfig.streams[0].overrideFormat, &buffer_handle);
-
- StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
- bufferId,
- buffer_handle,
- BufferStatus::OK,
- nullptr,
- nullptr};
+ StreamBuffer outputBuffer;
+ if (useHalBufManager) {
+ outputBuffer = {halStreamConfig.streams[0].id,
+ /*bufferId*/ 0,
+ buffer_handle,
+ BufferStatus::OK,
+ nullptr,
+ nullptr};
+ } else {
+ allocateGraphicBuffer(previewStream.width, previewStream.height,
+ android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
+ halStreamConfig.streams[0].consumerUsage),
+ halStreamConfig.streams[0].overrideFormat, &buffer_handle);
+ outputBuffer = {halStreamConfig.streams[0].id,
+ bufferId,
+ buffer_handle,
+ BufferStatus::OK,
+ nullptr,
+ nullptr};
+ }
::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {outputBuffer};
StreamBuffer emptyInputBuffer = {-1, 0, nullptr, BufferStatus::ERROR, nullptr,
nullptr};
@@ -3489,6 +3844,10 @@
ASSERT_EQ(previewStream.id, inflightReq.resultOutputBuffers[0].streamId);
}
+ if (useHalBufManager) {
+ verifyBuffersReturned(session, deviceVersion, previewStream.id, cb);
+ }
+
ret = session->close();
ASSERT_TRUE(ret.isOk());
}
@@ -3570,12 +3929,16 @@
V3_4::HalStreamConfiguration halStreamConfig;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
V3_2::Stream previewStream;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
+ sp<DeviceCb> cb;
configurePreviewStreams3_4(name, deviceVersion, mProvider, &previewThreshold, physicalIds,
- &session3_4, &previewStream, &halStreamConfig /*out*/,
- &supportsPartialResults /*out*/, &partialResultCount /*out*/);
+ &session3_4, &session3_5, &previewStream, &halStreamConfig /*out*/,
+ &supportsPartialResults /*out*/, &partialResultCount /*out*/,
+ &useHalBufManager /*out*/, &cb /*out*/);
ASSERT_NE(session3_4, nullptr);
std::shared_ptr<ResultMetadataQueue> resultQueue;
@@ -3604,14 +3967,19 @@
size_t k = 0;
for (const auto& halStream : halStreamConfig.streams) {
hidl_handle buffer_handle;
- allocateGraphicBuffer(previewStream.width, previewStream.height,
- android_convertGralloc1To0Usage(halStream.v3_3.v3_2.producerUsage,
- halStream.v3_3.v3_2.consumerUsage),
- halStream.v3_3.v3_2.overrideFormat, &buffer_handle);
- graphicBuffers.push_back(buffer_handle);
- outputBuffers[k] = {halStream.v3_3.v3_2.id, bufferId, buffer_handle,
- BufferStatus::OK, nullptr, nullptr};
- bufferId++;
+ if (useHalBufManager) {
+ outputBuffers[k] = {halStream.v3_3.v3_2.id, /*bufferId*/0, buffer_handle,
+ BufferStatus::OK, nullptr, nullptr};
+ } else {
+ allocateGraphicBuffer(previewStream.width, previewStream.height,
+ android_convertGralloc1To0Usage(halStream.v3_3.v3_2.producerUsage,
+ halStream.v3_3.v3_2.consumerUsage),
+ halStream.v3_3.v3_2.overrideFormat, &buffer_handle);
+ graphicBuffers.push_back(buffer_handle);
+ outputBuffers[k] = {halStream.v3_3.v3_2.id, bufferId, buffer_handle,
+ BufferStatus::OK, nullptr, nullptr};
+ bufferId++;
+ }
k++;
}
hidl_vec<V3_4::PhysicalCameraSetting> camSettings(1);
@@ -3713,6 +4081,15 @@
defaultPreviewSettings.unlock(settingsBuffer);
filteredSettings.unlock(filteredSettingsBuffer);
+
+ if (useHalBufManager) {
+ hidl_vec<int32_t> streamIds(halStreamConfig.streams.size());
+ for (size_t i = 0; i < streamIds.size(); i++) {
+ streamIds[i] = halStreamConfig.streams[i].v3_3.v3_2.id;
+ }
+ verifyBuffersReturned(session3_4, streamIds, cb);
+ }
+
ret = session3_4->close();
ASSERT_TRUE(ret.isOk());
}
@@ -3761,12 +4138,15 @@
ASSERT_TRUE(ret.isOk());
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
+ sp<DeviceCb> cb;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold,
&session /*out*/, &previewStream /*out*/, &halStreamConfig /*out*/,
- &supportsPartialResults /*out*/, &partialResultCount /*out*/);
+ &supportsPartialResults /*out*/, &partialResultCount /*out*/,
+ &useHalBufManager /*out*/, &cb /*out*/);
std::shared_ptr<ResultMetadataQueue> resultQueue;
auto resultQueueRet = session->getCaptureResultMetadataQueue(
@@ -3800,13 +4180,18 @@
std::unique_lock<std::mutex> l(mLock);
isoValues[i] = ((i % 2) == 0) ? isoRange.data.i32[0] : isoRange.data.i32[1];
- allocateGraphicBuffer(previewStream.width, previewStream.height,
- android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
- halStreamConfig.streams[0].consumerUsage),
- halStreamConfig.streams[0].overrideFormat, &buffers[i]);
+ if (useHalBufManager) {
+ outputBuffers[i] = {halStreamConfig.streams[0].id, /*bufferId*/0,
+ nullptr, BufferStatus::OK, nullptr, nullptr};
+ } else {
+ allocateGraphicBuffer(previewStream.width, previewStream.height,
+ android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
+ halStreamConfig.streams[0].consumerUsage),
+ halStreamConfig.streams[0].overrideFormat, &buffers[i]);
+ outputBuffers[i] = {halStreamConfig.streams[0].id, bufferId + i,
+ buffers[i], BufferStatus::OK, nullptr, nullptr};
+ }
- outputBuffers[i] = {halStreamConfig.streams[0].id, bufferId + i,
- buffers[i], BufferStatus::OK, nullptr, nullptr};
requestMeta.append(reinterpret_cast<camera_metadata_t *> (settings.data()));
// Disable all 3A routines
@@ -3859,6 +4244,9 @@
std::round(isoValues[i]*isoTol));
}
+ if (useHalBufManager) {
+ verifyBuffersReturned(session, deviceVersion, previewStream.id, cb);
+ }
ret = session->close();
ASSERT_TRUE(ret.isOk());
}
@@ -3888,18 +4276,25 @@
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
sp<ICameraDeviceSession> session;
+ sp<DeviceCb> cb;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold, &session /*out*/,
&previewStream /*out*/, &halStreamConfig /*out*/,
&supportsPartialResults /*out*/,
- &partialResultCount /*out*/);
+ &partialResultCount /*out*/, &useHalBufManager /*out*/, &cb /*out*/);
hidl_handle buffer_handle;
- allocateGraphicBuffer(previewStream.width, previewStream.height,
- android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
- halStreamConfig.streams[0].consumerUsage),
- halStreamConfig.streams[0].overrideFormat, &buffer_handle);
+
+ if (useHalBufManager) {
+ bufferId = 0;
+ } else {
+ allocateGraphicBuffer(previewStream.width, previewStream.height,
+ android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
+ halStreamConfig.streams[0].consumerUsage),
+ halStreamConfig.streams[0].overrideFormat, &buffer_handle);
+ }
StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
bufferId,
@@ -3955,12 +4350,14 @@
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
sp<ICameraDeviceSession> session;
+ sp<DeviceCb> cb;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold, &session /*out*/,
&previewStream /*out*/, &halStreamConfig /*out*/,
&supportsPartialResults /*out*/,
- &partialResultCount /*out*/);
+ &partialResultCount /*out*/, &useHalBufManager /*out*/, &cb /*out*/);
RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
Return<void> ret;
@@ -4019,12 +4416,14 @@
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
sp<ICameraDeviceSession> session;
+ sp<DeviceCb> cb;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold, &session /*out*/,
&previewStream /*out*/, &halStreamConfig /*out*/,
&supportsPartialResults /*out*/,
- &partialResultCount /*out*/);
+ &partialResultCount /*out*/, &useHalBufManager /*out*/, &cb /*out*/);
std::shared_ptr<ResultMetadataQueue> resultQueue;
auto resultQueueRet =
@@ -4054,10 +4453,14 @@
ASSERT_TRUE(ret.isOk());
hidl_handle buffer_handle;
- allocateGraphicBuffer(previewStream.width, previewStream.height,
- android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
- halStreamConfig.streams[0].consumerUsage),
- halStreamConfig.streams[0].overrideFormat, &buffer_handle);
+ if (useHalBufManager) {
+ bufferId = 0;
+ } else {
+ allocateGraphicBuffer(previewStream.width, previewStream.height,
+ android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
+ halStreamConfig.streams[0].consumerUsage),
+ halStreamConfig.streams[0].overrideFormat, &buffer_handle);
+ }
StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
bufferId,
@@ -4124,6 +4527,10 @@
}
}
+ if (useHalBufManager) {
+ verifyBuffersReturned(session, deviceVersion, previewStream.id, cb);
+ }
+
ret = session->close();
ASSERT_TRUE(ret.isOk());
}
@@ -4149,12 +4556,14 @@
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
sp<ICameraDeviceSession> session;
+ sp<DeviceCb> cb;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold, &session /*out*/,
&previewStream /*out*/, &halStreamConfig /*out*/,
&supportsPartialResults /*out*/,
- &partialResultCount /*out*/);
+ &partialResultCount /*out*/, &useHalBufManager /*out*/, &cb /*out*/);
Return<Status> returnStatus = session->flush();
ASSERT_TRUE(returnStatus.isOk());
@@ -4496,9 +4905,11 @@
const ::android::hardware::hidl_vec<V3_2::Stream>& streams3_2,
StreamConfigurationMode configMode,
::android::hardware::camera::device::V3_2::StreamConfiguration *config3_2 /*out*/,
- ::android::hardware::camera::device::V3_4::StreamConfiguration *config3_4 /*out*/) {
+ ::android::hardware::camera::device::V3_4::StreamConfiguration *config3_4 /*out*/,
+ ::android::hardware::camera::device::V3_5::StreamConfiguration *config3_5 /*out*/) {
ASSERT_NE(nullptr, config3_2);
ASSERT_NE(nullptr, config3_4);
+ ASSERT_NE(nullptr, config3_5);
::android::hardware::hidl_vec<V3_4::Stream> streams3_4(streams3_2.size());
size_t idx = 0;
@@ -4507,7 +4918,9 @@
stream.v3_2 = stream3_2;
streams3_4[idx++] = stream;
}
- *config3_4 = {streams3_4, configMode, {}};
+ // Caller is responsible to fill in non-zero config3_5->streamConfigCounter after this returns
+ *config3_5 = {{streams3_4, configMode, {}}, 0};
+ *config3_4 = config3_5->v3_4;
*config3_2 = {streams3_2, configMode};
}
@@ -4517,15 +4930,22 @@
const AvailableStream *previewThreshold,
const std::unordered_set<std::string>& physicalIds,
sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/,
+ sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/,
V3_2::Stream *previewStream /*out*/,
device::V3_4::HalStreamConfiguration *halStreamConfig /*out*/,
bool *supportsPartialResults /*out*/,
- uint32_t *partialResultCount /*out*/) {
+ uint32_t *partialResultCount /*out*/,
+ bool *useHalBufManager /*out*/,
+ sp<DeviceCb> *outCb /*out*/,
+ uint32_t streamConfigCounter) {
ASSERT_NE(nullptr, session3_4);
+ ASSERT_NE(nullptr, session3_5);
ASSERT_NE(nullptr, halStreamConfig);
ASSERT_NE(nullptr, previewStream);
ASSERT_NE(nullptr, supportsPartialResults);
ASSERT_NE(nullptr, partialResultCount);
+ ASSERT_NE(nullptr, useHalBufManager);
+ ASSERT_NE(nullptr, outCb);
ASSERT_FALSE(physicalIds.empty());
std::vector<AvailableStream> outputPreviewStreams;
@@ -4574,10 +4994,19 @@
session = newSession;
});
ASSERT_TRUE(ret.isOk());
+ *outCb = cb;
sp<device::V3_3::ICameraDeviceSession> session3_3;
- castSession(session, deviceVersion, &session3_3, session3_4);
- ASSERT_NE(nullptr, session3_4);
+ castSession(session, deviceVersion, &session3_3, session3_4, session3_5);
+ ASSERT_NE(nullptr, (*session3_4).get());
+
+ *useHalBufManager = false;
+ status = find_camera_metadata_ro_entry(staticMeta,
+ ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, &entry);
+ if ((0 == status) && (entry.count == 1)) {
+ *useHalBufManager = (entry.data.u8[0] ==
+ ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5);
+ }
outputPreviewStreams.clear();
auto rc = getAvailableOutputStreams(staticMeta,
@@ -4599,6 +5028,7 @@
}
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
config3_4 = {streams3_4, StreamConfigurationMode::NORMAL_MODE, {}};
RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
ret = (*session3_4)->constructDefaultRequestSettings(reqTemplate,
@@ -4608,12 +5038,32 @@
});
ASSERT_TRUE(ret.isOk());
- ret = (*session3_4)->configureStreams_3_4(config3_4,
- [&] (Status s, device::V3_4::HalStreamConfiguration halConfig) {
- ASSERT_EQ(Status::OK, s);
- ASSERT_EQ(physicalIds.size(), halConfig.streams.size());
- *halStreamConfig = halConfig;
- });
+ if (*session3_5 != nullptr) {
+ config3_5.v3_4 = config3_4;
+ config3_5.streamConfigCounter = streamConfigCounter;
+ ret = (*session3_5)->configureStreams_3_5(config3_5,
+ [&] (Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(physicalIds.size(), halConfig.streams.size());
+ *halStreamConfig = halConfig;
+ if (*useHalBufManager) {
+ hidl_vec<V3_2::Stream> streams(physicalIds.size());
+ hidl_vec<V3_2::HalStream> halStreams(physicalIds.size());
+ for (size_t i = 0; i < physicalIds.size(); i++) {
+ streams[i] = streams3_4[i].v3_2;
+ halStreams[i] = halConfig.streams[i].v3_3.v3_2;
+ }
+ cb->setCurrentStreamConfig(streams, halStreams);
+ }
+ });
+ } else {
+ ret = (*session3_4)->configureStreams_3_4(config3_4,
+ [&] (Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(physicalIds.size(), halConfig.streams.size());
+ *halStreamConfig = halConfig;
+ });
+ }
*previewStream = streams3_4[0].v3_2;
ASSERT_TRUE(ret.isOk());
}
@@ -4626,12 +5076,17 @@
V3_2::Stream *previewStream /*out*/,
HalStreamConfiguration *halStreamConfig /*out*/,
bool *supportsPartialResults /*out*/,
- uint32_t *partialResultCount /*out*/) {
+ uint32_t *partialResultCount /*out*/,
+ bool *useHalBufManager /*out*/,
+ sp<DeviceCb> *outCb /*out*/,
+ uint32_t streamConfigCounter) {
ASSERT_NE(nullptr, session);
ASSERT_NE(nullptr, previewStream);
ASSERT_NE(nullptr, halStreamConfig);
ASSERT_NE(nullptr, supportsPartialResults);
ASSERT_NE(nullptr, partialResultCount);
+ ASSERT_NE(nullptr, useHalBufManager);
+ ASSERT_NE(nullptr, outCb);
std::vector<AvailableStream> outputPreviewStreams;
::android::sp<ICameraDevice> device3_x;
@@ -4678,10 +5133,20 @@
*session = newSession;
});
ASSERT_TRUE(ret.isOk());
+ *outCb = cb;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
- castSession(*session, deviceVersion, &session3_3, &session3_4);
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
+ castSession(*session, deviceVersion, &session3_3, &session3_4, &session3_5);
+
+ *useHalBufManager = false;
+ status = find_camera_metadata_ro_entry(staticMeta,
+ ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, &entry);
+ if ((0 == status) && (entry.count == 1)) {
+ *useHalBufManager = (entry.data.u8[0] ==
+ ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5);
+ }
outputPreviewStreams.clear();
auto rc = getAvailableOutputStreams(staticMeta,
@@ -4698,9 +5163,33 @@
::android::hardware::hidl_vec<V3_2::Stream> streams3_2 = {stream3_2};
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
createStreamConfiguration(streams3_2, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
+ ret = session3_5->constructDefaultRequestSettings(reqTemplate,
+ [&config3_5](auto status, const auto& req) {
+ ASSERT_EQ(Status::OK, status);
+ config3_5.v3_4.sessionParams = req;
+ });
+ ASSERT_TRUE(ret.isOk());
+ config3_5.streamConfigCounter = streamConfigCounter;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [&] (Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ halStreamConfig->streams.resize(1);
+ halStreamConfig->streams[0] = halConfig.streams[0].v3_3.v3_2;
+ if (*useHalBufManager) {
+ hidl_vec<V3_2::Stream> streams(1);
+ hidl_vec<V3_2::HalStream> halStreams(1);
+ streams[0] = stream3_2;
+ halStreams[0] = halConfig.streams[0].v3_3.v3_2;
+ cb->setCurrentStreamConfig(streams, halStreams);
+ }
+ });
+ } else if (session3_4 != nullptr) {
RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
ret = session3_4->constructDefaultRequestSettings(reqTemplate,
[&config3_4](auto status, const auto& req) {
@@ -4742,18 +5231,25 @@
//Cast camera device session to corresponding version
void CameraHidlTest::castSession(const sp<ICameraDeviceSession> &session, int32_t deviceVersion,
sp<device::V3_3::ICameraDeviceSession> *session3_3 /*out*/,
- sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/) {
+ sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/,
+ sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/) {
ASSERT_NE(nullptr, session3_3);
ASSERT_NE(nullptr, session3_4);
+ ASSERT_NE(nullptr, session3_5);
switch (deviceVersion) {
- case CAMERA_DEVICE_API_VERSION_3_5:
+ case CAMERA_DEVICE_API_VERSION_3_5: {
+ auto castResult = device::V3_5::ICameraDeviceSession::castFrom(session);
+ ASSERT_TRUE(castResult.isOk());
+ *session3_5 = castResult;
+ }
+ [[fallthrough]];
case CAMERA_DEVICE_API_VERSION_3_4: {
auto castResult = device::V3_4::ICameraDeviceSession::castFrom(session);
ASSERT_TRUE(castResult.isOk());
*session3_4 = castResult;
- break;
}
+ [[fallthrough]];
case CAMERA_DEVICE_API_VERSION_3_3: {
auto castResult = device::V3_3::ICameraDeviceSession::castFrom(session);
ASSERT_TRUE(castResult.isOk());
@@ -4891,8 +5387,10 @@
retcode = find_camera_metadata_ro_entry(metadata,
ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT, &entry);
if ((0 == retcode) && (entry.count == 1)) {
- ASSERT_TRUE(entry.data.i32[0] == ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO
- || entry.data.i32[0] == ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR);
+ ASSERT_TRUE(entry.data.i32[0] == static_cast<int32_t>(
+ CameraMetadataEnumAndroidSensorInfoColorFilterArrangement::ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO)
+ || entry.data.i32[0] == static_cast<int32_t>(
+ CameraMetadataEnumAndroidSensorInfoColorFilterArrangement::ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR));
}
// Check availableRequestKeys
@@ -5004,6 +5502,33 @@
}
}
+void CameraHidlTest::verifyBuffersReturned(
+ sp<device::V3_2::ICameraDeviceSession> session,
+ int deviceVersion, int32_t streamId,
+ sp<DeviceCb> cb, uint32_t streamConfigCounter) {
+ sp<device::V3_3::ICameraDeviceSession> session3_3;
+ sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
+ ASSERT_NE(nullptr, session3_5.get());
+
+ hidl_vec<int32_t> streamIds(1);
+ streamIds[0] = streamId;
+ session3_5->signalStreamFlush(streamIds, /*streamConfigCounter*/streamConfigCounter);
+ cb->waitForBuffersReturned();
+}
+
+void CameraHidlTest::verifyBuffersReturned(
+ sp<device::V3_4::ICameraDeviceSession> session3_4,
+ hidl_vec<int32_t> streamIds, sp<DeviceCb> cb, uint32_t streamConfigCounter) {
+ auto castResult = device::V3_5::ICameraDeviceSession::castFrom(session3_4);
+ ASSERT_TRUE(castResult.isOk());
+ sp<device::V3_5::ICameraDeviceSession> session3_5 = castResult;
+ ASSERT_NE(nullptr, session3_5.get());
+
+ session3_5->signalStreamFlush(streamIds, /*streamConfigCounter*/streamConfigCounter);
+ cb->waitForBuffersReturned();
+}
// Open a device session with empty callbacks and return static metadata.
void CameraHidlTest::openEmptyDeviceSession(const std::string &name,
diff --git a/cas/1.0/default/Android.bp b/cas/1.0/default/Android.bp
index 544162b..debb3e5 100644
--- a/cas/1.0/default/Android.bp
+++ b/cas/1.0/default/Android.bp
@@ -1,5 +1,5 @@
-cc_binary {
- name: "android.hardware.cas@1.0-service",
+cc_defaults {
+ name: "cas_service_defaults",
defaults: ["hidl_defaults"],
vendor: true,
relative_install_path: "hw",
@@ -13,7 +13,6 @@
],
compile_multilib: "32",
- init_rc: ["android.hardware.cas@1.0-service.rc"],
shared_libs: [
"android.hardware.cas@1.0",
@@ -31,3 +30,19 @@
"media_plugin_headers",
],
}
+
+cc_binary {
+ name: "android.hardware.cas@1.0-service",
+ vintf_fragments: ["android.hardware.cas@1.0-service.xml"],
+ defaults: ["cas_service_defaults"],
+ init_rc: ["android.hardware.cas@1.0-service.rc"],
+}
+
+cc_binary {
+ name: "android.hardware.cas@1.0-service-lazy",
+ vintf_fragments: ["android.hardware.cas@1.0-service-lazy.xml"],
+ overrides: ["android.hardware.cas@1.0-service"],
+ defaults: ["cas_service_defaults"],
+ init_rc: ["android.hardware.cas@1.0-service-lazy.rc"],
+ cflags: ["-DLAZY_SERVICE"],
+}
diff --git a/cas/1.0/default/android.hardware.cas@1.0-service-lazy.rc b/cas/1.0/default/android.hardware.cas@1.0-service-lazy.rc
new file mode 100644
index 0000000..735cfbc
--- /dev/null
+++ b/cas/1.0/default/android.hardware.cas@1.0-service-lazy.rc
@@ -0,0 +1,9 @@
+service vendor.cas-hal-1-0 /vendor/bin/hw/android.hardware.cas@1.0-service
+ interface android.hardware.cas@1.0::IMediaCasService default
+ oneshot
+ disabled
+ class hal
+ user media
+ group mediadrm drmrpc
+ ioprio rt 4
+ writepid /dev/cpuset/foreground/tasks
diff --git a/cas/1.0/default/android.hardware.cas@1.0-service-lazy.xml b/cas/1.0/default/android.hardware.cas@1.0-service-lazy.xml
new file mode 100644
index 0000000..9b55370
--- /dev/null
+++ b/cas/1.0/default/android.hardware.cas@1.0-service-lazy.xml
@@ -0,0 +1,11 @@
+<manifest version="1.0" type="device">
+ <hal format="hidl">
+ <name>android.hardware.cas</name>
+ <transport>hwbinder</transport>
+ <version>1.0</version>
+ <interface>
+ <name>IMediaCasService</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+</manifest>
diff --git a/cas/1.0/default/android.hardware.cas@1.0-service.xml b/cas/1.0/default/android.hardware.cas@1.0-service.xml
new file mode 100644
index 0000000..9b55370
--- /dev/null
+++ b/cas/1.0/default/android.hardware.cas@1.0-service.xml
@@ -0,0 +1,11 @@
+<manifest version="1.0" type="device">
+ <hal format="hidl">
+ <name>android.hardware.cas</name>
+ <transport>hwbinder</transport>
+ <version>1.0</version>
+ <interface>
+ <name>IMediaCasService</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+</manifest>
diff --git a/cas/1.0/default/service.cpp b/cas/1.0/default/service.cpp
index 04a8ad9..2e6e55d 100644
--- a/cas/1.0/default/service.cpp
+++ b/cas/1.0/default/service.cpp
@@ -15,7 +15,11 @@
*/
//#define LOG_NDEBUG 0
+#ifdef LAZY_SERVICE
+#define LOG_TAG "android.hardware.cas@1.0-service-lazy"
+#else
#define LOG_TAG "android.hardware.cas@1.0-service"
+#endif
#include <binder/ProcessState.h>
#include <hidl/HidlTransportSupport.h>
@@ -25,24 +29,30 @@
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
-using android::hardware::cas::V1_0::implementation::MediaCasService;
+using android::hardware::LazyServiceRegistrar;
using android::hardware::cas::V1_0::IMediaCasService;
+using android::hardware::cas::V1_0::implementation::MediaCasService;
+
+#ifdef LAZY_SERVICE
+const bool kLazyService = true;
+#else
+const bool kLazyService = false;
+#endif
int main() {
- ALOGD("android.hardware.cas@1.0-service starting...");
-
- // The CAS HAL may communicate to other vendor components via
- // /dev/vndbinder
- android::ProcessState::initWithDriver("/dev/vndbinder");
-
configureRpcThreadpool(8, true /* callerWillJoin */);
// Setup hwbinder service
android::sp<IMediaCasService> service = new MediaCasService();
- android::status_t status = service->registerAsService();
- LOG_ALWAYS_FATAL_IF(
- status != android::OK,
- "Error while registering cas service: %d", status);
+ android::status_t status;
+ if (kLazyService) {
+ auto serviceRegistrar = std::make_shared<LazyServiceRegistrar>();
+ status = serviceRegistrar->registerServiceWithCallback(service);
+ } else {
+ status = service->registerAsService();
+ }
+ LOG_ALWAYS_FATAL_IF(status != android::OK, "Error while registering cas service: %d", status);
+
joinRpcThreadpool();
return 0;
}
diff --git a/cas/1.0/vts/functional/Android.bp b/cas/1.0/vts/functional/Android.bp
index 0db9bb0..622baa5 100644
--- a/cas/1.0/vts/functional/Android.bp
+++ b/cas/1.0/vts/functional/Android.bp
@@ -29,5 +29,6 @@
shared_libs: [
"libbinder",
],
+ test_suites: ["general-tests"],
}
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index fd996fb..ceb53be 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -186,6 +186,7 @@
<hal format="hidl" optional="true">
<name>android.hardware.gnss</name>
<version>1.0-1</version>
+ <version>2.0</version>
<interface>
<name>IGnss</name>
<instance>default</instance>
diff --git a/configstore/1.0/vts/functional/Android.bp b/configstore/1.0/vts/functional/Android.bp
index 1b8a591..008b59d 100644
--- a/configstore/1.0/vts/functional/Android.bp
+++ b/configstore/1.0/vts/functional/Android.bp
@@ -19,5 +19,6 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalConfigstoreV1_0TargetTest.cpp"],
static_libs: ["android.hardware.configstore@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/confirmationui/1.0/vts/functional/Android.bp b/confirmationui/1.0/vts/functional/Android.bp
index 823e035..d19d702 100644
--- a/confirmationui/1.0/vts/functional/Android.bp
+++ b/confirmationui/1.0/vts/functional/Android.bp
@@ -27,4 +27,5 @@
"libcn-cbor",
"android.hardware.confirmationui-support-lib",
],
+ test_suites: ["general-tests"],
}
diff --git a/confirmationui/support/Android.bp b/confirmationui/support/Android.bp
index 62156b3..e215baa 100644
--- a/confirmationui/support/Android.bp
+++ b/confirmationui/support/Android.bp
@@ -46,6 +46,7 @@
"android.hardware.keymaster@4.0",
"libhidlbase",
],
+ test_suites: ["general-tests"],
clang: true,
cflags: [ "-O0" ],
}
diff --git a/contexthub/1.0/vts/functional/Android.bp b/contexthub/1.0/vts/functional/Android.bp
index 7c6e8c7..aef0340 100644
--- a/contexthub/1.0/vts/functional/Android.bp
+++ b/contexthub/1.0/vts/functional/Android.bp
@@ -19,5 +19,6 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalContexthubV1_0TargetTest.cpp"],
static_libs: ["android.hardware.contexthub@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/drm/1.0/vts/functional/Android.bp b/drm/1.0/vts/functional/Android.bp
index 57678fb..d6ebfdd 100644
--- a/drm/1.0/vts/functional/Android.bp
+++ b/drm/1.0/vts/functional/Android.bp
@@ -32,4 +32,5 @@
"libssl",
"libcrypto",
],
+ test_suites: ["general-tests"],
}
diff --git a/drm/1.1/vts/functional/Android.bp b/drm/1.1/vts/functional/Android.bp
index 782f283..1090b69 100644
--- a/drm/1.1/vts/functional/Android.bp
+++ b/drm/1.1/vts/functional/Android.bp
@@ -31,4 +31,5 @@
"libssl",
"libcrypto",
],
+ test_suites: ["general-tests"],
}
diff --git a/dumpstate/1.0/vts/functional/Android.bp b/dumpstate/1.0/vts/functional/Android.bp
index 1ab530f..fc64d05 100644
--- a/dumpstate/1.0/vts/functional/Android.bp
+++ b/dumpstate/1.0/vts/functional/Android.bp
@@ -18,4 +18,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalDumpstateV1_0TargetTest.cpp"],
static_libs: ["android.hardware.dumpstate@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/gatekeeper/1.0/vts/functional/Android.bp b/gatekeeper/1.0/vts/functional/Android.bp
index aa1da7b..f55e5d2 100644
--- a/gatekeeper/1.0/vts/functional/Android.bp
+++ b/gatekeeper/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalGatekeeperV1_0TargetTest.cpp"],
static_libs: ["android.hardware.gatekeeper@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/gnss/1.0/vts/functional/Android.bp b/gnss/1.0/vts/functional/Android.bp
index d7713db..505cb41 100644
--- a/gnss/1.0/vts/functional/Android.bp
+++ b/gnss/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalGnssV1_0TargetTest.cpp"],
static_libs: ["android.hardware.gnss@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/gnss/1.1/vts/functional/Android.bp b/gnss/1.1/vts/functional/Android.bp
index 67ef486..9892eca 100644
--- a/gnss/1.1/vts/functional/Android.bp
+++ b/gnss/1.1/vts/functional/Android.bp
@@ -26,4 +26,5 @@
"android.hardware.gnss@1.0",
"android.hardware.gnss@1.1",
],
+ test_suites: ["general-tests"],
}
diff --git a/gnss/2.0/Android.bp b/gnss/2.0/Android.bp
new file mode 100644
index 0000000..39fe97d
--- /dev/null
+++ b/gnss/2.0/Android.bp
@@ -0,0 +1,21 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.gnss@2.0",
+ root: "android.hardware",
+ vndk: {
+ enabled: true,
+ },
+ srcs: [
+ "IGnss.hal",
+ "IGnssMeasurement.hal",
+ "IGnssMeasurementCallback.hal",
+ ],
+ interfaces: [
+ "android.hardware.gnss@1.0",
+ "android.hardware.gnss@1.1",
+ "android.hidl.base@1.0",
+ ],
+ gen_java: true,
+}
+
diff --git a/gnss/2.0/IGnss.hal b/gnss/2.0/IGnss.hal
new file mode 100644
index 0000000..a05f61a
--- /dev/null
+++ b/gnss/2.0/IGnss.hal
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@2.0;
+
+import @1.1::IGnss;
+
+import IGnssMeasurement;
+
+/** Represents the standard GNSS (Global Navigation Satellite System) interface. */
+interface IGnss extends @1.1::IGnss {
+ /**
+ * This method returns the IGnssMeasurement interface.
+ *
+ * Exactly one of getExtensionGnssMeasurement_1_1() and getExtensionGnssMeasurement_2_0() must
+ * return a non-null handle, and the other method must return nullptr.
+ *
+ * @return gnssMeasurementIface Handle to the IGnssMeasurement interface.
+ */
+ getExtensionGnssMeasurement_2_0() generates (IGnssMeasurement gnssMeasurementIface);
+};
\ No newline at end of file
diff --git a/gnss/2.0/IGnssMeasurement.hal b/gnss/2.0/IGnssMeasurement.hal
new file mode 100644
index 0000000..108f3d2
--- /dev/null
+++ b/gnss/2.0/IGnssMeasurement.hal
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@2.0;
+
+import @1.0::IGnssMeasurement;
+import @1.1::IGnssMeasurement;
+import IGnssMeasurementCallback;
+
+/**
+ * Extended interface for GNSS Measurements support.
+ */
+interface IGnssMeasurement extends @1.1::IGnssMeasurement {
+
+ /**
+ * Initializes the interface and registers the callback routines with the HAL. After a
+ * successful call to 'setCallback_2_0' the HAL must begin to provide updates at an average
+ * output rate of 1Hz (occasional intra-measurement time offsets in the range from 0-2000msec
+ * can be tolerated.)
+ *
+ * @param callback Handle to GnssMeasurement callback interface.
+ * @param enableFullTracking If true, GNSS chipset must switch off duty cycling. In such mode
+ * no clock discontinuities are expected and, when supported, carrier phase should be
+ * continuous in good signal conditions. All non-blacklisted, healthy constellations,
+ * satellites and frequency bands that the chipset supports must be reported in this mode.
+ * The GNSS chipset is allowed to consume more power in this mode. If false, API must behave
+ * as in HAL V1_0, optimizing power via duty cycling, constellations and frequency limits,
+ * etc.
+ *
+ * @return initRet Returns SUCCESS if successful. Returns ERROR_ALREADY_INIT if a callback has
+ * already been registered without a corresponding call to 'close'. Returns ERROR_GENERIC
+ * for any other error. The HAL must not generate any other updates upon returning this
+ * error code.
+ */
+ setCallback_2_0(IGnssMeasurementCallback callback, bool enableFullTracking)
+ generates (GnssMeasurementStatus initRet);
+
+};
diff --git a/gnss/2.0/IGnssMeasurementCallback.hal b/gnss/2.0/IGnssMeasurementCallback.hal
new file mode 100644
index 0000000..226934e
--- /dev/null
+++ b/gnss/2.0/IGnssMeasurementCallback.hal
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@2.0;
+
+import @1.0::IGnssMeasurementCallback;
+import @1.1::IGnssMeasurementCallback;
+
+/** The callback interface to report measurements from the HAL. */
+interface IGnssMeasurementCallback extends @1.1::IGnssMeasurementCallback {
+ /**
+ * Enumeration of available values for the GNSS Measurement's code type. Similar to the
+ * Attribute field described in Rinex 3.03, e.g., in Tables 4-10, and Table A2 at the Rinex 3.03
+ * Update 1 Document.
+ */
+ enum GnssMeasurementCodeType : uint8_t {
+ /** GALILEO E1A, GALILEO E6A, IRNSS L5A, IRNSS SA. */
+ CODE_TYPE_A = 0,
+
+ /** GALILEO E1B, GALILEO E6B, IRNSS L5B, IRNSS SB. */
+ CODE_TYPE_B = 1,
+
+ /**
+ * GPS L1 C/A, GPS L2 C/A, GLONASS G1 C/A, GLONASS G2 C/A, GALILEO E1C, GALILEO E6C, SBAS
+ * L1 C/A, QZSS L1 C/A, IRNSS L5C.
+ */
+ CODE_TYPE_C = 2,
+
+ /**
+ * GPS L5 I, GLONASS G3 I, GALILEO E5a I, GALILEO E5b I, GALILEO E5a+b I, SBAS L5 I, QZSS L5
+ * I, BDS B1 I, BDS B2 I, BDS B3 I.
+ */
+ CODE_TYPE_I = 3,
+
+ /** GPS L1C (P), GPS L2C (L), QZSS L1C (P), QZSS L2C (L), LEX(6) L. */
+ CODE_TYPE_L = 4,
+
+ /** GPS L1M, GPS L2M. */
+ CODE_TYPE_M = 5,
+
+ /** GPS L1P, GPS L2P, GLONASS G1P, GLONASS G2P. */
+ CODE_TYPE_P = 6,
+
+ /**
+ * GPS L5 Q, GLONASS G3 Q, GALILEO E5a Q, GALILEO E5b Q, GALILEO E5a+b Q, SBAS L5 Q, QZSS L5
+ * Q, BDS B1 Q, BDS B2 Q, BDS B3 Q.
+ */
+ CODE_TYPE_Q = 7,
+
+ /** GPS L1C (D), GPS L2C (M), QZSS L1C (D), QZSS L2C (M), LEX(6) S. */
+ CODE_TYPE_S = 8,
+
+ /** GPS L1 Z-tracking, GPS L2 Z-tracking. */
+ CODE_TYPE_W = 9,
+
+ /**
+ * GPS L1C (D+P), GPS L2C (M+L), GPS L5 (I+Q), GLONASS G3 (I+Q), GALILEO E1 (B+C), GALILEO
+ * E5a (I+Q), GALILEO E5b (I+Q), GALILEO E5a+b(I+Q), GALILEO E6 (B+C), SBAS L5 (I+Q), QZSS
+ * L1C (D+P), QZSS L2C (M+L), QZSS L5 (I+Q), LEX(6) (S+L), BDS B1 (I+Q), BDS B2 (I+Q), BDS
+ * B3 (I+Q), IRNSS L5 (B+C).
+ */
+ CODE_TYPE_X = 10,
+
+ /** GPS L1Y, GPS L2Y. */
+ CODE_TYPE_Y = 11,
+
+ /** GALILEO E1 (A+B+C), GALILEO E6 (A+B+C), QZSS L1-SAIF. */
+ CODE_TYPE_Z = 12,
+
+ /** GPS L1 codeless, GPS L2 codeless. */
+ CODE_TYPE_CODELESS = 13
+ };
+
+ /**
+ * Extends a GNSS Measurement, adding a GnssMeasurementCodeType.
+ */
+ struct GnssMeasurement {
+ /**
+ * GNSS measurement information for a single satellite and frequency, as in the 1.1
+ * version of the HAL with further clarification of the value reported in the
+ * accumulatedDeltaRangeM field, i.e., the alignment of the phase measurement will not be
+ * adjusted by the receiver so the in-phase and quadrature phase components will have a
+ * quarter cycle offset as they do when transmitted from the satellites. If the measurement
+ * is from a combination of the in-phase and quadrature phase components, then the alignment
+ * of the phase measurement will be aligned to the in-phase component.
+ */
+ @1.1::IGnssMeasurementCallback.GnssMeasurement v1_1;
+
+ /**
+ * The type of code that is currently being tracked in the GNSS measurement.
+ *
+ * For high precision applications the type of code being tracked needs to be considered
+ * in-order to properly apply code specific corrections to the psuedorange measurements.
+ */
+ GnssMeasurementCodeType codeType;
+ };
+
+ /**
+ * Complete set of GNSS Measurement data, same as 1.1 with additional enum in measurements.
+ */
+ struct GnssData {
+ /** The full set of satellite measurement observations. */
+ vec<GnssMeasurement> measurements;
+
+ /** The GNSS clock time reading. */
+ GnssClock clock;
+ };
+
+ /**
+ * Callback for the hal to pass a GnssData structure back to the client.
+ *
+ * @param data Contains a reading of GNSS measurements.
+ */
+ gnssMeasurementCb_2_0(GnssData data);
+};
diff --git a/gnss/2.0/default/Android.bp b/gnss/2.0/default/Android.bp
new file mode 100644
index 0000000..3c55578
--- /dev/null
+++ b/gnss/2.0/default/Android.bp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2018 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_binary {
+ name: "android.hardware.gnss@2.0-service",
+ init_rc: ["android.hardware.gnss@2.0-service.rc"],
+ relative_install_path: "hw",
+ vendor: true,
+ srcs: [
+ "Gnss.cpp",
+ "GnssMeasurement.cpp",
+ "service.cpp"
+ ],
+ shared_libs: [
+ "libhidlbase",
+ "libhidltransport",
+ "libutils",
+ "liblog",
+ "android.hardware.gnss@2.0",
+ "android.hardware.gnss@1.0",
+ "android.hardware.gnss@1.1",
+ ],
+}
diff --git a/gnss/2.0/default/Gnss.cpp b/gnss/2.0/default/Gnss.cpp
new file mode 100644
index 0000000..1170f73
--- /dev/null
+++ b/gnss/2.0/default/Gnss.cpp
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#define LOG_TAG "Gnss"
+
+#include "Gnss.h"
+#include <log/log.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+sp<V1_1::IGnssCallback> Gnss::sGnssCallback = nullptr;
+
+// Methods from V1_0::IGnss follow.
+Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>&) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> Gnss::start() {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> Gnss::stop() {
+ // TODO implement
+ return bool{};
+}
+
+Return<void> Gnss::cleanup() {
+ // TODO implement
+ return Void();
+}
+
+Return<bool> Gnss::injectTime(int64_t, int64_t, int32_t) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> Gnss::injectLocation(double, double, float) {
+ // TODO implement
+ return bool{};
+}
+
+Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData) {
+ // TODO implement
+ return Void();
+}
+
+Return<bool> Gnss::setPositionMode(V1_0::IGnss::GnssPositionMode,
+ V1_0::IGnss::GnssPositionRecurrence, uint32_t, uint32_t,
+ uint32_t) {
+ // TODO implement
+ return bool{};
+}
+
+Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() {
+ // TODO implement
+ return sp<V1_0::IAGnssRil>{};
+}
+
+Return<sp<V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
+ // TODO implement
+ return sp<V1_0::IGnssGeofencing>{};
+}
+
+Return<sp<V1_0::IAGnss>> Gnss::getExtensionAGnss() {
+ // TODO implement
+ return sp<V1_0::IAGnss>{};
+}
+
+Return<sp<V1_0::IGnssNi>> Gnss::getExtensionGnssNi() {
+ // TODO implement
+ return sp<V1_0::IGnssNi>{};
+}
+
+Return<sp<V1_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
+ // TODO implement
+ return sp<V1_0::IGnssMeasurement>{};
+}
+
+Return<sp<V1_0::IGnssNavigationMessage>> Gnss::getExtensionGnssNavigationMessage() {
+ // TODO implement
+ return sp<V1_0::IGnssNavigationMessage>{};
+}
+
+Return<sp<V1_0::IGnssXtra>> Gnss::getExtensionXtra() {
+ // TODO implement
+ return sp<V1_0::IGnssXtra>{};
+}
+
+Return<sp<V1_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
+ // TODO implement
+ return sp<V1_0::IGnssConfiguration>{};
+}
+
+Return<sp<V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() {
+ // TODO implement
+ return sp<V1_0::IGnssDebug>{};
+}
+
+Return<sp<V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() {
+ // TODO implement
+ return sp<V1_0::IGnssBatching>{};
+}
+
+// Methods from V1_1::IGnss follow.
+Return<bool> Gnss::setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) {
+ ALOGD("Gnss::setCallback_1_1");
+ if (callback == nullptr) {
+ ALOGE("%s: Null callback ignored", __func__);
+ return false;
+ }
+
+ sGnssCallback = callback;
+
+ uint32_t capabilities = 0x0;
+ auto ret = sGnssCallback->gnssSetCapabilitesCb(capabilities);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
+
+ V1_1::IGnssCallback::GnssSystemInfo gnssInfo = {.yearOfHw = 2019};
+
+ ret = sGnssCallback->gnssSetSystemInfoCb(gnssInfo);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
+
+ auto gnssName = "Google Mock GNSS Implementation v2.0";
+ ret = sGnssCallback->gnssNameCb(gnssName);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
+
+ return true;
+}
+
+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<sp<V1_1::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_1_1() {
+ // TODO implement
+ return sp<V1_1::IGnssConfiguration>{};
+}
+
+Return<sp<V1_1::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_1_1() {
+ // TODO implement
+ return sp<V1_1::IGnssMeasurement>{};
+}
+
+Return<bool> Gnss::injectBestLocation(const V1_0::GnssLocation&) {
+ // TODO implement
+ return bool{};
+}
+
+// Methods from V2_0::IGnss follow.
+Return<sp<V2_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_2_0() {
+ // TODO implement
+ return sp<V2_0::IGnssMeasurement>{};
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gnss/2.0/default/Gnss.h b/gnss/2.0/default/Gnss.h
new file mode 100644
index 0000000..17e439f
--- /dev/null
+++ b/gnss/2.0/default/Gnss.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2018 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_V2_0_GNSS_H
+#define ANDROID_HARDWARE_GNSS_V2_0_GNSS_H
+
+#include <android/hardware/gnss/2.0/IGnss.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+
+struct Gnss : public IGnss {
+ // Methods from V1_0::IGnss follow.
+ Return<bool> setCallback(const sp<V1_0::IGnssCallback>& callback) override;
+ Return<bool> start() override;
+ Return<bool> stop() override;
+ Return<void> cleanup() override;
+ Return<bool> injectTime(int64_t timeMs, int64_t timeReferenceMs,
+ int32_t uncertaintyMs) override;
+ Return<bool> injectLocation(double latitudeDegrees, double longitudeDegrees,
+ float accuracyMeters) override;
+ Return<void> deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) override;
+ Return<bool> setPositionMode(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs, uint32_t preferredAccuracyMeters,
+ uint32_t preferredTimeMs) override;
+ Return<sp<V1_0::IAGnssRil>> getExtensionAGnssRil() override;
+ Return<sp<V1_0::IGnssGeofencing>> getExtensionGnssGeofencing() override;
+ Return<sp<V1_0::IAGnss>> getExtensionAGnss() override;
+ Return<sp<V1_0::IGnssNi>> getExtensionGnssNi() override;
+ Return<sp<V1_0::IGnssMeasurement>> getExtensionGnssMeasurement() override;
+ Return<sp<V1_0::IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override;
+ Return<sp<V1_0::IGnssXtra>> getExtensionXtra() override;
+ Return<sp<V1_0::IGnssConfiguration>> getExtensionGnssConfiguration() override;
+ Return<sp<V1_0::IGnssDebug>> getExtensionGnssDebug() override;
+ Return<sp<V1_0::IGnssBatching>> getExtensionGnssBatching() override;
+
+ // Methods from V1_1::IGnss follow.
+ Return<bool> setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) override;
+ Return<bool> setPositionMode_1_1(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs, uint32_t preferredAccuracyMeters,
+ 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;
+
+ // Methods from V2_0::IGnss follow.
+ Return<sp<V2_0::IGnssMeasurement>> getExtensionGnssMeasurement_2_0() override;
+
+ private:
+ static sp<V1_1::IGnssCallback> sGnssCallback;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSS_H
diff --git a/gnss/2.0/default/GnssMeasurement.cpp b/gnss/2.0/default/GnssMeasurement.cpp
new file mode 100644
index 0000000..fbcdc12
--- /dev/null
+++ b/gnss/2.0/default/GnssMeasurement.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2018 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 "GnssMeasurement.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+// Methods from V1_0::IGnssMeasurement follow.
+Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
+ const sp<V1_0::IGnssMeasurementCallback>&) {
+ // TODO implement
+ return V1_0::IGnssMeasurement::GnssMeasurementStatus{};
+}
+
+Return<void> GnssMeasurement::close() {
+ // TODO implement
+ return Void();
+}
+
+// Methods from V1_1::IGnssMeasurement follow.
+Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback_1_1(
+ const sp<V1_1::IGnssMeasurementCallback>&, bool) {
+ // TODO implement
+ return V1_0::IGnssMeasurement::GnssMeasurementStatus{};
+}
+
+// Methods from V2_0::IGnssMeasurement follow.
+Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback_2_0(
+ const sp<V2_0::IGnssMeasurementCallback>&, bool) {
+ // TODO implement
+ return V1_0::IGnssMeasurement::GnssMeasurementStatus{};
+}
+
+// Methods from ::android::hidl::base::V1_0::IBase follow.
+
+// IGnssMeasurement* HIDL_FETCH_IGnssMeasurement(const char* /* name */) {
+// return new GnssMeasurement();
+//}
+//
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gnss/2.0/default/GnssMeasurement.h b/gnss/2.0/default/GnssMeasurement.h
new file mode 100644
index 0000000..8c621bb
--- /dev/null
+++ b/gnss/2.0/default/GnssMeasurement.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2018 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_V2_0_GNSSMEASUREMENT_H
+#define ANDROID_HARDWARE_GNSS_V2_0_GNSSMEASUREMENT_H
+
+#include <android/hardware/gnss/2.0/IGnssMeasurement.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+
+struct GnssMeasurement : public IGnssMeasurement {
+ // Methods from V1_0::IGnssMeasurement follow.
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback(
+ const sp<V1_0::IGnssMeasurementCallback>& callback) override;
+ Return<void> close() override;
+
+ // Methods from V1_1::IGnssMeasurement follow.
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback_1_1(
+ const sp<V1_1::IGnssMeasurementCallback>& callback, bool enableFullTracking) override;
+
+ // Methods from V2_0::IGnssMeasurement follow.
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback_2_0(
+ const sp<V2_0::IGnssMeasurementCallback>& callback, bool enableFullTracking) override;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSMEASUREMENT_H
diff --git a/gnss/2.0/default/OWNERS b/gnss/2.0/default/OWNERS
new file mode 100644
index 0000000..8da956c
--- /dev/null
+++ b/gnss/2.0/default/OWNERS
@@ -0,0 +1,5 @@
+wyattriley@google.com
+gomo@google.com
+smalkos@google.com
+yuhany@google.com
+aadmal@google.com
diff --git a/gnss/2.0/default/android.hardware.gnss@2.0-service.rc b/gnss/2.0/default/android.hardware.gnss@2.0-service.rc
new file mode 100644
index 0000000..a27240d
--- /dev/null
+++ b/gnss/2.0/default/android.hardware.gnss@2.0-service.rc
@@ -0,0 +1,4 @@
+service vendor.gnss-2-0 /vendor/bin/hw/android.hardware.gnss@2.0-service
+ class hal
+ user system
+ group system
diff --git a/gnss/2.0/default/service.cpp b/gnss/2.0/default/service.cpp
new file mode 100644
index 0000000..301d181
--- /dev/null
+++ b/gnss/2.0/default/service.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#define LOG_TAG "android.hardware.gnss@2.0-service"
+
+#include <hidl/HidlSupport.h>
+#include <hidl/HidlTransportSupport.h>
+#include "Gnss.h"
+
+using ::android::OK;
+using ::android::sp;
+using ::android::hardware::configureRpcThreadpool;
+using ::android::hardware::joinRpcThreadpool;
+using ::android::hardware::gnss::V2_0::IGnss;
+using ::android::hardware::gnss::V2_0::implementation::Gnss;
+
+int main(int /* argc */, char* /* argv */ []) {
+ sp<IGnss> gnss = new Gnss();
+ configureRpcThreadpool(1, true /* will join */);
+ if (gnss->registerAsService() != OK) {
+ ALOGE("Could not register gnss 2.0 service.");
+ return 1;
+ }
+ joinRpcThreadpool();
+
+ ALOGE("Service exited!");
+ return 1;
+}
diff --git a/gnss/2.0/vts/OWNERS b/gnss/2.0/vts/OWNERS
new file mode 100644
index 0000000..0a7ce6c
--- /dev/null
+++ b/gnss/2.0/vts/OWNERS
@@ -0,0 +1,8 @@
+wyattriley@google.com
+gomo@google.com
+smalkos@google.com
+yuhany@google.com
+aadmal@google.com
+
+# VTS team
+yim@google.com
diff --git a/gnss/2.0/vts/functional/Android.bp b/gnss/2.0/vts/functional/Android.bp
new file mode 100644
index 0000000..7db142f
--- /dev/null
+++ b/gnss/2.0/vts/functional/Android.bp
@@ -0,0 +1,30 @@
+//
+// Copyright (C) 2018 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_test {
+ name: "VtsHalGnssV2_0TargetTest",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: [
+ "gnss_hal_test.cpp",
+ "gnss_hal_test_cases.cpp",
+ "VtsHalGnssV2_0TargetTest.cpp",
+ ],
+ static_libs: [
+ "android.hardware.gnss@1.0",
+ "android.hardware.gnss@1.1",
+ "android.hardware.gnss@2.0",
+ ],
+}
diff --git a/gnss/2.0/vts/functional/VtsHalGnssV2_0TargetTest.cpp b/gnss/2.0/vts/functional/VtsHalGnssV2_0TargetTest.cpp
new file mode 100644
index 0000000..ae36c50
--- /dev/null
+++ b/gnss/2.0/vts/functional/VtsHalGnssV2_0TargetTest.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+#define LOG_TAG "VtsHalGnssV2_0TargetTest"
+
+#include <VtsHalHidlTargetTestBase.h>
+
+#include "gnss_hal_test.h"
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(GnssHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ GnssHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ ALOGI("Test result = %d", status);
+ return status;
+}
diff --git a/gnss/2.0/vts/functional/gnss_hal_test.cpp b/gnss/2.0/vts/functional/gnss_hal_test.cpp
new file mode 100644
index 0000000..d7101a0
--- /dev/null
+++ b/gnss/2.0/vts/functional/gnss_hal_test.cpp
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#define LOG_TAG "GnssHalTest"
+
+#include <gnss_hal_test.h>
+
+#include <chrono>
+
+// Implementations for the main test class for GNSS HAL
+GnssHalTest::GnssHalTest()
+ : info_called_count_(0),
+ capabilities_called_count_(0),
+ location_called_count_(0),
+ name_called_count_(0),
+ notify_count_(0) {}
+
+void GnssHalTest::SetUp() {
+ gnss_hal_ = ::testing::VtsHalHidlTargetTestBase::getService<IGnss>(
+ GnssHidlEnvironment::Instance()->getServiceName<IGnss>());
+ list_gnss_sv_status_.clear();
+ ASSERT_NE(gnss_hal_, nullptr);
+
+ SetUpGnssCallback();
+}
+
+void GnssHalTest::TearDown() {
+ if (gnss_hal_ != nullptr) {
+ gnss_hal_->cleanup();
+ }
+ if (notify_count_ > 0) {
+ ALOGW("%d unprocessed callbacks discarded", notify_count_);
+ }
+}
+
+void GnssHalTest::SetUpGnssCallback() {
+ gnss_cb_ = new GnssCallback(*this);
+ ASSERT_NE(gnss_cb_, nullptr);
+
+ auto result = gnss_hal_->setCallback_1_1(gnss_cb_);
+ if (!result.isOk()) {
+ ALOGE("result of failed setCallback %s", result.description().c_str());
+ }
+
+ ASSERT_TRUE(result.isOk());
+ ASSERT_TRUE(result);
+
+ /*
+ * All capabilities, name and systemInfo callbacks should trigger
+ */
+ EXPECT_EQ(std::cv_status::no_timeout, wait(TIMEOUT_SEC));
+ EXPECT_EQ(std::cv_status::no_timeout, wait(TIMEOUT_SEC));
+ EXPECT_EQ(std::cv_status::no_timeout, wait(TIMEOUT_SEC));
+
+ EXPECT_EQ(capabilities_called_count_, 1);
+ EXPECT_EQ(info_called_count_, 1);
+ EXPECT_EQ(name_called_count_, 1);
+}
+
+void GnssHalTest::notify() {
+ std::unique_lock<std::mutex> lock(mtx_);
+ notify_count_++;
+ cv_.notify_one();
+}
+
+std::cv_status GnssHalTest::wait(int timeout_seconds) {
+ std::unique_lock<std::mutex> lock(mtx_);
+
+ auto status = std::cv_status::no_timeout;
+ while (notify_count_ == 0) {
+ status = cv_.wait_for(lock, std::chrono::seconds(timeout_seconds));
+ if (status == std::cv_status::timeout) return status;
+ }
+ notify_count_--;
+ return status;
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssSetSystemInfoCb(
+ const IGnssCallback::GnssSystemInfo& info) {
+ ALOGI("Info received, year %d", info.yearOfHw);
+ parent_.info_called_count_++;
+ parent_.last_info_ = info;
+ parent_.notify();
+ return Void();
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssSetCapabilitesCb(uint32_t capabilities) {
+ ALOGI("Capabilities received %d", capabilities);
+ parent_.capabilities_called_count_++;
+ parent_.last_capabilities_ = capabilities;
+ parent_.notify();
+ return Void();
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssNameCb(const android::hardware::hidl_string& name) {
+ ALOGI("Name received: %s", name.c_str());
+ parent_.name_called_count_++;
+ parent_.last_name_ = name;
+ parent_.notify();
+ return Void();
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssLocationCb(const GnssLocation& location) {
+ ALOGI("Location received");
+ parent_.location_called_count_++;
+ parent_.last_location_ = location;
+ parent_.notify();
+ return Void();
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssSvStatusCb(
+ const IGnssCallback::GnssSvStatus& svStatus) {
+ ALOGI("GnssSvStatus received");
+ parent_.list_gnss_sv_status_.emplace_back(svStatus);
+ return Void();
+}
diff --git a/gnss/2.0/vts/functional/gnss_hal_test.h b/gnss/2.0/vts/functional/gnss_hal_test.h
new file mode 100644
index 0000000..64f3575
--- /dev/null
+++ b/gnss/2.0/vts/functional/gnss_hal_test.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2018 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 GNSS_HAL_TEST_H_
+#define GNSS_HAL_TEST_H_
+
+#include <android/hardware/gnss/2.0/IGnss.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
+
+#include <condition_variable>
+#include <list>
+#include <mutex>
+
+using android::hardware::Return;
+using android::hardware::Void;
+
+using android::hardware::gnss::V1_0::GnssLocation;
+
+using android::hardware::gnss::V1_0::GnssLocationFlags;
+using android::hardware::gnss::V1_1::IGnssCallback;
+using android::hardware::gnss::V2_0::IGnss;
+
+using android::sp;
+
+#define TIMEOUT_SEC 2 // for basic commands/responses
+
+// Test environment for GNSS HIDL HAL.
+class GnssHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static GnssHidlEnvironment* Instance() {
+ static GnssHidlEnvironment* instance = new GnssHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IGnss>(); }
+
+ private:
+ GnssHidlEnvironment() {}
+};
+
+// The main test class for GNSS HAL.
+class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ GnssHalTest();
+
+ virtual void SetUp() override;
+
+ virtual void TearDown() override;
+
+ /* Used as a mechanism to inform the test that a callback has occurred */
+ void notify();
+
+ /* Test code calls this function to wait for a callback */
+ std::cv_status wait(int timeout_seconds);
+
+ /* Callback class for data & Event. */
+ class GnssCallback : public IGnssCallback {
+ public:
+ GnssHalTest& parent_;
+
+ GnssCallback(GnssHalTest& parent) : parent_(parent){};
+
+ virtual ~GnssCallback() = default;
+
+ // Dummy callback handlers
+ Return<void> gnssStatusCb(const IGnssCallback::GnssStatusValue /* status */) override {
+ return Void();
+ }
+ Return<void> gnssNmeaCb(int64_t /* timestamp */,
+ const android::hardware::hidl_string& /* nmea */) override {
+ return Void();
+ }
+ Return<void> gnssAcquireWakelockCb() override { return Void(); }
+ Return<void> gnssReleaseWakelockCb() override { return Void(); }
+ Return<void> gnssRequestLocationCb(bool /* independentFromGnss */) override {
+ return Void();
+ }
+ Return<void> gnssRequestTimeCb() override { return Void(); }
+ // Actual (test) callback handlers
+ Return<void> gnssNameCb(const android::hardware::hidl_string& name) override;
+ Return<void> gnssLocationCb(const GnssLocation& location) override;
+ Return<void> gnssSetCapabilitesCb(uint32_t capabilities) override;
+ Return<void> gnssSetSystemInfoCb(const IGnssCallback::GnssSystemInfo& info) override;
+ Return<void> gnssSvStatusCb(const IGnssCallback::GnssSvStatus& svStatus) override;
+ };
+
+ /*
+ * SetUpGnssCallback:
+ * Set GnssCallback and verify the result.
+ */
+ void SetUpGnssCallback();
+
+ sp<IGnss> gnss_hal_; // GNSS HAL to call into
+ sp<IGnssCallback> gnss_cb_; // Primary callback interface
+
+ /* Count of calls to set the following items, and the latest item (used by
+ * test.)
+ */
+ int info_called_count_;
+ IGnssCallback::GnssSystemInfo last_info_;
+ uint32_t last_capabilities_;
+ int capabilities_called_count_;
+ int location_called_count_;
+ GnssLocation last_location_;
+ list<IGnssCallback::GnssSvStatus> list_gnss_sv_status_;
+
+ int name_called_count_;
+ android::hardware::hidl_string last_name_;
+
+ private:
+ std::mutex mtx_;
+ std::condition_variable cv_;
+ int notify_count_;
+};
+
+#endif // GNSS_HAL_TEST_H_
diff --git a/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
new file mode 100644
index 0000000..12a15e8
--- /dev/null
+++ b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#define LOG_TAG "GnssHalTestCases"
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <gnss_hal_test.h>
+
+using android::hardware::hidl_vec;
+
+using IGnssMeasurement_2_0 = android::hardware::gnss::V2_0::IGnssMeasurement;
+using IGnssMeasurement_1_1 = android::hardware::gnss::V1_1::IGnssMeasurement;
+
+/*
+ * SetupTeardownCreateCleanup:
+ * Requests the gnss HAL then calls cleanup
+ *
+ * Empty test fixture to verify basic Setup & Teardown
+ */
+TEST_F(GnssHalTest, SetupTeardownCreateCleanup) {}
+
+/*
+ * TestGnssMeasurementCallback:
+ * Gets the GnssMeasurementExtension and verify that it returns an actual extension.
+ */
+TEST_F(GnssHalTest, TestGnssMeasurementCallback) {
+ auto gnssMeasurement_2_0 = gnss_hal_->getExtensionGnssMeasurement_2_0();
+ auto gnssMeasurement_1_1 = gnss_hal_->getExtensionGnssMeasurement_1_1();
+ ASSERT_TRUE(gnssMeasurement_2_0.isOk() || gnssMeasurement_1_1.isOk());
+ if (last_capabilities_ & IGnssCallback::Capabilities::MEASUREMENTS) {
+ sp<IGnssMeasurement_2_0> iGnssMeas_2_0 = gnssMeasurement_2_0;
+ sp<IGnssMeasurement_1_1> iGnssMeas_1_1 = gnssMeasurement_1_1;
+ // Exactly one interface is non-null.
+ ASSERT_TRUE((iGnssMeas_1_1 != nullptr) != (iGnssMeas_2_0 != nullptr));
+ }
+}
diff --git a/graphics/composer/2.1/vts/functional/Android.bp b/graphics/composer/2.1/vts/functional/Android.bp
index 8e346df..c98cc0d 100644
--- a/graphics/composer/2.1/vts/functional/Android.bp
+++ b/graphics/composer/2.1/vts/functional/Android.bp
@@ -34,4 +34,5 @@
header_libs: [
"android.hardware.graphics.composer@2.1-command-buffer",
],
+ test_suites: ["general-tests"],
}
diff --git a/graphics/composer/2.2/utils/hal/include/composer-hal/2.2/ComposerClient.h b/graphics/composer/2.2/utils/hal/include/composer-hal/2.2/ComposerClient.h
index a6871fb..c760d0a 100644
--- a/graphics/composer/2.2/utils/hal/include/composer-hal/2.2/ComposerClient.h
+++ b/graphics/composer/2.2/utils/hal/include/composer-hal/2.2/ComposerClient.h
@@ -132,24 +132,13 @@
Return<void> getRenderIntents(Display display, ColorMode mode,
IComposerClient::getRenderIntents_cb hidl_cb) override {
-#ifdef USES_DISPLAY_RENDER_INTENTS
std::vector<RenderIntent> intents;
Error err = mHal->getRenderIntents(display, mode, &intents);
hidl_cb(err, intents);
-#else
- (void)display;
- (void)mode;
- hidl_cb(Error::NONE, hidl_vec<RenderIntent>({RenderIntent::COLORIMETRIC}));
-#endif
return Void();
}
Return<Error> setColorMode_2_2(Display display, ColorMode mode, RenderIntent intent) override {
-#ifndef USES_DISPLAY_RENDER_INTENTS
- if (intent != RenderIntent::COLORIMETRIC) {
- return Error::BAD_PARAMETER;
- }
-#endif
return mHal->setColorMode_2_2(display, mode, intent);
}
diff --git a/graphics/composer/2.2/vts/functional/Android.bp b/graphics/composer/2.2/vts/functional/Android.bp
index acc9245..b62f302 100644
--- a/graphics/composer/2.2/vts/functional/Android.bp
+++ b/graphics/composer/2.2/vts/functional/Android.bp
@@ -44,4 +44,5 @@
"android.hardware.graphics.composer@2.1-command-buffer",
"android.hardware.graphics.composer@2.2-command-buffer",
],
+ test_suites: ["general-tests"],
}
diff --git a/graphics/mapper/2.0/vts/functional/Android.bp b/graphics/mapper/2.0/vts/functional/Android.bp
index 969317a..853c2a3 100644
--- a/graphics/mapper/2.0/vts/functional/Android.bp
+++ b/graphics/mapper/2.0/vts/functional/Android.bp
@@ -24,4 +24,5 @@
"android.hardware.graphics.mapper@2.0",
"android.hardware.graphics.mapper@2.0-vts",
],
+ test_suites: ["general-tests"],
}
diff --git a/graphics/mapper/2.1/vts/functional/Android.bp b/graphics/mapper/2.1/vts/functional/Android.bp
index ac67af8..afd8e7f 100644
--- a/graphics/mapper/2.1/vts/functional/Android.bp
+++ b/graphics/mapper/2.1/vts/functional/Android.bp
@@ -26,4 +26,5 @@
"android.hardware.graphics.mapper@2.0-vts",
"android.hardware.graphics.mapper@2.1-vts",
],
+ test_suites: ["general-tests"],
}
diff --git a/health/1.0/vts/functional/Android.bp b/health/1.0/vts/functional/Android.bp
index 8742651..c14dcee 100644
--- a/health/1.0/vts/functional/Android.bp
+++ b/health/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalHealthV1_0TargetTest.cpp"],
static_libs: ["android.hardware.health@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/health/2.0/vts/functional/Android.bp b/health/2.0/vts/functional/Android.bp
index 4ad01b9..3544e5f 100644
--- a/health/2.0/vts/functional/Android.bp
+++ b/health/2.0/vts/functional/Android.bp
@@ -22,4 +22,5 @@
"android.hardware.health@1.0",
"android.hardware.health@2.0",
],
+ test_suites: ["general-tests"],
}
diff --git a/health/storage/1.0/vts/functional/Android.bp b/health/storage/1.0/vts/functional/Android.bp
index 63591cf..250a7dc 100644
--- a/health/storage/1.0/vts/functional/Android.bp
+++ b/health/storage/1.0/vts/functional/Android.bp
@@ -22,5 +22,6 @@
shared_libs: [
"libhidltransport"
],
+ test_suites: ["general-tests"],
}
diff --git a/ir/1.0/vts/functional/Android.bp b/ir/1.0/vts/functional/Android.bp
index 2a86f8e..f5c9d61 100644
--- a/ir/1.0/vts/functional/Android.bp
+++ b/ir/1.0/vts/functional/Android.bp
@@ -21,4 +21,5 @@
static_libs: [
"android.hardware.ir@1.0",
],
+ test_suites: ["general-tests"],
}
diff --git a/keymaster/3.0/vts/functional/Android.bp b/keymaster/3.0/vts/functional/Android.bp
index 7d96704..b0371c7 100644
--- a/keymaster/3.0/vts/functional/Android.bp
+++ b/keymaster/3.0/vts/functional/Android.bp
@@ -29,4 +29,5 @@
"libcrypto",
"libsoftkeymasterdevice",
],
+ test_suites: ["general-tests"],
}
diff --git a/keymaster/3.0/vts/functional/authorization_set.h b/keymaster/3.0/vts/functional/authorization_set.h
index 60b00e4..0c15e68 100644
--- a/keymaster/3.0/vts/functional/authorization_set.h
+++ b/keymaster/3.0/vts/functional/authorization_set.h
@@ -261,6 +261,12 @@
return Authorization(ttag, reinterpret_cast<const uint8_t*>(data), data_length);
}
+ template <Tag tag>
+ AuthorizationSetBuilder& Authorization(TypedTag<TagType::BYTES, tag> ttag, char* data,
+ size_t data_length) {
+ return Authorization(ttag, reinterpret_cast<const uint8_t*>(data), data_length);
+ }
+
AuthorizationSetBuilder& Authorizations(AuthorizationSet&& set);
AuthorizationSetBuilder& Authorizations(const AuthorizationSet& set);
diff --git a/keymaster/4.0/support/include/keymasterV4_0/authorization_set.h b/keymaster/4.0/support/include/keymasterV4_0/authorization_set.h
index a131423..ff08066 100644
--- a/keymaster/4.0/support/include/keymasterV4_0/authorization_set.h
+++ b/keymaster/4.0/support/include/keymasterV4_0/authorization_set.h
@@ -251,6 +251,12 @@
return Authorization(ttag, reinterpret_cast<const uint8_t*>(data), data_length);
}
+ template <Tag tag>
+ AuthorizationSetBuilder& Authorization(TypedTag<TagType::BYTES, tag> ttag, char* data,
+ size_t data_length) {
+ return Authorization(ttag, reinterpret_cast<const uint8_t*>(data), data_length);
+ }
+
AuthorizationSetBuilder& Authorizations(const AuthorizationSet& set) {
for (const auto& entry : set) {
push_back(entry);
diff --git a/keymaster/4.0/vts/functional/Android.bp b/keymaster/4.0/vts/functional/Android.bp
index d74a16f..333e408 100644
--- a/keymaster/4.0/vts/functional/Android.bp
+++ b/keymaster/4.0/vts/functional/Android.bp
@@ -29,4 +29,5 @@
"libkeymaster4support",
"libsoftkeymasterdevice",
],
+ test_suites: ["general-tests"],
}
diff --git a/light/2.0/vts/functional/Android.bp b/light/2.0/vts/functional/Android.bp
index e0ec4cf..9f03d27 100644
--- a/light/2.0/vts/functional/Android.bp
+++ b/light/2.0/vts/functional/Android.bp
@@ -19,5 +19,6 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalLightV2_0TargetTest.cpp"],
static_libs: ["android.hardware.light@2.0"],
+ test_suites: ["general-tests"],
}
diff --git a/media/omx/1.0/vts/functional/audio/Android.bp b/media/omx/1.0/vts/functional/audio/Android.bp
index f517fa1..7418bb4 100644
--- a/media/omx/1.0/vts/functional/audio/Android.bp
+++ b/media/omx/1.0/vts/functional/audio/Android.bp
@@ -21,6 +21,7 @@
"VtsHalMediaOmxV1_0TargetAudioEncTest.cpp",
"media_audio_hidl_test_common.cpp"
],
+ test_suites: ["general-tests"],
}
cc_test {
@@ -30,6 +31,7 @@
"VtsHalMediaOmxV1_0TargetAudioDecTest.cpp",
"media_audio_hidl_test_common.cpp"
],
+ test_suites: ["general-tests"],
}
diff --git a/media/omx/1.0/vts/functional/component/Android.bp b/media/omx/1.0/vts/functional/component/Android.bp
index f76b6e9..970eabe 100644
--- a/media/omx/1.0/vts/functional/component/Android.bp
+++ b/media/omx/1.0/vts/functional/component/Android.bp
@@ -18,5 +18,6 @@
name: "VtsHalMediaOmxV1_0TargetComponentTest",
defaults: ["VtsHalMediaOmxV1_0Defaults"],
srcs: ["VtsHalMediaOmxV1_0TargetComponentTest.cpp"],
+ test_suites: ["general-tests"],
}
diff --git a/media/omx/1.0/vts/functional/master/Android.bp b/media/omx/1.0/vts/functional/master/Android.bp
index 4a45e69..cf3f15d 100644
--- a/media/omx/1.0/vts/functional/master/Android.bp
+++ b/media/omx/1.0/vts/functional/master/Android.bp
@@ -18,5 +18,6 @@
name: "VtsHalMediaOmxV1_0TargetMasterTest",
defaults: ["VtsHalMediaOmxV1_0Defaults"],
srcs: ["VtsHalMediaOmxV1_0TargetMasterTest.cpp"],
+ test_suites: ["general-tests"],
}
diff --git a/media/omx/1.0/vts/functional/video/Android.bp b/media/omx/1.0/vts/functional/video/Android.bp
index f0da2b3..c7e0424 100644
--- a/media/omx/1.0/vts/functional/video/Android.bp
+++ b/media/omx/1.0/vts/functional/video/Android.bp
@@ -21,6 +21,7 @@
"VtsHalMediaOmxV1_0TargetVideoDecTest.cpp",
"media_video_hidl_test_common.cpp"
],
+ test_suites: ["general-tests"],
}
cc_test {
@@ -33,4 +34,5 @@
static_libs: [
"libnativewindow",
],
+ test_suites: ["general-tests"],
}
diff --git a/memtrack/1.0/vts/functional/Android.bp b/memtrack/1.0/vts/functional/Android.bp
index 2d833e7..d682e0b 100644
--- a/memtrack/1.0/vts/functional/Android.bp
+++ b/memtrack/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalMemtrackV1_0TargetTest.cpp"],
static_libs: ["android.hardware.memtrack@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/neuralnetworks/1.0/vts/functional/Android.bp b/neuralnetworks/1.0/vts/functional/Android.bp
index 234527a..dd6f934 100644
--- a/neuralnetworks/1.0/vts/functional/Android.bp
+++ b/neuralnetworks/1.0/vts/functional/Android.bp
@@ -81,4 +81,5 @@
"BasicTests.cpp",
"GeneratedTests.cpp",
],
+ test_suites: ["general-tests"],
}
diff --git a/neuralnetworks/1.1/vts/functional/Android.bp b/neuralnetworks/1.1/vts/functional/Android.bp
index 07c9b6e..3f0c256 100644
--- a/neuralnetworks/1.1/vts/functional/Android.bp
+++ b/neuralnetworks/1.1/vts/functional/Android.bp
@@ -21,6 +21,7 @@
srcs: [
"GeneratedTestsV1_0.cpp",
],
+ test_suites: ["general-tests"],
}
// Tests for V1_1 models.
@@ -31,4 +32,5 @@
"BasicTests.cpp",
"GeneratedTests.cpp",
],
+ test_suites: ["general-tests"],
}
diff --git a/neuralnetworks/1.2/vts/functional/Android.bp b/neuralnetworks/1.2/vts/functional/Android.bp
index 085d5db..5b119ee 100644
--- a/neuralnetworks/1.2/vts/functional/Android.bp
+++ b/neuralnetworks/1.2/vts/functional/Android.bp
@@ -20,7 +20,8 @@
defaults: ["VtsHalNeuralNetworksTargetTestDefaults"],
srcs: [
"GeneratedTestsV1_0.cpp",
- ]
+ ],
+ test_suites: ["general-tests"],
}
// Tests for V1_1 models using the V1_2 HAL.
@@ -30,6 +31,7 @@
srcs: [
"GeneratedTestsV1_1.cpp",
],
+ test_suites: ["general-tests"],
}
// Tests for V1_2 models.
@@ -40,4 +42,5 @@
"BasicTests.cpp",
"GeneratedTests.cpp",
],
+ test_suites: ["general-tests"],
}
diff --git a/nfc/1.0/vts/functional/Android.bp b/nfc/1.0/vts/functional/Android.bp
index 3861bd4..c2e365e 100644
--- a/nfc/1.0/vts/functional/Android.bp
+++ b/nfc/1.0/vts/functional/Android.bp
@@ -21,4 +21,5 @@
static_libs: [
"android.hardware.nfc@1.0",
],
+ test_suites: ["general-tests"],
}
diff --git a/nfc/1.1/vts/functional/Android.bp b/nfc/1.1/vts/functional/Android.bp
index 0ce531f..6698c5a 100644
--- a/nfc/1.1/vts/functional/Android.bp
+++ b/nfc/1.1/vts/functional/Android.bp
@@ -22,4 +22,5 @@
"android.hardware.nfc@1.0",
"android.hardware.nfc@1.1",
],
+ test_suites: ["general-tests"],
}
diff --git a/oemlock/1.0/vts/functional/Android.bp b/oemlock/1.0/vts/functional/Android.bp
index 20737a1..28d6bf6 100644
--- a/oemlock/1.0/vts/functional/Android.bp
+++ b/oemlock/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalOemLockV1_0TargetTest.cpp"],
static_libs: ["android.hardware.oemlock@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/power/1.0/vts/functional/Android.bp b/power/1.0/vts/functional/Android.bp
index 45f74fc..a716f02 100644
--- a/power/1.0/vts/functional/Android.bp
+++ b/power/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalPowerV1_0TargetTest.cpp"],
static_libs: ["android.hardware.power@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/power/1.1/vts/functional/Android.bp b/power/1.1/vts/functional/Android.bp
index 604cd36..de75984 100644
--- a/power/1.1/vts/functional/Android.bp
+++ b/power/1.1/vts/functional/Android.bp
@@ -22,4 +22,5 @@
"android.hardware.power@1.0",
"android.hardware.power@1.1",
],
+ test_suites: ["general-tests"],
}
diff --git a/power/1.2/vts/functional/Android.bp b/power/1.2/vts/functional/Android.bp
index d615e85..f424bfa 100644
--- a/power/1.2/vts/functional/Android.bp
+++ b/power/1.2/vts/functional/Android.bp
@@ -23,4 +23,5 @@
"android.hardware.power@1.1",
"android.hardware.power@1.2",
],
+ test_suites: ["general-tests"],
}
diff --git a/power/1.3/vts/functional/Android.bp b/power/1.3/vts/functional/Android.bp
index 34cdb60..06f6e7a 100644
--- a/power/1.3/vts/functional/Android.bp
+++ b/power/1.3/vts/functional/Android.bp
@@ -24,4 +24,5 @@
"android.hardware.power@1.2",
"android.hardware.power@1.3",
],
+ test_suites: ["general-tests"],
}
diff --git a/power/stats/1.0/vts/functional/Android.bp b/power/stats/1.0/vts/functional/Android.bp
new file mode 100644
index 0000000..4f0b325
--- /dev/null
+++ b/power/stats/1.0/vts/functional/Android.bp
@@ -0,0 +1,38 @@
+//
+// Copyright (C) 2018 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_test {
+ name: "VtsHalPowerStatsV1_0TargetTest",
+ defaults: [
+ "VtsHalTargetTestDefaults"
+ ],
+ srcs: [
+ "VtsHalPowerStatsV1_0TargetTest.cpp"
+ ],
+ static_libs: [
+ "android.hardware.power.stats@1.0"
+ ],
+ shared_libs: [
+ "libbase",
+ "libcutils",
+ "liblog",
+ "libhidlbase",
+ "libfmq",
+ "libhidltransport",
+ "libhwbinder",
+ "libutils",
+ ],
+}
diff --git a/power/stats/1.0/vts/functional/VtsHalPowerStatsV1_0TargetTest.cpp b/power/stats/1.0/vts/functional/VtsHalPowerStatsV1_0TargetTest.cpp
new file mode 100644
index 0000000..1a1230b
--- /dev/null
+++ b/power/stats/1.0/vts/functional/VtsHalPowerStatsV1_0TargetTest.cpp
@@ -0,0 +1,306 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#define LOG_TAG "android.power.stats.vts"
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
+#include <android-base/logging.h>
+#include <android/hardware/power/stats/1.0/IPowerStats.h>
+#include <fmq/MessageQueue.h>
+#include <hidl/MQDescriptor.h>
+#include <inttypes.h>
+#include <algorithm>
+#include <random>
+#include <thread>
+
+namespace android {
+namespace power {
+namespace stats {
+namespace vts {
+namespace {
+
+using android::sp;
+using android::hardware::hidl_vec;
+using android::hardware::kSynchronizedReadWrite;
+using android::hardware::Return;
+using android::hardware::Void;
+using android::hardware::power::stats::V1_0::EnergyData;
+using android::hardware::power::stats::V1_0::IPowerStats;
+using android::hardware::power::stats::V1_0::RailInfo;
+using android::hardware::power::stats::V1_0::Status;
+
+} // namespace
+
+typedef hardware::MessageQueue<EnergyData, kSynchronizedReadWrite> MessageQueueSync;
+// Test environment for Power HIDL HAL.
+class PowerStatsHidlEnv : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static PowerStatsHidlEnv* Instance() {
+ static PowerStatsHidlEnv* instance = new PowerStatsHidlEnv;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IPowerStats>(); }
+};
+
+class PowerStatsHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ virtual void SetUp() override {
+ service_ = ::testing::VtsHalHidlTargetTestBase::getService<IPowerStats>(
+ PowerStatsHidlEnv::Instance()->getServiceName<IPowerStats>());
+ ASSERT_NE(service_, nullptr);
+ }
+
+ virtual void TearDown() override {}
+
+ sp<IPowerStats> service_;
+};
+
+TEST_F(PowerStatsHidlTest, ValidateRailInfo) {
+ hidl_vec<RailInfo> rails[2];
+ Status s;
+ auto cb = [&rails, &s](hidl_vec<RailInfo> rail_subsys, Status status) {
+ rails[0] = rail_subsys;
+ s = status;
+ };
+ Return<void> ret = service_->getRailInfo(cb);
+ EXPECT_TRUE(ret.isOk());
+ if (s == Status::SUCCESS) {
+ /* Rails size should be non-zero on SUCCESS*/
+ ASSERT_NE(rails[0].size(), 0);
+ /* check if indices returned are unique*/
+ set<uint32_t> ids;
+ for (auto rail : rails[0]) {
+ ASSERT_TRUE(ids.insert(rail.index).second);
+ }
+ auto cb = [&rails, &s](hidl_vec<RailInfo> rail_subsys, Status status) {
+ rails[1] = rail_subsys;
+ s = status;
+ };
+ Return<void> ret = service_->getRailInfo(cb);
+ EXPECT_TRUE(ret.isOk());
+ ASSERT_EQ(s, Status::SUCCESS);
+ ASSERT_EQ(rails[0].size(), rails[1].size());
+ /* check if data returned by two calls to getRailInfo is same*/
+ for (int i = 0; i < rails[0].size(); i++) {
+ ASSERT_NE(rails[0][i].railName, "");
+ ASSERT_NE(rails[0][i].subsysName, "");
+ int j = 0;
+ bool match = false;
+ for (j = 0; j < rails[1].size(); j++) {
+ if (rails[0][i].index == rails[1][j].index) {
+ ASSERT_EQ(rails[0][i].railName, rails[1][i].railName);
+ ASSERT_EQ(rails[0][i].subsysName, rails[1][i].subsysName);
+ match = true;
+ break;
+ }
+ }
+ ASSERT_TRUE(match);
+ }
+ } else if (s == Status::FILESYSTEM_ERROR) {
+ ALOGI("ValidateRailInfo returned FILESYSTEM_ERROR");
+ ASSERT_EQ(rails[0].size(), 0);
+ } else if (s == Status::NOT_SUPPORTED) {
+ ALOGI("ValidateRailInfo returned NOT_SUPPORTED");
+ ASSERT_EQ(rails[0].size(), 0);
+ } else if (s == Status::INVALID_INPUT) {
+ ALOGI("ValidateRailInfo returned INVALID_INPUT");
+ ASSERT_EQ(rails[0].size(), 0);
+ } else if (s == Status::INSUFFICIENT_RESOURCES) {
+ ALOGI("ValidateRailInfo returned INSUFFICIENT_RESOURCES");
+ ASSERT_EQ(rails[0].size(), 0);
+ }
+}
+
+TEST_F(PowerStatsHidlTest, ValidateAllPowerData) {
+ hidl_vec<EnergyData> measurements[2];
+ Status s;
+ auto cb = [&measurements, &s](hidl_vec<EnergyData> measure, Status status) {
+ measurements[0] = measure;
+ s = status;
+ };
+ Return<void> ret = service_->getEnergyData(hidl_vec<uint32_t>(), cb);
+ EXPECT_TRUE(ret.isOk());
+ if (s == Status::SUCCESS) {
+ /*measurements size should be non-zero on SUCCESS*/
+ ASSERT_NE(measurements[0].size(), 0);
+ auto cb = [&measurements, &s](hidl_vec<EnergyData> measure, Status status) {
+ measurements[1] = measure;
+ s = status;
+ };
+ Return<void> ret = service_->getEnergyData(hidl_vec<uint32_t>(), cb);
+ EXPECT_TRUE(ret.isOk());
+ ASSERT_EQ(s, Status::SUCCESS);
+ /*Both calls should returns same amount of data*/
+ ASSERT_EQ(measurements[0].size(), measurements[1].size());
+ /*Check is energy and timestamp are monotonically increasing*/
+ for (int i = 0; i < measurements[0].size(); i++) {
+ int j;
+ for (j = 0; j < measurements[1].size(); j++) {
+ if (measurements[0][i].index == measurements[1][j].index) {
+ EXPECT_GE(measurements[1][j].timestamp, measurements[0][i].timestamp);
+ EXPECT_GE(measurements[1][j].energy, measurements[0][i].energy);
+ break;
+ }
+ }
+ /*Check is indices for two call match*/
+ ASSERT_NE(j, measurements[1].size());
+ }
+ } else if (s == Status::FILESYSTEM_ERROR) {
+ ALOGI("ValidateAllPowerData returned FILESYSTEM_ERROR");
+ ASSERT_EQ(measurements[0].size(), 0);
+ } else if (s == Status::NOT_SUPPORTED) {
+ ALOGI("ValidateAllPowerData returned NOT_SUPPORTED");
+ ASSERT_EQ(measurements[0].size(), 0);
+ } else if (s == Status::INVALID_INPUT) {
+ ALOGI("ValidateAllPowerData returned INVALID_INPUT");
+ ASSERT_EQ(measurements[0].size(), 0);
+ } else if (s == Status::INSUFFICIENT_RESOURCES) {
+ ALOGI("ValidateAllPowerData returned INSUFFICIENT_RESOURCES");
+ ASSERT_EQ(measurements[0].size(), 0);
+ }
+}
+
+TEST_F(PowerStatsHidlTest, ValidateFilteredPowerData) {
+ hidl_vec<RailInfo> rails;
+ hidl_vec<EnergyData> measurements;
+ hidl_vec<uint32_t> indices;
+ std::string debugString;
+ Status s;
+ auto cb = [&rails, &s](hidl_vec<RailInfo> rail_subsys, Status status) {
+ rails = rail_subsys;
+ s = status;
+ };
+ Return<void> ret = service_->getRailInfo(cb);
+ EXPECT_TRUE(ret.isOk());
+ std::time_t seed = std::time(nullptr);
+ std::srand(seed);
+ if (s == Status::SUCCESS) {
+ size_t sz = std::max(1, (int)(std::rand() % rails.size()));
+ indices.resize(sz);
+ for (int i = 0; i < sz; i++) {
+ int j = std::rand() % rails.size();
+ indices[i] = rails[j].index;
+ debugString += std::to_string(indices[i]) + ", ";
+ }
+ debugString += "\n";
+ ALOGI("ValidateFilteredPowerData for indices: %s", debugString.c_str());
+ auto cb = [&measurements, &s](hidl_vec<EnergyData> measure, Status status) {
+ measurements = measure;
+ s = status;
+ };
+ Return<void> ret = service_->getEnergyData(indices, cb);
+ EXPECT_TRUE(ret.isOk());
+ if (s == Status::SUCCESS) {
+ /* Make sure that all the measurements are returned */
+ ASSERT_EQ(sz, measurements.size());
+ for (int i = 0; i < measurements.size(); i++) {
+ int j;
+ bool match = false;
+ /* Check that the measurement belongs to the requested index */
+ for (j = 0; j < indices.size(); j++) {
+ if (indices[j] == measurements[i].index) {
+ match = true;
+ break;
+ }
+ }
+ ASSERT_TRUE(match);
+ }
+ }
+ } else {
+ /* size should be zero is stats is NOT SUCCESS */
+ ASSERT_EQ(rails.size(), 0);
+ }
+}
+
+void readEnergy(sp<IPowerStats> service_, uint32_t timeMs) {
+ std::unique_ptr<MessageQueueSync> mQueue;
+ Status s;
+ uint32_t railsInSample;
+ uint32_t totalSamples;
+ auto cb = [&s, &mQueue, &totalSamples, &railsInSample](
+ const hardware::MQDescriptorSync<EnergyData>& in, uint32_t numSamples,
+ uint32_t railsPerSample, Status status) {
+ mQueue.reset(new (std::nothrow) MessageQueueSync(in));
+ s = status;
+ totalSamples = numSamples;
+ railsInSample = railsPerSample;
+ };
+ service_->streamEnergyData(timeMs, 10, cb);
+ if (s == Status::SUCCESS) {
+ ASSERT_NE(nullptr, mQueue);
+ ASSERT_TRUE(mQueue->isValid());
+ bool rc;
+ int sampleCount = 0;
+ uint32_t totalQuants = railsInSample * totalSamples;
+ uint64_t timeout_ns = 10000000000;
+ if (totalSamples > 0) {
+ uint32_t batch = std::max(1, (int)((std::rand() % totalSamples) * railsInSample));
+ ALOGI("Read energy, timsMs: %u, batch: %u", timeMs, batch);
+ std::vector<EnergyData> data(batch);
+ while (sampleCount < totalQuants) {
+ rc = mQueue->readBlocking(&data[0], batch, timeout_ns);
+ if (rc == false) {
+ break;
+ }
+ sampleCount = sampleCount + batch;
+ if (batch > totalQuants - sampleCount) {
+ batch = 1;
+ }
+ }
+ ASSERT_EQ(totalQuants, sampleCount);
+ }
+ } else if (s == Status::FILESYSTEM_ERROR) {
+ ASSERT_FALSE(mQueue->isValid());
+ ASSERT_EQ(totalSamples, 0);
+ ASSERT_EQ(railsInSample, 0);
+ } else if (s == Status::NOT_SUPPORTED) {
+ ASSERT_FALSE(mQueue->isValid());
+ ASSERT_EQ(totalSamples, 0);
+ ASSERT_EQ(railsInSample, 0);
+ } else if (s == Status::INVALID_INPUT) {
+ ASSERT_FALSE(mQueue->isValid());
+ ASSERT_EQ(totalSamples, 0);
+ ASSERT_EQ(railsInSample, 0);
+ } else if (s == Status::INSUFFICIENT_RESOURCES) {
+ ASSERT_FALSE(mQueue->isValid());
+ ASSERT_EQ(totalSamples, 0);
+ ASSERT_EQ(railsInSample, 0);
+ }
+}
+
+TEST_F(PowerStatsHidlTest, StreamEnergyData) {
+ std::time_t seed = std::time(nullptr);
+ std::srand(seed);
+ std::thread thread1 = std::thread(readEnergy, service_, std::rand() % 5000);
+ thread1.join();
+}
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(PowerStatsHidlEnv::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ PowerStatsHidlEnv::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ return status;
+}
+
+} // namespace vts
+} // namespace stats
+} // namespace power
+} // namespace android
diff --git a/radio/1.0/vts/functional/Android.bp b/radio/1.0/vts/functional/Android.bp
index afbb1c4..9dec2f2 100644
--- a/radio/1.0/vts/functional/Android.bp
+++ b/radio/1.0/vts/functional/Android.bp
@@ -33,6 +33,7 @@
static_libs: [
"android.hardware.radio@1.0",
],
+ test_suites: ["general-tests"],
}
cc_test {
@@ -46,6 +47,7 @@
static_libs: [
"android.hardware.radio@1.0",
],
+ test_suites: ["general-tests"],
}
cc_library_static {
diff --git a/radio/1.1/vts/functional/Android.bp b/radio/1.1/vts/functional/Android.bp
index e7195ee..5695c6b 100644
--- a/radio/1.1/vts/functional/Android.bp
+++ b/radio/1.1/vts/functional/Android.bp
@@ -30,4 +30,5 @@
header_libs: [
"radio.util.header@1.0",
],
+ test_suites: ["general-tests"],
}
diff --git a/radio/1.2/vts/functional/Android.bp b/radio/1.2/vts/functional/Android.bp
index a4e8c02..6782f14 100644
--- a/radio/1.2/vts/functional/Android.bp
+++ b/radio/1.2/vts/functional/Android.bp
@@ -31,4 +31,5 @@
"android.hardware.radio@1.0",
],
header_libs: ["radio.util.header@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/radio/1.3/Android.bp b/radio/1.3/Android.bp
index 7012f6b..30b8edf 100644
--- a/radio/1.3/Android.bp
+++ b/radio/1.3/Android.bp
@@ -7,7 +7,6 @@
enabled: true,
},
srcs: [
- "types.hal",
"IRadio.hal",
"IRadioIndication.hal",
"IRadioResponse.hal",
@@ -17,21 +16,6 @@
"android.hardware.radio@1.1",
"android.hardware.radio@1.2",
"android.hidl.base@1.0",
- "android.hidl.safe_union@1.0",
- ],
- types: [
- "AccessNetwork",
- "CellConfigLte",
- "CellInfo",
- "CellInfoLte",
- "CardStatus",
- "DataProfileInfo",
- "DataRegStateResult",
- "EmergencyNumber",
- "EmergencyNumberSource",
- "EmergencyServiceCategory",
- "LteVopsInfo",
- "NetworkScanResult",
],
gen_java: true,
}
diff --git a/radio/1.3/IRadio.hal b/radio/1.3/IRadio.hal
index dde9d71..d582c71 100644
--- a/radio/1.3/IRadio.hal
+++ b/radio/1.3/IRadio.hal
@@ -16,12 +16,7 @@
package android.hardware.radio@1.3;
-import @1.3::DataProfileInfo;
-import @1.0::Dial;
-import @1.2::DataRequestReason;
import @1.2::IRadio;
-import @1.3::AccessNetwork;
-import @1.3::EmergencyServiceCategory;
/**
* This interface is used by telephony and telecom to talk to cellular radio.
@@ -32,94 +27,4 @@
* setResponseFunctions must work with @1.1::IRadioResponse and @1.1::IRadioIndication.
*/
interface IRadio extends @1.2::IRadio {
- /**
- * Setup a packet data connection. If DataCallResponse.status returns DataCallFailCause:NONE,
- * the data connection must be added to data calls and a unsolDataCallListChanged() must be
- * sent. The call remains until removed by subsequent unsolDataCallIstChanged(). It may be
- * lost due to many factors, including deactivateDataCall() being issued, the radio powered
- * off, reception lost or even transient factors like congestion. This data call list is
- * returned by getDataCallList() and dataCallListChanged().
- *
- * The Radio is expected to:
- * - Create one data call context.
- * - Create and configure a dedicated interface for the context.
- * - The interface must be point to point.
- * - The interface is configured with one or more addresses and is capable of sending and
- * receiving packets. The prefix length of the addresses must be /32 for IPv4 and /128
- * for IPv6.
- * - Must not modify routing configuration related to this interface; routing management is
- * exclusively within the purview of the Android OS.
- * - Support simultaneous data call contexts up to DataRegStateResult.maxDataCalls specified
- * in the response of getDataRegistrationState.
- *
- * @param serial Serial number of request.
- * @param accessNetwork The access network to setup the data call. If the data connection cannot
- * be established on the specified access network, the setup request must be failed.
- * @param dataProfileInfo Data profile info.
- * @param roamingAllowed Indicates whether or not data roaming is allowed by the user.
- * @param reason The request reason. Must be DataRequestReason.NORMAL or
- * DataRequestReason.HANDOVER.
- * @param addresses If the reason is DataRequestReason.HANDOVER, this indicates the list of link
- * addresses of the existing data connection. The format is IP address with optional "/"
- * prefix length (The format is defined in RFC-4291 section 2.3). For example, "192.0.1.3",
- * "192.0.1.11/16", or "2001:db8::1/64". Typically one IPv4 or one IPv6 or one of each. If
- * the prefix length is absent, then the addresses are assumed to be point to point with
- * IPv4 with prefix length 32 or IPv6 with prefix length 128. This parameter must be ignored
- * unless reason is DataRequestReason.HANDOVER.
- * @param dnses If the reason is DataRequestReason.HANDOVER, this indicates the list of DNS
- * addresses of the existing data connection. The format is defined in RFC-4291 section
- * 2.2. For example, "192.0.1.3" or "2001:db8::1". This parameter must be ignored unless
- * reason is DataRequestReason.HANDOVER.
- *
- * Response function is IRadioResponse.setupDataCallResponse()
- *
- * Note this API is same as 1.2 version except using the 1.3 AccessNetwork as the input param.
- */
- oneway setupDataCall_1_3(int32_t serial, AccessNetwork accessNetwork,
- DataProfileInfo dataProfileInfo, bool roamingAllowed,
- DataRequestReason reason, vec<string> addresses, vec<string> dnses);
-
- /**
- * Set an apn to initial attach network
- *
- * @param serial Serial number of request.
- * @param dataProfileInfo data profile containing APN settings
- *
- * Response callback is IRadioResponse.setInitialAttachApnResponse()
- */
- oneway setInitialAttachApn_1_3(int32_t serial, DataProfileInfo dataProfileInfo);
-
- /**
- * Send data profiles of the current carrier to the modem.
- *
- * @param serial Serial number of request.
- * @param profiles Array of DataProfile to set.
- *
- * Response callback is IRadioResponse.setDataProfileResponse()
- */
- oneway setDataProfile_1_3(int32_t serial, vec<DataProfileInfo> profiles);
-
- /**
- * Initiate emergency voice call, with zero or more emergency service category(s).
- *
- * Note this API is the same as IRadio.dial except using the
- * @1.3::EmergencyServiceCategory as the input param.
- *
- * If the dialed emergency number does not have a specified emergency service category, the
- * 'categories' field is set to @1.3::EmergencyServiceCategory#UNSPECIFIED; iff either the
- * 'categories' field is set to @1.3::EmergencyServiceCategory#UNSPECIFIED or the underlying
- * technology used to request emergency services does not support the emergency service
- * category, the interpretation of the categories is defined by implementation.
- *
- * Reference: 3gpp TS 22.101, Section 10 - Emergency Calls
- *
- * @param serial Serial number of request.
- * @param dialInfo the same @1.0::Dial information used by @1.0::IRadio.dial.
- * @param categories bitfield<@1.3::EmergencyServiceCategory> the Emergency Service Category(s)
- * of the call.
- *
- * Response function is IRadioResponse.emergencyDialResponse()
- */
- oneway emergencyDial(int32_t serial, Dial dialInfo,
- bitfield<EmergencyServiceCategory> categories);
};
diff --git a/radio/1.3/IRadioIndication.hal b/radio/1.3/IRadioIndication.hal
index e7f26ac..b65d3f2 100644
--- a/radio/1.3/IRadioIndication.hal
+++ b/radio/1.3/IRadioIndication.hal
@@ -16,50 +16,10 @@
package android.hardware.radio@1.3;
-import @1.0::RadioIndicationType;
import @1.2::IRadioIndication;
/**
* Interface declaring unsolicited radio indications.
*/
interface IRadioIndication extends @1.2::IRadioIndication {
- /**
- * Report the current list of emergency numbers
- *
- * Each emergency number (@1.3::EmergencyNumber) in the emergency number list contains a
- * dialing number, zero or more service category(s), mobile country code, and source(s) that
- * indicate where it comes from.
- *
- * Radio must report all the valid emergency numbers with known mobile country code and
- * emergency service categories from all available sources including network signaling, sim,
- * modem/oem configuration, and default configuration (112 and 911 must be always available;
- * additionally, 000, 08, 110, 999, 118 and 119 must be available when sim is not present).
- * Radio shall not report emergency numbers that are invalid in the current locale. The
- * reported emergency number list must not have duplicate @1.3::EmergencyNumber entries. Please
- * refer the documentation of @1.3::EmergencyNumber to construct each emergency number to
- * report.
- *
- * Radio must report the complete list of emergency numbers whenever the emergency numbers in
- * the list are changed or whenever the client and the radio server are connected.
- *
- * Reference: 3gpp 22.101, Section 10 - Emergency Calls
- *
- * @param type Type of radio indication
- * @param emergencyNumberList Current list of emergency numbers known to radio.
- */
- oneway currentEmergencyNumberList(RadioIndicationType type,
- vec<EmergencyNumber> emergencyNumberList);
-
- /**
- * Request all of the current cell information known to the radio.
- *
- * @param type Type of radio indication
- * @param records Current cell information
- */
- oneway cellInfoList_1_3(RadioIndicationType type, vec<CellInfo> records);
-
- /**
- * Incremental network scan results
- */
- oneway networkScanResult_1_3(RadioIndicationType type, NetworkScanResult result);
};
diff --git a/radio/1.3/IRadioResponse.hal b/radio/1.3/IRadioResponse.hal
index fecd951..2bcdd02 100644
--- a/radio/1.3/IRadioResponse.hal
+++ b/radio/1.3/IRadioResponse.hal
@@ -16,75 +16,10 @@
package android.hardware.radio@1.3;
-import @1.0::RadioResponseInfo;
import @1.2::IRadioResponse;
/**
* Interface declaring response functions to solicited radio requests.
*/
interface IRadioResponse extends @1.2::IRadioResponse {
- /**
- * @param info Response info struct containing response type, serial no. and error
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:RADIO_NOT_AVAILABLE (radio resetting)
- * RadioError:DIAL_MODIFIED_TO_USSD
- * RadioError:DIAL_MODIFIED_TO_SS
- * RadioError:DIAL_MODIFIED_TO_DIAL
- * RadioError:INVALID_ARGUMENTS
- * RadioError:NO_MEMORY
- * RadioError:NO_RESOURCES
- * RadioError:INTERNAL_ERR
- * RadioError:FDN_CHECK_FAILURE
- * RadioError:MODEM_ERR
- * RadioError:NO_SUBSCRIPTION
- * RadioError:NO_NETWORK_FOUND
- * RadioError:INVALID_CALL_ID
- * RadioError:DEVICE_IN_USE
- * RadioError:ABORTED
- * RadioError:INVALID_MODEM_STATE
- * RadioError:CANCELLED
- */
- oneway emergencyDialResponse(RadioResponseInfo info);
-
- /**
- * @param info Response info struct containing response type, serial no. and error
- * @param cellInfo List of current cell information known to radio
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:INTERNAL_ERR
- */
- oneway getCellInfoListResponse_1_3(RadioResponseInfo info, vec<CellInfo> cellInfo);
-
- /**
- * @param info Response info struct containing response type, serial no. and error
- * @param dataRegResponse Current Data registration response as defined by DataRegStateResult in
- * types.hal
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:INTERNAL_ERR
- * RadioError:NOT_PROVISIONED
- */
- oneway getDataRegistrationStateResponse_1_3(RadioResponseInfo info,
- DataRegStateResult dataRegResponse);
-
- /**
- * @param info Response info struct containing response type, serial no. and error
- * @param cardStatus ICC card status as defined by CardStatus in types.hal
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:INTERNAL_ERR
- * RadioError:NO_MEMORY
- * RadioError:NO_RESOURCES
- * RadioError:CANCELLED
- * RadioError:REQUEST_NOT_SUPPORTED
- */
- oneway getIccCardStatusResponse_1_3(RadioResponseInfo info, CardStatus cardStatus);
};
diff --git a/radio/1.4/Android.bp b/radio/1.4/Android.bp
new file mode 100644
index 0000000..02c6cad
--- /dev/null
+++ b/radio/1.4/Android.bp
@@ -0,0 +1,43 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.radio@1.4",
+ root: "android.hardware",
+ vndk: {
+ enabled: true,
+ },
+ srcs: [
+ "types.hal",
+ "IRadio.hal",
+ "IRadioIndication.hal",
+ "IRadioResponse.hal",
+ ],
+ interfaces: [
+ "android.hardware.radio@1.0",
+ "android.hardware.radio@1.1",
+ "android.hardware.radio@1.2",
+ "android.hardware.radio@1.3",
+ "android.hidl.base@1.0",
+ "android.hidl.safe_union@1.0",
+ ],
+ types: [
+ "AccessNetwork",
+ "CellConfigLte",
+ "CellInfo",
+ "CellInfoLte",
+ "CardStatus",
+ "DataProfileInfo",
+ "DataRegStateResult",
+ "EmergencyNumber",
+ "EmergencyNumberSource",
+ "EmergencyServiceCategory",
+ "FrequencyRange",
+ "RadioFrequencyInfo",
+ "RadioTechnology",
+ "PhysicalChannelConfig",
+ "LteVopsInfo",
+ "NetworkScanResult",
+ ],
+ gen_java: true,
+}
+
diff --git a/radio/1.4/IRadio.hal b/radio/1.4/IRadio.hal
new file mode 100644
index 0000000..1b6d9a6
--- /dev/null
+++ b/radio/1.4/IRadio.hal
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio@1.4;
+
+import @1.4::DataProfileInfo;
+import @1.0::Dial;
+import @1.2::DataRequestReason;
+import @1.3::IRadio;
+import @1.4::AccessNetwork;
+import @1.4::EmergencyServiceCategory;
+
+/**
+ * This interface is used by telephony and telecom to talk to cellular radio.
+ * All the functions have minimum one parameter:
+ * serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the
+ * duration of a method call. If clients provide colliding serials (including passing the same
+ * serial to different methods), multiple responses (one for each method call) must still be served.
+ * setResponseFunctions must work with @1.1::IRadioResponse and @1.1::IRadioIndication.
+ */
+interface IRadio extends @1.3::IRadio {
+ /**
+ * Setup a packet data connection. If DataCallResponse.status returns DataCallFailCause:NONE,
+ * the data connection must be added to data calls and a unsolDataCallListChanged() must be
+ * sent. The call remains until removed by subsequent unsolDataCallIstChanged(). It may be
+ * lost due to many factors, including deactivateDataCall() being issued, the radio powered
+ * off, reception lost or even transient factors like congestion. This data call list is
+ * returned by getDataCallList() and dataCallListChanged().
+ *
+ * The Radio is expected to:
+ * - Create one data call context.
+ * - Create and configure a dedicated interface for the context.
+ * - The interface must be point to point.
+ * - The interface is configured with one or more addresses and is capable of sending and
+ * receiving packets. The prefix length of the addresses must be /32 for IPv4 and /128
+ * for IPv6.
+ * - Must not modify routing configuration related to this interface; routing management is
+ * exclusively within the purview of the Android OS.
+ * - Support simultaneous data call contexts up to DataRegStateResult.maxDataCalls specified
+ * in the response of getDataRegistrationState.
+ *
+ * @param serial Serial number of request.
+ * @param accessNetwork The access network to setup the data call. If the data connection cannot
+ * be established on the specified access network, the setup request must be failed.
+ * @param dataProfileInfo Data profile info.
+ * @param roamingAllowed Indicates whether or not data roaming is allowed by the user.
+ * @param reason The request reason. Must be DataRequestReason.NORMAL or
+ * DataRequestReason.HANDOVER.
+ * @param addresses If the reason is DataRequestReason.HANDOVER, this indicates the list of link
+ * addresses of the existing data connection. The format is IP address with optional "/"
+ * prefix length (The format is defined in RFC-4291 section 2.3). For example, "192.0.1.3",
+ * "192.0.1.11/16", or "2001:db8::1/64". Typically one IPv4 or one IPv6 or one of each. If
+ * the prefix length is absent, then the addresses are assumed to be point to point with
+ * IPv4 with prefix length 32 or IPv6 with prefix length 128. This parameter must be ignored
+ * unless reason is DataRequestReason.HANDOVER.
+ * @param dnses If the reason is DataRequestReason.HANDOVER, this indicates the list of DNS
+ * addresses of the existing data connection. The format is defined in RFC-4291 section
+ * 2.2. For example, "192.0.1.3" or "2001:db8::1". This parameter must be ignored unless
+ * reason is DataRequestReason.HANDOVER.
+ *
+ * Response function is IRadioResponse.setupDataCallResponse()
+ *
+ * Note this API is same as 1.2 version except using the 1.4 AccessNetwork as the input param.
+ */
+ oneway setupDataCall_1_4(int32_t serial, AccessNetwork accessNetwork,
+ DataProfileInfo dataProfileInfo, bool roamingAllowed,
+ DataRequestReason reason, vec<string> addresses, vec<string> dnses);
+
+ /**
+ * Set an apn to initial attach network
+ *
+ * @param serial Serial number of request.
+ * @param dataProfileInfo data profile containing APN settings
+ *
+ * Response callback is IRadioResponse.setInitialAttachApnResponse()
+ */
+ oneway setInitialAttachApn_1_4(int32_t serial, DataProfileInfo dataProfileInfo);
+
+ /**
+ * Send data profiles of the current carrier to the modem.
+ *
+ * @param serial Serial number of request.
+ * @param profiles Array of DataProfile to set.
+ *
+ * Response callback is IRadioResponse.setDataProfileResponse()
+ */
+ oneway setDataProfile_1_4(int32_t serial, vec<DataProfileInfo> profiles);
+
+ /**
+ * Initiate emergency voice call, with zero or more emergency service category(s).
+ *
+ * Note this API is the same as IRadio.dial except using the
+ * @1.4::EmergencyServiceCategory as the input param.
+ *
+ * If the dialed emergency number does not have a specified emergency service category, the
+ * 'categories' field is set to @1.4::EmergencyServiceCategory#UNSPECIFIED; iff either the
+ * 'categories' field is set to @1.4::EmergencyServiceCategory#UNSPECIFIED or the underlying
+ * technology used to request emergency services does not support the emergency service
+ * category, the interpretation of the categories is defined by implementation.
+ *
+ * Reference: 3gpp TS 22.101, Section 10 - Emergency Calls
+ *
+ * @param serial Serial number of request.
+ * @param dialInfo the same @1.0::Dial information used by @1.0::IRadio.dial.
+ * @param categories bitfield<@1.4::EmergencyServiceCategory> the Emergency Service Category(s)
+ * of the call.
+ *
+ * Response function is IRadioResponse.emergencyDialResponse()
+ */
+ oneway emergencyDial(int32_t serial, Dial dialInfo,
+ bitfield<EmergencyServiceCategory> categories);
+};
diff --git a/radio/1.4/IRadioIndication.hal b/radio/1.4/IRadioIndication.hal
new file mode 100644
index 0000000..fac77f7
--- /dev/null
+++ b/radio/1.4/IRadioIndication.hal
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio@1.4;
+
+import @1.0::RadioIndicationType;
+import @1.3::IRadioIndication;
+
+/**
+ * Interface declaring unsolicited radio indications.
+ */
+interface IRadioIndication extends @1.3::IRadioIndication {
+ /**
+ * Report the current list of emergency numbers
+ *
+ * Each emergency number (@1.4::EmergencyNumber) in the emergency number list contains a
+ * dialing number, zero or more service category(s), mobile country code, and source(s) that
+ * indicate where it comes from.
+ *
+ * Radio must report all the valid emergency numbers with known mobile country code and
+ * emergency service categories from all available sources including network signaling, sim,
+ * modem/oem configuration, and default configuration (112 and 911 must be always available;
+ * additionally, 000, 08, 110, 999, 118 and 119 must be available when sim is not present).
+ * Radio shall not report emergency numbers that are invalid in the current locale. The
+ * reported emergency number list must not have duplicate @1.4::EmergencyNumber entries. Please
+ * refer the documentation of @1.4::EmergencyNumber to construct each emergency number to
+ * report.
+ *
+ * Radio must report the complete list of emergency numbers whenever the emergency numbers in
+ * the list are changed or whenever the client and the radio server are connected.
+ *
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls
+ *
+ * @param type Type of radio indication
+ * @param emergencyNumberList Current list of emergency numbers known to radio.
+ */
+ oneway currentEmergencyNumberList(RadioIndicationType type,
+ vec<EmergencyNumber> emergencyNumberList);
+
+ /**
+ * Request all of the current cell information known to the radio.
+ *
+ * @param type Type of radio indication
+ * @param records Current cell information
+ */
+ oneway cellInfoList_1_4(RadioIndicationType type, vec<CellInfo> records);
+
+ /**
+ * Incremental network scan results
+ */
+ oneway networkScanResult_1_4(RadioIndicationType type, NetworkScanResult result);
+
+ /**
+ * Indicates physical channel configurations.
+ *
+ * An empty configs list indicates that the radio is in idle mode.
+ *
+ * @param type Type of radio indication
+ * @param configs Vector of PhysicalChannelConfigs
+ */
+ oneway currentPhysicalChannelConfigs_1_4(RadioIndicationType type,
+ vec<PhysicalChannelConfig> configs);
+};
\ No newline at end of file
diff --git a/radio/1.4/IRadioResponse.hal b/radio/1.4/IRadioResponse.hal
new file mode 100644
index 0000000..d971850
--- /dev/null
+++ b/radio/1.4/IRadioResponse.hal
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio@1.4;
+
+import @1.0::RadioResponseInfo;
+import @1.3::IRadioResponse;
+
+/**
+ * Interface declaring response functions to solicited radio requests.
+ */
+interface IRadioResponse extends @1.3::IRadioResponse {
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE (radio resetting)
+ * RadioError:DIAL_MODIFIED_TO_USSD
+ * RadioError:DIAL_MODIFIED_TO_SS
+ * RadioError:DIAL_MODIFIED_TO_DIAL
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:INTERNAL_ERR
+ * RadioError:FDN_CHECK_FAILURE
+ * RadioError:MODEM_ERR
+ * RadioError:NO_SUBSCRIPTION
+ * RadioError:NO_NETWORK_FOUND
+ * RadioError:INVALID_CALL_ID
+ * RadioError:DEVICE_IN_USE
+ * RadioError:ABORTED
+ * RadioError:INVALID_MODEM_STATE
+ * RadioError:CANCELLED
+ */
+ oneway emergencyDialResponse(RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ * @param cellInfo List of current cell information known to radio
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ */
+ oneway getCellInfoListResponse_1_4(RadioResponseInfo info, vec<CellInfo> cellInfo);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ * @param dataRegResponse Current Data registration response as defined by DataRegStateResult in
+ * types.hal
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NOT_PROVISIONED
+ */
+ oneway getDataRegistrationStateResponse_1_4(RadioResponseInfo info,
+ DataRegStateResult dataRegResponse);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ * @param cardStatus ICC card status as defined by CardStatus in types.hal
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
+ */
+ oneway getIccCardStatusResponse_1_4(RadioResponseInfo info, CardStatus cardStatus);
+};
\ No newline at end of file
diff --git a/radio/1.3/types.hal b/radio/1.4/types.hal
similarity index 82%
rename from radio/1.3/types.hal
rename to radio/1.4/types.hal
index d3a6f78..ea3c53f 100644
--- a/radio/1.3/types.hal
+++ b/radio/1.4/types.hal
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.hardware.radio@1.3;
+package android.hardware.radio@1.4;
import @1.0::ApnAuthType;
import @1.0::ApnTypes;
@@ -23,6 +23,7 @@
import @1.0::DataProfileInfoType;
import @1.0::RadioAccessFamily;
import @1.0::RadioError;
+import @1.0::RadioTechnology;
import @1.0::RegState;
import @1.0::TimeStampType;
import @1.1::ScanStatus;
@@ -36,6 +37,7 @@
import @1.2::CardStatus;
import @1.2::CellIdentity;
import @1.2::DataRegStateResult;
+import @1.2::PhysicalChannelConfig;
import android.hidl.safe_union@1.0::Monostate;
@@ -54,7 +56,7 @@
* provided; otherwise the field ‘mcc’ must be an empty string.
*
* A unique EmergencyNumber has a unique combination of ‘number’, ‘mcc’ and 'categories' fields.
- * Multiple @1.3::EmergencyNumberSource should be merged into the bitfield for the same
+ * Multiple @1.4::EmergencyNumberSource should be merged into the bitfield for the same
* EmergencyNumber.
*
* Reference: 3GPP TS 22.101 version 9.1.0 Release 9
@@ -70,12 +72,12 @@
*/
string mcc;
/**
- * The bitfield of @1.3::EmergencyServiceCategory(s). See @1.3::EmergencyServiceCategory for
+ * The bitfield of @1.4::EmergencyServiceCategory(s). See @1.4::EmergencyServiceCategory for
* the value of each bit.
*/
bitfield<EmergencyServiceCategory> categories;
/**
- * The bitfield of @1.3::EmergencyNumberSource(s). See @1.3::EmergencyNumberSource for the
+ * The bitfield of @1.4::EmergencyNumberSource(s). See @1.4::EmergencyNumberSource for the
* value of each bit.
*/
bitfield<EmergencyNumberSource> sources;
@@ -118,7 +120,7 @@
};
/**
- * The source to tell where the corresponding @1.3::EmergencyNumber comes from.
+ * The source to tell where the corresponding @1.4::EmergencyNumber comes from.
*
* Reference: 3gpp 22.101, Section 10 - Emergency Calls
*/
@@ -143,6 +145,65 @@
DEFAULT = 1 << 3,
};
+enum RadioTechnology : @1.0::RadioTechnology {
+ /** 5G NR. */
+ NR = 20,
+};
+
+/** Mapping the frequency to a rough range. */
+enum FrequencyRange : int32_t {
+ /** Indicates the frequency range is below 1GHz. */
+ LOW = 1,
+
+ /** Indicates the frequency range is between 1GHz and 3GHz. */
+ MID = 2,
+
+ /** Indicates the frequency range is between 3GHz and 6GHz. */
+ HIGH = 3,
+
+ /** Indicates the frequency range is above 6GHz (millimeter wave frequency). */
+ MMWAVE = 4,
+};
+
+safe_union RadioFrequencyInfo {
+ /** A rough frequency range. */
+ FrequencyRange range;
+
+ /** The Absolute Radio Frequency Channel Number. */
+ int32_t channelNumber;
+};
+
+struct PhysicalChannelConfig {
+ @1.2::PhysicalChannelConfig base;
+
+ /** The radio technology for this physical channel. */
+ RadioTechnology rat;
+
+ /** The radio frequency info. */
+ RadioFrequencyInfo rfInfo;
+
+ /**
+ * A list of data calls mapped to this physical channel. The context id must match the cid of
+ * @1.0::SetupDataCallResult. An empty list means the physical channel has no data call mapped
+ * to it.
+ */
+ vec<int32_t> contextIds;
+
+ /**
+ * The physical cell identifier for this cell.
+ *
+ * In UTRAN, this value is primary scrambling code. The range is [0, 511].
+ * Reference: 3GPP TS 25.213 section 5.2.2.
+ *
+ * In EUTRAN, this value is physical layer cell identity. The range is [0, 503].
+ * Reference: 3GPP TS 36.211 section 6.11.
+ *
+ * In 5G RAN, this value is physical layer cell identity. The range is [0, 1008].
+ * Reference: 3GPP TS 38.211 section 7.4.2.1.
+ */
+ uint32_t physicalCellId;
+};
+
/**
* Type to define the LTE specific network capabilities for voice over PS including
* emergency and normal voice calls.
@@ -214,7 +275,7 @@
CellConfigLte cellConfig;
};
-/** Overwritten from @1.2::CellInfo in order to update the CellInfoLte to 1.3 version. */
+/** Overwritten from @1.2::CellInfo in order to update the CellInfoLte to 1.4 version. */
struct CellInfo {
/** Cell type for selecting from union CellInfo. */
CellInfoType cellInfoType;
@@ -235,7 +296,7 @@
} info;
};
-/** Overwritten from @1.2::NetworkScanResult in order to update the CellInfo to 1.3 version. */
+/** Overwritten from @1.2::NetworkScanResult in order to update the CellInfo to 1.4 version. */
struct NetworkScanResult {
/**
* The status of the scan.
diff --git a/radio/config/1.0/vts/functional/Android.bp b/radio/config/1.0/vts/functional/Android.bp
index aa8266e..9c96030 100644
--- a/radio/config/1.0/vts/functional/Android.bp
+++ b/radio/config/1.0/vts/functional/Android.bp
@@ -29,4 +29,5 @@
"android.hardware.radio.config@1.0",
],
header_libs: ["radio.util.header@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/radio/config/1.1/Android.bp b/radio/config/1.1/Android.bp
index 8dc0f27..f228704 100644
--- a/radio/config/1.1/Android.bp
+++ b/radio/config/1.1/Android.bp
@@ -7,7 +7,6 @@
enabled: true,
},
srcs: [
- "types.hal",
"IRadioConfigIndication.hal",
"IRadioConfigResponse.hal",
],
@@ -16,8 +15,5 @@
"android.hardware.radio.config@1.0",
"android.hidl.base@1.0",
],
- types: [
- "SimSlotStatus",
- ],
gen_java: true,
}
diff --git a/radio/config/1.1/IRadioConfigIndication.hal b/radio/config/1.1/IRadioConfigIndication.hal
index 53eaa4d..f919201 100644
--- a/radio/config/1.1/IRadioConfigIndication.hal
+++ b/radio/config/1.1/IRadioConfigIndication.hal
@@ -17,23 +17,9 @@
package android.hardware.radio.config@1.1;
import @1.0::IRadioConfigIndication;
-import android.hardware.radio@1.0::RadioIndicationType;
/**
* Interface declaring unsolicited radio config indications.
*/
interface IRadioConfigIndication extends @1.0::IRadioConfigIndication {
-
- /**
- * Indicates SIM slot status change.
- *
- * This indication must be sent by the modem whenever there is any slot status change, even the
- * slot is inactive. For example, this indication must be triggered if a SIM card is inserted
- * into an inactive slot.
- *
- * @param type Type of radio indication
- * @param slotStatus new slot status info with size equals to the number of physical slots on
- * the device
- */
- oneway simSlotsStatusChanged_1_1(RadioIndicationType type, vec<SimSlotStatus> slotStatus);
};
diff --git a/radio/config/1.1/IRadioConfigResponse.hal b/radio/config/1.1/IRadioConfigResponse.hal
index 6f543ab..5d75600 100644
--- a/radio/config/1.1/IRadioConfigResponse.hal
+++ b/radio/config/1.1/IRadioConfigResponse.hal
@@ -16,26 +16,10 @@
package android.hardware.radio.config@1.1;
-import android.hardware.radio@1.0::RadioResponseInfo;
import @1.0::IRadioConfigResponse;
-import @1.1::SimSlotStatus;
/**
* Interface declaring response functions to solicited radio config requests.
*/
interface IRadioConfigResponse extends @1.0::IRadioConfigResponse {
-
- /**
- * @param info Response info struct containing response type, serial no. and error
- * @param slotStatus Sim slot struct containing all the physical SIM slots info with size
- * equal to the number of physical slots on the device
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:NO_MEMORY
- * RadioError:INTERNAL_ERR
- * RadioError:MODEM_ERR
- */
- oneway getSimSlotsStatusResponse_1_1(RadioResponseInfo info, vec<SimSlotStatus> slotStatus);
};
diff --git a/radio/config/1.2/Android.bp b/radio/config/1.2/Android.bp
new file mode 100644
index 0000000..c1eeb35
--- /dev/null
+++ b/radio/config/1.2/Android.bp
@@ -0,0 +1,24 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.radio.config@1.2",
+ root: "android.hardware",
+ vndk: {
+ enabled: true,
+ },
+ srcs: [
+ "types.hal",
+ "IRadioConfigIndication.hal",
+ "IRadioConfigResponse.hal",
+ ],
+ interfaces: [
+ "android.hardware.radio@1.0",
+ "android.hardware.radio.config@1.0",
+ "android.hardware.radio.config@1.1",
+ "android.hidl.base@1.0",
+ ],
+ types: [
+ "SimSlotStatus",
+ ],
+ gen_java: true,
+}
diff --git a/radio/config/1.2/IRadioConfigIndication.hal b/radio/config/1.2/IRadioConfigIndication.hal
new file mode 100644
index 0000000..a3ae558
--- /dev/null
+++ b/radio/config/1.2/IRadioConfigIndication.hal
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.config@1.2;
+
+import android.hardware.radio@1.0::RadioIndicationType;
+import @1.1::IRadioConfigIndication;
+
+/**
+ * Interface declaring unsolicited radio config indications.
+ */
+interface IRadioConfigIndication extends @1.1::IRadioConfigIndication {
+
+ /**
+ * Indicates SIM slot status change.
+ *
+ * This indication must be sent by the modem whenever there is any slot status change, even the
+ * slot is inactive. For example, this indication must be triggered if a SIM card is inserted
+ * into an inactive slot.
+ *
+ * @param type Type of radio indication
+ * @param slotStatus new slot status info with size equals to the number of physical slots on
+ * the device
+ */
+ oneway simSlotsStatusChanged_1_2(RadioIndicationType type, vec<SimSlotStatus> slotStatus);
+};
\ No newline at end of file
diff --git a/radio/config/1.2/IRadioConfigResponse.hal b/radio/config/1.2/IRadioConfigResponse.hal
new file mode 100644
index 0000000..dbc3bc5
--- /dev/null
+++ b/radio/config/1.2/IRadioConfigResponse.hal
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.config@1.2;
+
+import android.hardware.radio@1.0::RadioResponseInfo;
+import @1.1::IRadioConfigResponse;
+import @1.2::SimSlotStatus;
+
+/**
+ * Interface declaring response functions to solicited radio config requests.
+ */
+interface IRadioConfigResponse extends @1.1::IRadioConfigResponse {
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ * @param slotStatus Sim slot struct containing all the physical SIM slots info with size
+ * equal to the number of physical slots on the device
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:NO_MEMORY
+ * RadioError:INTERNAL_ERR
+ * RadioError:MODEM_ERR
+ */
+ oneway getSimSlotsStatusResponse_1_2(RadioResponseInfo info, vec<SimSlotStatus> slotStatus);
+};
\ No newline at end of file
diff --git a/radio/config/1.1/types.hal b/radio/config/1.2/types.hal
similarity index 95%
rename from radio/config/1.1/types.hal
rename to radio/config/1.2/types.hal
index 0c9d11e..5b809a7 100644
--- a/radio/config/1.1/types.hal
+++ b/radio/config/1.2/types.hal
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.hardware.radio.config@1.1;
+package android.hardware.radio.config@1.2;
import android.hardware.radio@1.0::CardState;
import @1.0::SimSlotStatus;
@@ -29,4 +29,4 @@
* supports eUICC.
*/
string eid;
-};
+};
\ No newline at end of file
diff --git a/renderscript/1.0/vts/functional/Android.bp b/renderscript/1.0/vts/functional/Android.bp
index bf011e6..87e62f1 100644
--- a/renderscript/1.0/vts/functional/Android.bp
+++ b/renderscript/1.0/vts/functional/Android.bp
@@ -28,4 +28,5 @@
"android.hardware.renderscript@1.0",
"libnativewindow",
],
+ test_suites: ["general-tests"],
}
diff --git a/secure_element/1.0/vts/functional/Android.bp b/secure_element/1.0/vts/functional/Android.bp
index 752df9e..2b2b73e 100644
--- a/secure_element/1.0/vts/functional/Android.bp
+++ b/secure_element/1.0/vts/functional/Android.bp
@@ -21,4 +21,5 @@
static_libs: [
"android.hardware.secure_element@1.0",
],
+ test_suites: ["general-tests"],
}
diff --git a/sensors/1.0/vts/functional/Android.bp b/sensors/1.0/vts/functional/Android.bp
index 6563e3c..d4c5f32 100644
--- a/sensors/1.0/vts/functional/Android.bp
+++ b/sensors/1.0/vts/functional/Android.bp
@@ -27,5 +27,6 @@
"android.hardware.sensors@1.0",
"VtsHalSensorsTargetTestUtils",
],
+ test_suites: ["general-tests"],
}
diff --git a/soundtrigger/2.0/vts/functional/Android.bp b/soundtrigger/2.0/vts/functional/Android.bp
index be6b3a8..f6207c4 100644
--- a/soundtrigger/2.0/vts/functional/Android.bp
+++ b/soundtrigger/2.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalSoundtriggerV2_0TargetTest.cpp"],
static_libs: ["android.hardware.soundtrigger@2.0"],
+ test_suites: ["general-tests"],
}
diff --git a/soundtrigger/2.1/vts/functional/Android.bp b/soundtrigger/2.1/vts/functional/Android.bp
index 925a17c..f1eb35d 100644
--- a/soundtrigger/2.1/vts/functional/Android.bp
+++ b/soundtrigger/2.1/vts/functional/Android.bp
@@ -25,4 +25,5 @@
"android.hardware.soundtrigger@2.1",
"libhidlmemory"
],
+ test_suites: ["general-tests"],
}
diff --git a/tests/msgq/1.0/default/Android.bp b/tests/msgq/1.0/default/Android.bp
index 6bbca24..6c8be6c 100644
--- a/tests/msgq/1.0/default/Android.bp
+++ b/tests/msgq/1.0/default/Android.bp
@@ -54,6 +54,7 @@
"libutils",
"android.hardware.tests.msgq@1.0"
],
+ test_suites: ["general-tests"],
}
cc_test {
@@ -80,4 +81,5 @@
// libs should be used on device.
static_libs: ["android.hardware.tests.msgq@1.0"],
whole_static_libs: ["android.hardware.tests.msgq@1.0-impl"],
+ test_suites: ["general-tests"],
}
diff --git a/tetheroffload/config/1.0/vts/functional/Android.bp b/tetheroffload/config/1.0/vts/functional/Android.bp
index dc95eaa..52b9810 100644
--- a/tetheroffload/config/1.0/vts/functional/Android.bp
+++ b/tetheroffload/config/1.0/vts/functional/Android.bp
@@ -17,4 +17,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalTetheroffloadConfigV1_0TargetTest.cpp"],
static_libs: ["android.hardware.tetheroffload.config@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/tetheroffload/control/1.0/vts/functional/Android.bp b/tetheroffload/control/1.0/vts/functional/Android.bp
index c6216a2..e8e1414 100644
--- a/tetheroffload/control/1.0/vts/functional/Android.bp
+++ b/tetheroffload/control/1.0/vts/functional/Android.bp
@@ -20,4 +20,5 @@
"android.hardware.tetheroffload.config@1.0",
"android.hardware.tetheroffload.control@1.0",
],
+ test_suites: ["general-tests"],
}
diff --git a/thermal/1.0/vts/functional/Android.bp b/thermal/1.0/vts/functional/Android.bp
index f661f1e..6bda558 100644
--- a/thermal/1.0/vts/functional/Android.bp
+++ b/thermal/1.0/vts/functional/Android.bp
@@ -19,5 +19,6 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalThermalV1_0TargetTest.cpp"],
static_libs: ["android.hardware.thermal@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/thermal/1.1/vts/functional/Android.bp b/thermal/1.1/vts/functional/Android.bp
index f5f01fa..9a16c30 100644
--- a/thermal/1.1/vts/functional/Android.bp
+++ b/thermal/1.1/vts/functional/Android.bp
@@ -22,5 +22,6 @@
"android.hardware.thermal@1.0",
"android.hardware.thermal@1.1",
],
+ test_suites: ["general-tests"],
}
diff --git a/tv/input/1.0/vts/functional/Android.bp b/tv/input/1.0/vts/functional/Android.bp
index 978830c..29181b0 100644
--- a/tv/input/1.0/vts/functional/Android.bp
+++ b/tv/input/1.0/vts/functional/Android.bp
@@ -19,5 +19,6 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalTvInputV1_0TargetTest.cpp"],
static_libs: ["android.hardware.tv.input@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/usb/1.0/vts/functional/Android.bp b/usb/1.0/vts/functional/Android.bp
index 96d3c0e..683ee17 100644
--- a/usb/1.0/vts/functional/Android.bp
+++ b/usb/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalUsbV1_0TargetTest.cpp"],
static_libs: ["android.hardware.usb@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/usb/1.1/vts/functional/Android.bp b/usb/1.1/vts/functional/Android.bp
index 4bb3203..1f0972f 100644
--- a/usb/1.1/vts/functional/Android.bp
+++ b/usb/1.1/vts/functional/Android.bp
@@ -22,5 +22,6 @@
"android.hardware.usb@1.0",
"android.hardware.usb@1.1",
],
+ test_suites: ["general-tests"],
}
diff --git a/vibrator/1.0/vts/functional/Android.bp b/vibrator/1.0/vts/functional/Android.bp
index 016d627..391d3d4 100644
--- a/vibrator/1.0/vts/functional/Android.bp
+++ b/vibrator/1.0/vts/functional/Android.bp
@@ -19,5 +19,6 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalVibratorV1_0TargetTest.cpp"],
static_libs: ["android.hardware.vibrator@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/vibrator/1.1/vts/functional/Android.bp b/vibrator/1.1/vts/functional/Android.bp
index 4f6454b..c65ff41 100644
--- a/vibrator/1.1/vts/functional/Android.bp
+++ b/vibrator/1.1/vts/functional/Android.bp
@@ -22,5 +22,6 @@
"android.hardware.vibrator@1.0",
"android.hardware.vibrator@1.1",
],
+ test_suites: ["general-tests"],
}
diff --git a/vibrator/1.2/vts/functional/Android.bp b/vibrator/1.2/vts/functional/Android.bp
index 3a4e2ef..1e3ec97 100644
--- a/vibrator/1.2/vts/functional/Android.bp
+++ b/vibrator/1.2/vts/functional/Android.bp
@@ -23,5 +23,6 @@
"android.hardware.vibrator@1.1",
"android.hardware.vibrator@1.2",
],
+ test_suites: ["general-tests"],
}
diff --git a/vr/1.0/vts/functional/Android.bp b/vr/1.0/vts/functional/Android.bp
index 4029137..958cce7 100644
--- a/vr/1.0/vts/functional/Android.bp
+++ b/vr/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalVrV1_0TargetTest.cpp"],
static_libs: ["android.hardware.vr@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/weaver/1.0/vts/functional/Android.bp b/weaver/1.0/vts/functional/Android.bp
index 0089d89..9fdbb18 100644
--- a/weaver/1.0/vts/functional/Android.bp
+++ b/weaver/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalWeaverV1_0TargetTest.cpp"],
static_libs: ["android.hardware.weaver@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/wifi/1.0/vts/functional/Android.bp b/wifi/1.0/vts/functional/Android.bp
index d0dd915..3189db4 100644
--- a/wifi/1.0/vts/functional/Android.bp
+++ b/wifi/1.0/vts/functional/Android.bp
@@ -48,6 +48,7 @@
"android.hardware.wifi@1.2",
"android.hardware.wifi@1.3",
],
+ test_suites: ["general-tests"],
}
cc_test {
@@ -61,4 +62,5 @@
"VtsHalWifiV1_0TargetTestUtil",
"android.hardware.wifi@1.0",
],
+ test_suites: ["general-tests"],
}
diff --git a/wifi/1.1/vts/functional/Android.bp b/wifi/1.1/vts/functional/Android.bp
index 1b0c12d..78d7a85 100644
--- a/wifi/1.1/vts/functional/Android.bp
+++ b/wifi/1.1/vts/functional/Android.bp
@@ -25,4 +25,5 @@
"android.hardware.wifi@1.0",
"android.hardware.wifi@1.1",
],
+ test_suites: ["general-tests"],
}
diff --git a/wifi/1.2/vts/functional/Android.bp b/wifi/1.2/vts/functional/Android.bp
index c5a6e84..a969f65 100644
--- a/wifi/1.2/vts/functional/Android.bp
+++ b/wifi/1.2/vts/functional/Android.bp
@@ -28,6 +28,7 @@
"android.hardware.wifi@1.1",
"android.hardware.wifi@1.2",
],
+ test_suites: ["general-tests"],
}
cc_test {
@@ -43,4 +44,5 @@
"android.hardware.wifi@1.1",
"android.hardware.wifi@1.2",
],
+ test_suites: ["general-tests"],
}
diff --git a/wifi/hostapd/1.0/vts/functional/Android.bp b/wifi/hostapd/1.0/vts/functional/Android.bp
index 7a920b4..79c5183 100644
--- a/wifi/hostapd/1.0/vts/functional/Android.bp
+++ b/wifi/hostapd/1.0/vts/functional/Android.bp
@@ -49,4 +49,5 @@
"libwifi-system",
"libwifi-system-iface",
],
+ test_suites: ["general-tests"],
}
diff --git a/wifi/offload/1.0/vts/functional/Android.bp b/wifi/offload/1.0/vts/functional/Android.bp
index 140e45e..de15aa7 100644
--- a/wifi/offload/1.0/vts/functional/Android.bp
+++ b/wifi/offload/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalWifiOffloadV1_0TargetTest.cpp"],
static_libs: ["android.hardware.wifi.offload@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/wifi/supplicant/1.0/vts/functional/Android.bp b/wifi/supplicant/1.0/vts/functional/Android.bp
index ee6a68e..bdccac1 100644
--- a/wifi/supplicant/1.0/vts/functional/Android.bp
+++ b/wifi/supplicant/1.0/vts/functional/Android.bp
@@ -39,7 +39,6 @@
srcs: [
"VtsHalWifiSupplicantV1_0TargetTest.cpp",
"supplicant_hidl_test.cpp",
- "supplicant_p2p_iface_hidl_test.cpp",
"supplicant_sta_iface_hidl_test.cpp",
"supplicant_sta_network_hidl_test.cpp",
],
@@ -54,4 +53,25 @@
"libwifi-system",
"libwifi-system-iface",
],
+ test_suites: ["general-tests"],
+}
+
+cc_test {
+ name: "VtsHalWifiSupplicantP2pV1_0TargetTest",
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: [
+ "VtsHalWifiSupplicantV1_0TargetTest.cpp",
+ "supplicant_p2p_iface_hidl_test.cpp",
+ ],
+ static_libs: [
+ "VtsHalWifiV1_0TargetTestUtil",
+ "VtsHalWifiSupplicantV1_0TargetTestUtil",
+ "android.hardware.wifi.supplicant@1.0",
+ "android.hardware.wifi.supplicant@1.1",
+ "android.hardware.wifi@1.0",
+ "libcrypto",
+ "libgmock",
+ "libwifi-system",
+ "libwifi-system-iface",
+ ],
}
diff --git a/wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp b/wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp
index adf2a85..6ca0546 100644
--- a/wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp
+++ b/wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp
@@ -44,7 +44,10 @@
::testing::AddGlobalTestEnvironment(gEnv);
::testing::InitGoogleTest(&argc, argv);
gEnv->init(&argc, argv);
- int status = RUN_ALL_TESTS();
- LOG(INFO) << "Test result = " << status;
+ int status = gEnv->initFromOptions(argc, argv);
+ if (status == 0) {
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ }
return status;
}
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp
index c6ac03c..436b88b 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp
@@ -30,6 +30,8 @@
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
using ::android::hardware::wifi::supplicant::V1_0::IfaceType;
+extern WifiSupplicantHidlEnvironment* gEnv;
+
class SupplicantHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
@@ -72,10 +74,13 @@
std::find_if(ifaces.begin(), ifaces.end(), [](const auto& iface) {
return iface.type == IfaceType::STA;
}));
- EXPECT_NE(ifaces.end(),
- std::find_if(ifaces.begin(), ifaces.end(), [](const auto& iface) {
- return iface.type == IfaceType::P2P;
- }));
+ if (gEnv->isP2pOn) {
+ EXPECT_NE(
+ ifaces.end(),
+ std::find_if(ifaces.begin(), ifaces.end(), [](const auto& iface) {
+ return iface.type == IfaceType::P2P;
+ }));
+ }
}
/*
@@ -178,8 +183,10 @@
IfaceType::STA, [](const SupplicantStatus& status) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
});
- supplicant_->setConcurrencyPriority(
- IfaceType::P2P, [](const SupplicantStatus& status) {
- EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
- });
+ if (gEnv->isP2pOn) {
+ supplicant_->setConcurrencyPriority(
+ IfaceType::P2P, [](const SupplicantStatus& status) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+ }
}
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
index bdedfba..47c3056 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
@@ -225,7 +225,9 @@
// For 1.1 supplicant, we need to add interfaces at initialization.
if (is_1_1(supplicant)) {
addSupplicantStaIface_1_1(supplicant);
- addSupplicantP2pIface_1_1(supplicant);
+ if (gEnv->isP2pOn) {
+ addSupplicantP2pIface_1_1(supplicant);
+ }
}
return supplicant;
}
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.h b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.h
index d4a768f..21a1ae6 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.h
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.h
@@ -23,6 +23,8 @@
#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetwork.h>
#include <android/hardware/wifi/supplicant/1.1/ISupplicant.h>
+#include <getopt.h>
+
#include <VtsHalHidlTargetTestEnvBase.h>
// Used to stop the android wifi framework before every test.
@@ -50,11 +52,48 @@
class WifiSupplicantHidlEnvironment
: public ::testing::VtsHalHidlTargetTestEnvBase {
- public:
+ protected:
virtual void HidlSetUp() override { stopSupplicant(); }
virtual void HidlTearDown() override {
startSupplicantAndWaitForHidlService();
}
+
+ public:
+ // Whether P2P feature is supported on the device.
+ bool isP2pOn = true;
+
+ void usage(char* me, char* arg) {
+ fprintf(stderr,
+ "unrecognized option: %s\n\n"
+ "usage: %s <gtest options> <test options>\n\n"
+ "test options are:\n\n"
+ "-P, --p2p_on: Whether P2P feature is supported\n",
+ arg, me);
+ }
+
+ int initFromOptions(int argc, char** argv) {
+ static struct option options[] = {{"p2p_off", no_argument, 0, 'P'},
+ {0, 0, 0, 0}};
+
+ int c;
+ while ((c = getopt_long(argc, argv, "P", options, NULL)) >= 0) {
+ switch (c) {
+ case 'P':
+ isP2pOn = false;
+ break;
+ default:
+ usage(argv[0], argv[optind]);
+ return 2;
+ }
+ }
+
+ if (optind < argc) {
+ usage(argv[0], argv[optind]);
+ return 2;
+ }
+
+ return 0;
+ }
};
#endif /* SUPPLICANT_HIDL_TEST_UTILS_H */
diff --git a/wifi/supplicant/1.1/vts/functional/Android.bp b/wifi/supplicant/1.1/vts/functional/Android.bp
index 3e65453..353ae4b 100644
--- a/wifi/supplicant/1.1/vts/functional/Android.bp
+++ b/wifi/supplicant/1.1/vts/functional/Android.bp
@@ -56,4 +56,5 @@
"libwifi-system",
"libwifi-system-iface",
],
+ test_suites: ["general-tests"],
}
diff --git a/wifi/supplicant/1.1/vts/functional/VtsHalWifiSupplicantV1_1TargetTest.cpp b/wifi/supplicant/1.1/vts/functional/VtsHalWifiSupplicantV1_1TargetTest.cpp
index 3d24fc3..9063a3b 100644
--- a/wifi/supplicant/1.1/vts/functional/VtsHalWifiSupplicantV1_1TargetTest.cpp
+++ b/wifi/supplicant/1.1/vts/functional/VtsHalWifiSupplicantV1_1TargetTest.cpp
@@ -30,8 +30,11 @@
return instance;
}
virtual void registerTestServices() override {
+ registerTestService<::android::hardware::wifi::V1_0::IWifi>();
registerTestService<::android::hardware::wifi::V1_1::IWifi>();
registerTestService<
+ ::android::hardware::wifi::supplicant::V1_0::ISupplicant>();
+ registerTestService<
::android::hardware::wifi::supplicant::V1_1::ISupplicant>();
}
@@ -46,7 +49,10 @@
::testing::AddGlobalTestEnvironment(gEnv);
::testing::InitGoogleTest(&argc, argv);
gEnv->init(&argc, argv);
- int status = RUN_ALL_TESTS();
- LOG(INFO) << "Test result = " << status;
+ int status = gEnv->initFromOptions(argc, argv);
+ if (status == 0) {
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ }
return status;
}
diff --git a/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test.cpp b/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test.cpp
index 7e773d6..28f980c 100644
--- a/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test.cpp
+++ b/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test.cpp
@@ -33,6 +33,8 @@
using ::android::hardware::wifi::supplicant::V1_1::ISupplicant;
using ::android::sp;
+extern WifiSupplicantHidlEnvironment* gEnv;
+
class SupplicantHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
@@ -81,6 +83,7 @@
* AddP2pInterface
*/
TEST_F(SupplicantHidlTest, AddP2pInterface) {
+ if (!gEnv->isP2pOn) return;
ISupplicant::IfaceInfo iface_info;
iface_info.name = getP2pIfaceName();
iface_info.type = IfaceType::P2P;
@@ -120,6 +123,7 @@
* RemoveP2pInterface
*/
TEST_F(SupplicantHidlTest, RemoveP2pInterface) {
+ if (!gEnv->isP2pOn) return;
ISupplicant::IfaceInfo iface_info;
iface_info.name = getP2pIfaceName();
iface_info.type = IfaceType::P2P;