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

Commit 425379c2 authored by Shinru Han's avatar Shinru Han Committed by Android (Google) Code Review
Browse files

Merge "Add injectNiSuplMessageData()"

parents f057bdad a977bcc1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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
+10 −0
Original line number Diff line number Diff line
@@ -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);
}
+12 −0
Original line number Diff line number Diff line
@@ -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
+2 −0
Original line number Diff line number Diff line
@@ -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
+4 −0
Original line number Diff line number Diff line
@@ -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());
}

/*