Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a977bcc1 authored by Shinru Han's avatar Shinru Han
Browse files

Add injectNiSuplMessageData()

Test: atest VtsHalGnssTargetTest
Bug: b/242105192
Change-Id: I32a87cbcad67fda032137ed5eb2181cd0266f171
parent 0dc453ff
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -39,6 +39,7 @@ interface IAGnssRil {
  void setRefLocation(in android.hardware.gnss.IAGnssRil.AGnssRefLocation agnssReflocation);
  void setRefLocation(in android.hardware.gnss.IAGnssRil.AGnssRefLocation agnssReflocation);
  void setSetId(in android.hardware.gnss.IAGnssRil.SetIdType type, in @utf8InCpp String setid);
  void setSetId(in android.hardware.gnss.IAGnssRil.SetIdType type, in @utf8InCpp String setid);
  void updateNetworkState(in android.hardware.gnss.IAGnssRil.NetworkAttributes attributes);
  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_METERED = 1;
  const int NETWORK_CAPABILITY_NOT_ROAMING = 2;
  const int NETWORK_CAPABILITY_NOT_ROAMING = 2;
  @Backing(type="int") @VintfStability
  @Backing(type="int") @VintfStability
+10 −0
Original line number Original line Diff line number Diff line
@@ -164,4 +164,14 @@ interface IAGnssRil {
     *
     *
     */
     */
    void updateNetworkState(in NetworkAttributes attributes);
    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);
}
}
+12 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
#define LOG_TAG "AGnssRilAidl"
#define LOG_TAG "AGnssRilAidl"


#include "AGnssRil.h"
#include "AGnssRil.h"
#include <aidl/android/hardware/gnss/BnGnss.h>
#include <inttypes.h>
#include <inttypes.h>
#include <log/log.h>
#include <log/log.h>


@@ -55,4 +56,15 @@ ndk::ScopedAStatus AGnssRil::updateNetworkState(const NetworkAttributes& attribu
    return ndk::ScopedAStatus::ok();
    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
}  // namespace aidl::android::hardware::gnss
+2 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,8 @@ struct AGnssRil : public BnAGnssRil {
    ndk::ScopedAStatus setRefLocation(const AGnssRefLocation& agnssReflocation) override;
    ndk::ScopedAStatus setRefLocation(const AGnssRefLocation& agnssReflocation) override;
    ndk::ScopedAStatus setSetId(SetIdType type, const std::string& setid) override;
    ndk::ScopedAStatus setSetId(SetIdType type, const std::string& setid) override;
    ndk::ScopedAStatus updateNetworkState(const NetworkAttributes& attributes) override;
    ndk::ScopedAStatus updateNetworkState(const NetworkAttributes& attributes) override;
    ndk::ScopedAStatus injectNiSuplMessageData(const std::vector<uint8_t>& msgData,
                                               int slotIndex) override;


  private:
  private:
    // Synchronization lock for sCallback
    // Synchronization lock for sCallback
+4 −0
Original line number Original line Diff line number Diff line
@@ -1077,6 +1077,7 @@ TEST_P(GnssHalTest, TestAGnssExtension) {
 * 2. Sets AGnssRilCallback.
 * 2. Sets AGnssRilCallback.
 * 3. Update network state to connected and then disconnected.
 * 3. Update network state to connected and then disconnected.
 * 4. Sets reference location.
 * 4. Sets reference location.
 * 5. Injects empty NI message data and verifies that it returns an error.
 */
 */
TEST_P(GnssHalTest, TestAGnssRilExtension) {
TEST_P(GnssHalTest, TestAGnssRilExtension) {
    if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
    if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
@@ -1120,6 +1121,9 @@ TEST_P(GnssHalTest, TestAGnssRilExtension) {


    status = iAGnssRil->setRefLocation(agnssReflocation);
    status = iAGnssRil->setRefLocation(agnssReflocation);
    ASSERT_TRUE(status.isOk());
    ASSERT_TRUE(status.isOk());

    status = iAGnssRil->injectNiSuplMessageData(std::vector<uint8_t>(), 0);
    ASSERT_FALSE(status.isOk());
}
}


/*
/*