Add injectNiSuplMessageData()

Test: atest VtsHalGnssTargetTest
Bug: b/242105192
Change-Id: I32a87cbcad67fda032137ed5eb2181cd0266f171
This commit is contained in:
Shinru Han
2022-10-07 14:11:33 +08:00
parent 0dc453ff03
commit a977bcc18b
5 changed files with 29 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ interface IAGnssRil {
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);
void injectNiSuplMessageData(in byte[] msgData, in int slotIndex);
const int NETWORK_CAPABILITY_NOT_METERED = 1;
const int NETWORK_CAPABILITY_NOT_ROAMING = 2;
@Backing(type="int") @VintfStability

View File

@@ -164,4 +164,14 @@ interface IAGnssRil {
*
*/
void updateNetworkState(in NetworkAttributes attributes);
/**
* Injects an SMS/WAP initiated SUPL message.
*
* @param msgData ASN.1 encoded SUPL INIT message. This is defined in
* UserPlane Location Protocol (Version 2.0.4).
* @param slotIndex Specifies the slot index (See
* android.telephony.SubscriptionManager#getSlotIndex()) of the SUPL connection.
*/
void injectNiSuplMessageData(in byte[] msgData, in int slotIndex);
}

View File

@@ -17,6 +17,7 @@
#define LOG_TAG "AGnssRilAidl"
#include "AGnssRil.h"
#include <aidl/android/hardware/gnss/BnGnss.h>
#include <inttypes.h>
#include <log/log.h>
@@ -55,4 +56,15 @@ ndk::ScopedAStatus AGnssRil::updateNetworkState(const NetworkAttributes& attribu
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus AGnssRil::injectNiSuplMessageData(const std::vector<uint8_t>& msgData,
int slotIndex) {
ALOGD("AGnssRil::injectNiSuplMessageData: msgData:%d bytes slotIndex:%d",
static_cast<int>(msgData.size()), slotIndex);
if (msgData.size() > 0) {
return ndk::ScopedAStatus::ok();
} else {
return ndk::ScopedAStatus::fromServiceSpecificError(IGnss::ERROR_INVALID_ARGUMENT);
}
}
} // namespace aidl::android::hardware::gnss

View File

@@ -26,6 +26,8 @@ struct AGnssRil : public BnAGnssRil {
ndk::ScopedAStatus setRefLocation(const AGnssRefLocation& agnssReflocation) override;
ndk::ScopedAStatus setSetId(SetIdType type, const std::string& setid) override;
ndk::ScopedAStatus updateNetworkState(const NetworkAttributes& attributes) override;
ndk::ScopedAStatus injectNiSuplMessageData(const std::vector<uint8_t>& msgData,
int slotIndex) override;
private:
// Synchronization lock for sCallback

View File

@@ -1077,6 +1077,7 @@ TEST_P(GnssHalTest, TestAGnssExtension) {
* 2. Sets AGnssRilCallback.
* 3. Update network state to connected and then disconnected.
* 4. Sets reference location.
* 5. Injects empty NI message data and verifies that it returns an error.
*/
TEST_P(GnssHalTest, TestAGnssRilExtension) {
if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
@@ -1120,6 +1121,9 @@ TEST_P(GnssHalTest, TestAGnssRilExtension) {
status = iAGnssRil->setRefLocation(agnssReflocation);
ASSERT_TRUE(status.isOk());
status = iAGnssRil->injectNiSuplMessageData(std::vector<uint8_t>(), 0);
ASSERT_FALSE(status.isOk());
}
/*