Merge "Add subscription manager."
diff --git a/automotive/vehicle/OWNERS b/automotive/vehicle/OWNERS
new file mode 100644
index 0000000..429ec39
--- /dev/null
+++ b/automotive/vehicle/OWNERS
@@ -0,0 +1,3 @@
+ericjeong@google.com
+keunyoung@google.com
+shanyu@google.com
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index dd45b0d..8c44010 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -969,7 +969,6 @@
void getPrivacyTestPatternModes(
const camera_metadata_t* staticMetadata,
std::unordered_set<int32_t>* privacyTestPatternModes/*out*/);
- static bool isColorCamera(const camera_metadata_t *metadata);
static V3_2::DataspaceFlags getDataspace(PixelFormat format);
@@ -6880,142 +6879,6 @@
}
}
-// Test the multi-camera API requirement for Google Requirement Freeze S
-// Note that this requirement can only be partially tested. If a vendor
-// device doesn't expose a physical camera in any shape or form, there is no way
-// the test can catch it.
-TEST_P(CameraHidlTest, grfSMultiCameraTest) {
- const int socGrfApi = property_get_int32("ro.board.first_api_level", /*default*/ -1);
- if (socGrfApi < 31 /*S*/) {
- // Non-GRF devices, or version < 31 Skip
- ALOGI("%s: socGrfApi level is %d. Skipping", __FUNCTION__, socGrfApi);
- return;
- }
-
- // Test that if more than one rear-facing color camera is
- // supported, there must be at least one rear-facing logical camera.
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
- // Back facing non-logical color cameras
- std::set<std::string> rearColorCameras;
- // Back facing logical cameras' physical camera Id sets
- std::set<std::set<std::string>> rearPhysicalIds;
- for (const auto& name : cameraDeviceNames) {
- std::string cameraId;
- int deviceVersion = getCameraDeviceVersionAndId(name, mProviderType, &cameraId);
- switch (deviceVersion) {
- case CAMERA_DEVICE_API_VERSION_3_8:
- case CAMERA_DEVICE_API_VERSION_3_7:
- case CAMERA_DEVICE_API_VERSION_3_6:
- case CAMERA_DEVICE_API_VERSION_3_5:
- case CAMERA_DEVICE_API_VERSION_3_4:
- case CAMERA_DEVICE_API_VERSION_3_3:
- case CAMERA_DEVICE_API_VERSION_3_2: {
- ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_x;
- ALOGI("getCameraCharacteristics: Testing camera device %s", name.c_str());
- Return<void> ret;
- ret = mProvider->getCameraDeviceInterface_V3_x(
- name, [&](auto status, const auto& device) {
- ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device, nullptr);
- device3_x = device;
- });
- ASSERT_TRUE(ret.isOk());
-
- ret = device3_x->getCameraCharacteristics([&](auto status, const auto& chars) {
- ASSERT_EQ(Status::OK, status);
- const camera_metadata_t* metadata = (camera_metadata_t*)chars.data();
-
- // Skip if this is not a color camera.
- if (!CameraHidlTest::isColorCamera(metadata)) {
- return;
- }
-
- // Check camera facing. Skip if facing is not BACK.
- // If this is not a logical camera, only note down
- // the camera ID, and skip.
- camera_metadata_ro_entry entry;
- int retcode = find_camera_metadata_ro_entry(
- metadata, ANDROID_LENS_FACING, &entry);
- ASSERT_EQ(retcode, 0);
- ASSERT_GT(entry.count, 0);
- uint8_t facing = entry.data.u8[0];
- bool isLogicalCamera = (isLogicalMultiCamera(metadata) == Status::OK);
- if (facing != ANDROID_LENS_FACING_BACK) {
- // Not BACK facing. Skip.
- return;
- }
- if (!isLogicalCamera) {
- rearColorCameras.insert(cameraId);
- return;
- }
-
- // Check logical camera's physical camera IDs for color
- // cameras.
- std::unordered_set<std::string> physicalCameraIds;
- Status s = getPhysicalCameraIds(metadata, &physicalCameraIds);
- ASSERT_EQ(Status::OK, s);
- rearPhysicalIds.emplace(physicalCameraIds.begin(), physicalCameraIds.end());
- for (const auto& physicalId : physicalCameraIds) {
- // Skip if the physicalId is publicly available
- for (auto& deviceName : cameraDeviceNames) {
- std::string publicVersion, publicId;
- ASSERT_TRUE(::matchDeviceName(deviceName, mProviderType,
- &publicVersion, &publicId));
- if (physicalId == publicId) {
- // Skip because public Ids will be iterated in outer loop.
- return;
- }
- }
-
- auto castResult = device::V3_5::ICameraDevice::castFrom(device3_x);
- ASSERT_TRUE(castResult.isOk());
- ::android::sp<::android::hardware::camera::device::V3_5::ICameraDevice>
- device3_5 = castResult;
- ASSERT_NE(device3_5, nullptr);
-
- // Check camera characteristics for hidden camera id
- Return<void> ret = device3_5->getPhysicalCameraCharacteristics(
- physicalId, [&](auto status, const auto& chars) {
- ASSERT_EQ(Status::OK, status);
- const camera_metadata_t* physicalMetadata =
- (camera_metadata_t*)chars.data();
-
- if (CameraHidlTest::isColorCamera(physicalMetadata)) {
- rearColorCameras.insert(physicalId);
- }
- });
- ASSERT_TRUE(ret.isOk());
- }
- });
- ASSERT_TRUE(ret.isOk());
- } break;
- case CAMERA_DEVICE_API_VERSION_1_0: {
- // Not applicable
- } break;
- default: {
- ALOGE("%s: Unsupported device version %d", __func__, deviceVersion);
- ADD_FAILURE();
- } break;
- }
- }
-
- // If there are more than one rear-facing color camera, a logical
- // multi-camera must be defined consisting of all rear-facing color
- // cameras.
- if (rearColorCameras.size() > 1) {
- bool hasRearLogical = false;
- for (const auto& physicalIds : rearPhysicalIds) {
- if (std::includes(physicalIds.begin(), physicalIds.end(),
- rearColorCameras.begin(), rearColorCameras.end())) {
- hasRearLogical = true;
- break;
- }
- }
- ASSERT_TRUE(hasRearLogical);
- }
-}
-
// Retrieve all valid output stream resolutions from the camera
// static characteristics.
Status CameraHidlTest::getAvailableOutputStreams(const camera_metadata_t* staticMeta,
@@ -7523,23 +7386,6 @@
return ret;
}
-bool CameraHidlTest::isColorCamera(const camera_metadata_t *metadata) {
- camera_metadata_ro_entry entry;
- int retcode = find_camera_metadata_ro_entry(
- metadata, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, &entry);
- if ((0 == retcode) && (entry.count > 0)) {
- bool isBackwardCompatible = (std::find(entry.data.u8, entry.data.u8 + entry.count,
- ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE) !=
- entry.data.u8 + entry.count);
- bool isMonochrome = (std::find(entry.data.u8, entry.data.u8 + entry.count,
- ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME) !=
- entry.data.u8 + entry.count);
- bool isColor = isBackwardCompatible && !isMonochrome;
- return isColor;
- }
- return false;
-}
-
// Retrieve the reprocess input-output format map from the static
// camera characteristics.
Status CameraHidlTest::getZSLInputOutputMap(camera_metadata_t *staticMeta,
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl
new file mode 100644
index 0000000..73df195
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.gnss;
+@VintfStability
+interface IAGnssRil {
+ void setCallback(in android.hardware.gnss.IAGnssRilCallback callback);
+ void setRefLocation(in android.hardware.gnss.IAGnssRil.AGnssRefLocation agnssReflocation);
+ void setSetId(in android.hardware.gnss.IAGnssRil.SetIDType type, in @utf8InCpp String setid);
+ void updateNetworkState(in android.hardware.gnss.IAGnssRil.NetworkAttributes attributes);
+ const int NETWORK_CAPABILITY_NOT_METERED = 1;
+ const int NETWORK_CAPABILITY_NOT_ROAMING = 2;
+ @Backing(type="int") @VintfStability
+ enum AGnssRefLocationType {
+ GSM_CELLID = 1,
+ UMTS_CELLID = 2,
+ LTE_CELLID = 4,
+ NR_CELLID = 8,
+ }
+ @Backing(type="int") @VintfStability
+ enum SetIDType {
+ NONE = 0,
+ IMSI = 1,
+ MSISDM = 2,
+ }
+ @VintfStability
+ parcelable AGnssRefLocationCellID {
+ android.hardware.gnss.IAGnssRil.AGnssRefLocationType type;
+ int mcc;
+ int mnc;
+ int lac;
+ long cid;
+ int tac;
+ int pcid;
+ int arfcn;
+ }
+ @VintfStability
+ parcelable AGnssRefLocation {
+ android.hardware.gnss.IAGnssRil.AGnssRefLocationType type;
+ android.hardware.gnss.IAGnssRil.AGnssRefLocationCellID cellID;
+ }
+ @VintfStability
+ parcelable NetworkAttributes {
+ long networkHandle;
+ boolean isConnected;
+ int capabilities;
+ @utf8InCpp String apn;
+ }
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRilCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRilCallback.aidl
new file mode 100644
index 0000000..152b10a
--- /dev/null
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRilCallback.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.gnss;
+@VintfStability
+interface IAGnssRilCallback {
+ void requestSetIdCb(in int setIdflag);
+ void requestRefLocCb();
+}
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl
index fb13e02..a16d27b 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl
@@ -44,6 +44,7 @@
@nullable android.hardware.gnss.IGnssGeofence getExtensionGnssGeofence();
@nullable android.hardware.gnss.IGnssNavigationMessageInterface getExtensionGnssNavigationMessage();
android.hardware.gnss.IAGnss getExtensionAGnss();
+ android.hardware.gnss.IAGnssRil getExtensionAGnssRil();
android.hardware.gnss.IGnssDebug getExtensionGnssDebug();
android.hardware.gnss.visibility_control.IGnssVisibilityControl getExtensionGnssVisibilityControl();
void start();
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssBatching.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssBatching.aidl
index 492edc3..e1beed3 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssBatching.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssBatching.aidl
@@ -36,9 +36,15 @@
interface IGnssBatching {
void init(in android.hardware.gnss.IGnssBatchingCallback callback);
int getBatchSize();
- void start(in long periodNanos, in int flags);
+ void start(in android.hardware.gnss.IGnssBatching.Options options);
void flush();
void stop();
void cleanup();
const int WAKEUP_ON_FIFO_FULL = 1;
+ @VintfStability
+ parcelable Options {
+ long periodNanos;
+ float minDistanceMeters;
+ int flags;
+ }
}
diff --git a/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl b/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl
new file mode 100644
index 0000000..c506b04
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl
@@ -0,0 +1,166 @@
+/*
+ * Copyright (C) 2022 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;
+
+import android.hardware.gnss.IAGnssRilCallback;
+import android.hardware.gnss.IAGnssRilCallback.SetIDType;
+
+/**
+ * Extended interface for AGNSS RIL support. An Assisted GNSS Radio Interface
+ * Layer interface allows the GNSS chipset to request radio interface layer
+ * information from Android platform. Examples of such information are reference
+ * location, unique subscriber ID, phone number string and network availability changes.
+ */
+@VintfStability
+interface IAGnssRil {
+ /** Network capability mode bitmask for not metered. */
+ const int NETWORK_CAPABILITY_NOT_METERED = 0x01;
+
+ /** Network capability mode bitmask for not roaming. */
+ const int NETWORK_CAPABILITY_NOT_ROAMING = 0x02;
+
+ /** AGNSS reference location type */
+ @VintfStability
+ @Backing(type="int")
+ enum AGnssRefLocationType {
+ GSM_CELLID = 1,
+ UMTS_CELLID = 2,
+ LTE_CELLID = 4,
+ NR_CELLID = 8,
+ }
+
+ /** SET ID type*/
+ @VintfStability
+ @Backing(type="int")
+ enum SetIDType {
+ NONE = 0,
+ IMSI = 1,
+ MSISDM = 2,
+ }
+
+ /**
+ * CellID for 2G, 3G ,LTE and NR used in AGNSS. This is defined in
+ * UserPlane Location Protocol (Version 2.0.4).
+ */
+ @VintfStability
+ parcelable AGnssRefLocationCellID {
+ AGnssRefLocationType type;
+
+ /** Mobile Country Code. */
+ int mcc;
+
+ /** Mobile Network Code .*/
+ int mnc;
+
+ /**
+ * Location Area Code in 2G, 3G and LTE. In 3G lac is discarded. In LTE,
+ * lac is populated with tac, to ensure that we don't break old clients that
+ * might rely on the old (wrong) behavior.
+ */
+ int lac;
+
+ /**
+ * Cell id in 2G. Utran Cell id in 3G. Cell Global Id EUTRA in LTE.
+ * Cell Global Id NR in 5G.
+ */
+ long cid;
+
+ /** Tracking Area Code in LTE and NR. */
+ int tac;
+
+ /** Physical Cell id in LTE and NR (not used in 2G and 3G) */
+ int pcid;
+
+ /** Absolute Radio Frequency Channel Number in NR. */
+ int arfcn;
+ }
+
+ /** Represents ref locations */
+ @VintfStability
+ parcelable AGnssRefLocation {
+ AGnssRefLocationType type;
+
+ AGnssRefLocationCellID cellID;
+ }
+
+ /** Represents network connection status and capabilities. */
+ @VintfStability
+ parcelable NetworkAttributes {
+ /** Network handle of the network for use with the NDK API. */
+ long networkHandle;
+
+ /**
+ * True indicates that network connectivity exists and it is possible to
+ * establish connections and pass data. If false, only the networkHandle field
+ * is populated to indicate that this network has just disconnected.
+ */
+ boolean isConnected;
+
+ /**
+ * A bitfield of flags indicating the capabilities of this network. The bit masks are
+ * defined in NETWORK_CAPABILITY_*.
+ */
+ int capabilities;
+
+ /**
+ * Telephony preferred Access Point Name to use for carrier data connection when
+ * connected to a cellular network. Empty string, otherwise.
+ */
+ @utf8InCpp String apn;
+ }
+
+ /**
+ * Opens the AGNSS interface and provides the callback routines
+ * to the implementation of this interface.
+ *
+ * @param callback Interface for AGnssRil callbacks.
+ *
+ */
+ void setCallback(in IAGnssRilCallback callback);
+
+ /**
+ * Sets the reference location.
+ *
+ * @param agnssReflocation AGNSS reference location CellID.
+ *
+ */
+ void setRefLocation(in AGnssRefLocation agnssReflocation);
+
+ /**
+ * Sets the SET ID.
+ *
+ * @param type Must be populated with either IMSI or MSISDN or NONE.
+ * @param setid If type is IMSI then setid is populated with
+ * a string representing the unique Subscriber ID, for example, the IMSI for
+ * a GMS phone. If type is MSISDN, then setid must contain
+ * the phone number string for line 1. For example, the MSISDN for a GSM phone.
+ * If the type is NONE, then the string must be empty.
+ *
+ */
+ void setSetId(in SetIDType type, in @utf8InCpp String setid);
+
+ /**
+ * Notifies GNSS of network status changes.
+ *
+ * The framework calls this method to update the GNSS HAL implementation of network
+ * state changes.
+ *
+ * @param attributes Updated network attributes.
+ *
+ */
+ void updateNetworkState(in NetworkAttributes attributes);
+}
diff --git a/gnss/aidl/android/hardware/gnss/IAGnssRilCallback.aidl b/gnss/aidl/android/hardware/gnss/IAGnssRilCallback.aidl
new file mode 100644
index 0000000..6fb093e
--- /dev/null
+++ b/gnss/aidl/android/hardware/gnss/IAGnssRilCallback.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2022 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;
+
+/**
+ * Callback for IAGnssRil interface. Used to request SET ID and
+ * Reference Location.
+ */
+@VintfStability
+interface IAGnssRilCallback {
+ /**
+ * The Hal uses this API to request a SET ID.
+ *
+ * @param setIdflag A bitfield of IAGnssRil.SetIDType that is required by
+ * the HAL. The framework will inject an empty SET ID if the flag is NONE.
+ *
+ */
+ void requestSetIdCb(in int setIdflag);
+
+ /**
+ * The Hal uses this API to request a reference location.
+ */
+ void requestRefLocCb();
+}
diff --git a/gnss/aidl/android/hardware/gnss/IGnss.aidl b/gnss/aidl/android/hardware/gnss/IGnss.aidl
index 1e1c0fa..99f2ee4 100644
--- a/gnss/aidl/android/hardware/gnss/IGnss.aidl
+++ b/gnss/aidl/android/hardware/gnss/IGnss.aidl
@@ -18,6 +18,7 @@
import android.hardware.gnss.GnssLocation;
import android.hardware.gnss.IAGnss;
+import android.hardware.gnss.IAGnssRil;
import android.hardware.gnss.IGnssAntennaInfo;
import android.hardware.gnss.IGnssBatching;
import android.hardware.gnss.IGnssCallback;
@@ -188,6 +189,13 @@
IAGnss getExtensionAGnss();
/**
+ * This method returns the IAGnssRil interface.
+ *
+ * @return The IAGnssRil interface.
+ */
+ IAGnssRil getExtensionAGnssRil();
+
+ /**
* This method returns the IGnssDebug interface.
*
* This method must return non-null.
diff --git a/gnss/aidl/android/hardware/gnss/IGnssBatching.aidl b/gnss/aidl/android/hardware/gnss/IGnssBatching.aidl
index 0d48ee1..0d03a0f 100644
--- a/gnss/aidl/android/hardware/gnss/IGnssBatching.aidl
+++ b/gnss/aidl/android/hardware/gnss/IGnssBatching.aidl
@@ -46,6 +46,25 @@
*/
const int WAKEUP_ON_FIFO_FULL = 0x01;
+ /** Options specifying the batching request. */
+ @VintfStability
+ parcelable Options {
+ /** Time interval between samples in the location batch, in nanoseconds. */
+ long periodNanos;
+
+ /**
+ * The minimum distance in meters that the batching engine should
+ * accumulate before trying another GPS fix when in a challenging GPS environment.
+ *
+ * This is an optional field. If it is set as 0, the chipset can operate in an automatic
+ * mode.
+ */
+ float minDistanceMeters;
+
+ /** A bit field of Flags (WAKEUP_ON_FIFO_FULL) indicating the batching behavior. */
+ int flags;
+ }
+
/**
* Open the interface and provides the callback routines to the implementation of this
* interface.
@@ -83,10 +102,9 @@
* for using flushBatchedLocation to explicitly ask for the location as needed, to avoid it
* being dropped.
*
- * @param periodNanos Time interval between samples in the location batch, in nanoseconds
- * @param flags A bitfield of flags (WAKEUP_ON_FIFO_FULL) indicating the batching behavior
+ * @param options Options specifying the batching request.
*/
- void start(in long periodNanos, in int flags);
+ void start(in Options options);
/**
* Retrieve all batched locations currently stored.
diff --git a/gnss/aidl/default/AGnssRil.cpp b/gnss/aidl/default/AGnssRil.cpp
new file mode 100644
index 0000000..afe0039
--- /dev/null
+++ b/gnss/aidl/default/AGnssRil.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2021 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 "AGnssRilAidl"
+
+#include "AGnssRil.h"
+#include <inttypes.h>
+#include <log/log.h>
+
+namespace aidl::android::hardware::gnss {
+
+std::shared_ptr<IAGnssRilCallback> AGnssRil::sCallback = nullptr;
+
+ndk::ScopedAStatus AGnssRil::setCallback(const std::shared_ptr<IAGnssRilCallback>& callback) {
+ ALOGD("AGnssRil::setCallback");
+ std::unique_lock<std::mutex> lock(mMutex);
+ sCallback = callback;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus AGnssRil::setRefLocation(const AGnssRefLocation& agnssReflocation) {
+ const AGnssRefLocationCellID& cellInfo = agnssReflocation.cellID;
+ ALOGD("AGnssRil::setRefLocation: type: %s, mcc: %d, mnc: %d, lac: %d, cid: %" PRId64
+ ", tac: %d, pcid: "
+ "%d, arfcn: %d",
+ toString(agnssReflocation.type).c_str(), cellInfo.mcc, cellInfo.mnc, cellInfo.lac,
+ cellInfo.cid, cellInfo.tac, cellInfo.pcid, cellInfo.arfcn);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus AGnssRil::setSetId(SetIDType type, const std::string& setid) {
+ ALOGD("AGnssRil::setSetId: type:%s, setid: %s", toString(type).c_str(), setid.c_str());
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus AGnssRil::updateNetworkState(const NetworkAttributes& attributes) {
+ ALOGD("AGnssRil::updateNetworkState: networkHandle:%" PRId64
+ ", isConnected: %d, capabilities: %d, "
+ "apn: %s",
+ attributes.networkHandle, attributes.isConnected, attributes.capabilities,
+ attributes.apn.c_str());
+ return ndk::ScopedAStatus::ok();
+}
+
+} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/AGnssRil.h b/gnss/aidl/default/AGnssRil.h
new file mode 100644
index 0000000..7e429ee
--- /dev/null
+++ b/gnss/aidl/default/AGnssRil.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/gnss/BnAGnssRil.h>
+
+namespace aidl::android::hardware::gnss {
+
+struct AGnssRil : public BnAGnssRil {
+ public:
+ ndk::ScopedAStatus setCallback(const std::shared_ptr<IAGnssRilCallback>& callback) override;
+ ndk::ScopedAStatus setRefLocation(const AGnssRefLocation& agnssReflocation) override;
+ ndk::ScopedAStatus setSetId(SetIDType type, const std::string& setid) override;
+ ndk::ScopedAStatus updateNetworkState(const NetworkAttributes& attributes) override;
+
+ private:
+ // Synchronization lock for sCallback
+ mutable std::mutex mMutex;
+ // Guarded by mMutex
+ static std::shared_ptr<IAGnssRilCallback> sCallback;
+};
+
+} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/Android.bp b/gnss/aidl/default/Android.bp
index 3be7fb9..4543665 100644
--- a/gnss/aidl/default/Android.bp
+++ b/gnss/aidl/default/Android.bp
@@ -55,6 +55,7 @@
"android.hardware.gnss-V2-ndk",
],
srcs: [
+ "AGnssRil.cpp",
"AGnss.cpp",
"Gnss.cpp",
"GnssAntennaInfo.cpp",
diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp
index c11a99a..6331dfd 100644
--- a/gnss/aidl/default/Gnss.cpp
+++ b/gnss/aidl/default/Gnss.cpp
@@ -20,6 +20,7 @@
#include <inttypes.h>
#include <log/log.h>
#include "AGnss.h"
+#include "AGnssRil.h"
#include "DeviceFileReader.h"
#include "GnssAntennaInfo.h"
#include "GnssBatching.h"
@@ -171,7 +172,7 @@
return ScopedAStatus::ok();
}
-ndk::ScopedAStatus Gnss::getExtensionAGnss(std::shared_ptr<IAGnss>* iAGnss) {
+ScopedAStatus Gnss::getExtensionAGnss(std::shared_ptr<IAGnss>* iAGnss) {
ALOGD("Gnss::getExtensionAGnss");
*iAGnss = SharedRefBase::make<AGnss>();
return ndk::ScopedAStatus::ok();
@@ -183,6 +184,12 @@
return ScopedAStatus::ok();
}
+ScopedAStatus Gnss::getExtensionAGnssRil(std::shared_ptr<IAGnssRil>* iAGnssRil) {
+ ALOGD("Gnss::getExtensionAGnssRil");
+ *iAGnssRil = SharedRefBase::make<AGnssRil>();
+ return ndk::ScopedAStatus::ok();
+}
+
ScopedAStatus Gnss::injectLocation(const GnssLocation& location) {
ALOGD("injectLocation. lat:%lf, lng:%lf, acc:%f", location.latitudeDegrees,
location.longitudeDegrees, location.horizontalAccuracyMeters);
diff --git a/gnss/aidl/default/Gnss.h b/gnss/aidl/default/Gnss.h
index 478dc94..36874b8 100644
--- a/gnss/aidl/default/Gnss.h
+++ b/gnss/aidl/default/Gnss.h
@@ -17,6 +17,7 @@
#pragma once
#include <aidl/android/hardware/gnss/BnAGnss.h>
+#include <aidl/android/hardware/gnss/BnAGnssRil.h>
#include <aidl/android/hardware/gnss/BnGnss.h>
#include <aidl/android/hardware/gnss/BnGnssAntennaInfo.h>
#include <aidl/android/hardware/gnss/BnGnssBatching.h>
@@ -67,6 +68,7 @@
ndk::ScopedAStatus getExtensionGnssNavigationMessage(
std::shared_ptr<IGnssNavigationMessageInterface>* iGnssNavigationMessage) override;
ndk::ScopedAStatus getExtensionAGnss(std::shared_ptr<IAGnss>* iAGnss) override;
+ ndk::ScopedAStatus getExtensionAGnssRil(std::shared_ptr<IAGnssRil>* iAGnssRil) override;
ndk::ScopedAStatus getExtensionGnssDebug(std::shared_ptr<IGnssDebug>* iGnssDebug) override;
ndk::ScopedAStatus getExtensionGnssVisibilityControl(
std::shared_ptr<android::hardware::gnss::visibility_control::IGnssVisibilityControl>*
diff --git a/gnss/aidl/default/GnssBatching.cpp b/gnss/aidl/default/GnssBatching.cpp
index b8be5e5..33e1fd5 100644
--- a/gnss/aidl/default/GnssBatching.cpp
+++ b/gnss/aidl/default/GnssBatching.cpp
@@ -52,17 +52,19 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus GnssBatching::start(int64_t periodNanos, int flags) {
- ALOGD("start: periodNanos=%" PRId64 ", flags=%d", periodNanos, flags);
+ndk::ScopedAStatus GnssBatching::start(const Options& options) {
+ ALOGD("start: periodNanos=%" PRId64 ", minDistanceMeters=%f, flags=%d", options.periodNanos,
+ options.minDistanceMeters, options.flags);
if (mIsActive) {
ALOGW("Gnss has started. Restarting...");
stop();
}
- mWakeUpOnFifoFull = (flags & IGnssBatching::WAKEUP_ON_FIFO_FULL) ? true : false;
// mMinIntervalMs is not smaller than 1 sec
- periodNanos = (periodNanos < 1e9) ? 1e9 : periodNanos;
+ long periodNanos = (options.periodNanos < 1e9) ? 1e9 : options.periodNanos;
mMinIntervalMs = periodNanos / 1e6;
+ mWakeUpOnFifoFull = (options.flags & IGnssBatching::WAKEUP_ON_FIFO_FULL) ? true : false;
+ mMinDistanceMeters = options.minDistanceMeters;
mIsActive = true;
mThread = std::thread([this]() {
diff --git a/gnss/aidl/default/GnssBatching.h b/gnss/aidl/default/GnssBatching.h
index 7cd6e85..6d1d809 100644
--- a/gnss/aidl/default/GnssBatching.h
+++ b/gnss/aidl/default/GnssBatching.h
@@ -28,7 +28,7 @@
~GnssBatching();
ndk::ScopedAStatus init(const std::shared_ptr<IGnssBatchingCallback>& callback) override;
ndk::ScopedAStatus getBatchSize(int* size) override;
- ndk::ScopedAStatus start(int64_t periodNanos, int flags) override;
+ ndk::ScopedAStatus start(const Options& options) override;
ndk::ScopedAStatus flush() override;
ndk::ScopedAStatus stop() override;
ndk::ScopedAStatus cleanup() override;
@@ -42,6 +42,7 @@
std::thread mThread;
std::atomic<bool> mIsActive;
std::atomic<long> mMinIntervalMs;
+ std::atomic<float> mMinDistanceMeters;
std::atomic<bool> mWakeUpOnFifoFull;
// Synchronization lock for sCallback
diff --git a/gnss/aidl/vts/AGnssRilCallbackAidl.cpp b/gnss/aidl/vts/AGnssRilCallbackAidl.cpp
new file mode 100644
index 0000000..4e4166d
--- /dev/null
+++ b/gnss/aidl/vts/AGnssRilCallbackAidl.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2022 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 "AGnssRilCallbackAidl.h"
+#include <log/log.h>
+
+android::binder::Status AGnssRilCallbackAidl::requestSetIdCb(int setIdflag) {
+ ALOGI("requestSetIdCb setIdflag %d", setIdflag);
+ return android::binder::Status::ok();
+}
+
+android::binder::Status AGnssRilCallbackAidl::requestRefLocCb() {
+ ALOGI("requestRefLocCb");
+ return android::binder::Status::ok();
+}
diff --git a/gnss/aidl/vts/AGnssRilCallbackAidl.h b/gnss/aidl/vts/AGnssRilCallbackAidl.h
new file mode 100644
index 0000000..74b34ee
--- /dev/null
+++ b/gnss/aidl/vts/AGnssRilCallbackAidl.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#pragma once
+
+#include <android/hardware/gnss/BnAGnssRilCallback.h>
+
+/** Implementation for IAGnssRilCallback. */
+class AGnssRilCallbackAidl : public android::hardware::gnss::BnAGnssRilCallback {
+ public:
+ AGnssRilCallbackAidl(){};
+ ~AGnssRilCallbackAidl(){};
+ android::binder::Status requestSetIdCb(int setIdflag) override;
+ android::binder::Status requestRefLocCb() override;
+};
diff --git a/gnss/aidl/vts/Android.bp b/gnss/aidl/vts/Android.bp
index 4244ab3..f02a41e 100644
--- a/gnss/aidl/vts/Android.bp
+++ b/gnss/aidl/vts/Android.bp
@@ -31,6 +31,7 @@
"gnss_hal_test.cpp",
"gnss_hal_test_cases.cpp",
"AGnssCallbackAidl.cpp",
+ "AGnssRilCallbackAidl.cpp",
"GnssAntennaInfoCallbackAidl.cpp",
"GnssBatchingCallback.cpp",
"GnssCallbackAidl.cpp",
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index 6e363f9..1fa6825 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -29,6 +29,7 @@
#include <android/hardware/gnss/visibility_control/IGnssVisibilityControl.h>
#include <cutils/properties.h>
#include "AGnssCallbackAidl.h"
+#include "AGnssRilCallbackAidl.h"
#include "GnssAntennaInfoCallbackAidl.h"
#include "GnssBatchingCallback.h"
#include "GnssGeofenceCallback.h"
@@ -48,6 +49,7 @@
using android::hardware::gnss::GnssMeasurement;
using android::hardware::gnss::GnssPowerStats;
using android::hardware::gnss::IAGnss;
+using android::hardware::gnss::IAGnssRil;
using android::hardware::gnss::IGnss;
using android::hardware::gnss::IGnssAntennaInfo;
using android::hardware::gnss::IGnssAntennaInfoCallback;
@@ -811,6 +813,10 @@
* TestAllExtensions.
*/
TEST_P(GnssHalTest, TestAllExtensions) {
+ if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ return;
+ }
+
sp<IGnssBatching> iGnssBatching;
auto status = aidl_gnss_hal_->getExtensionGnssBatching(&iGnssBatching);
if (status.isOk() && iGnssBatching != nullptr) {
@@ -867,6 +873,42 @@
}
/*
+ * TestAGnssRilExtension:
+ * 1. Gets the IAGnssRil extension.
+ * 2. Sets AGnssRilCallback.
+ * 3. Sets reference location.
+ */
+TEST_P(GnssHalTest, TestAGnssRilExtension) {
+ if (aidl_gnss_hal_->getInterfaceVersion() == 1) {
+ return;
+ }
+ sp<IAGnssRil> iAGnssRil;
+ auto status = aidl_gnss_hal_->getExtensionAGnssRil(&iAGnssRil);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_TRUE(iAGnssRil != nullptr);
+
+ auto agnssRilCallback = sp<AGnssRilCallbackAidl>::make();
+ status = iAGnssRil->setCallback(agnssRilCallback);
+ ASSERT_TRUE(status.isOk());
+
+ // Set RefLocation
+ IAGnssRil::AGnssRefLocationCellID agnssReflocationCellId;
+ agnssReflocationCellId.type = IAGnssRil::AGnssRefLocationType::LTE_CELLID;
+ agnssReflocationCellId.mcc = 466;
+ agnssReflocationCellId.mnc = 97;
+ agnssReflocationCellId.lac = 46697;
+ agnssReflocationCellId.cid = 59168142;
+ agnssReflocationCellId.pcid = 420;
+ agnssReflocationCellId.tac = 11460;
+ IAGnssRil::AGnssRefLocation agnssReflocation;
+ agnssReflocation.type = IAGnssRil::AGnssRefLocationType::LTE_CELLID;
+ agnssReflocation.cellID = agnssReflocationCellId;
+
+ status = iAGnssRil->setRefLocation(agnssReflocation);
+ ASSERT_TRUE(status.isOk());
+}
+
+/*
* GnssDebugValuesSanityTest:
* Ensures that GnssDebug values make sense.
*/