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

Commit 6fa8e020 authored by Nitin Shivpure's avatar Nitin Shivpure Committed by William Escande
Browse files

PBAP: Dynamic Version Upgrade for PBAP 1.2 supporting remote

This change stores version of remote device if it supports
PBAP 1.2. While sending SDP response, remote device support
will be checked in conf file and if entry for remote device
is found for 1.2 support, device will send 1.2 SDP response.

Snapshot of:
72f658a69d62794bf25f99fece089ccf3666750e
6f313c106a71a12eb87e005a41213a54cda425da
e909f6e5ef0ba5f56a3ee7ede5b86dc3f668c564
6f66c22f26a7cd3fdc4cd44d8c8bb47af0a629b3
009034241686da41a474bedf225d9f7af8595640
680251a750a7b3e46de6cd71a6396f272dd91e51
a156ef66075ad88f605304ec929389fabed236bf
7ad3706865c28c08330023d7921dbc43fbb1111a
b79f5b83684d3605b3ae44430bbff12f5c09f4c5
9cc899b5529da7504ede4810ec8f1f47c01b8f42

Test: atest net_test_stack_sdp
Tag: #feature
Bug: 252902891
Change-Id: Idf4edbc4b39506855ecf6245a96eca5706082256
Merged-In: Idf4edbc4b39506855ecf6245a96eca5706082256
parent bd6e4af1
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
@@ -2030,6 +2030,42 @@ static void interopDatabaseAddRemoveNameNative(JNIEnv* env, jclass clazz,
  env->ReleaseStringUTFChars(name, name_str);
}

static int getRemotePbapPceVersionNative(JNIEnv* env, jobject obj,
                                         jstring address) {
  ALOGV("%s", __func__);

  if (!sBluetoothInterface) return JNI_FALSE;

  const char* tmp_addr = env->GetStringUTFChars(address, NULL);
  if (!tmp_addr) {
    ALOGW("%s: address is null.", __func__);
    return JNI_FALSE;
  }

  RawAddress bdaddr;
  bool success = RawAddress::FromString(tmp_addr, bdaddr);

  env->ReleaseStringUTFChars(address, tmp_addr);

  if (!success) {
    ALOGW("%s: address is invalid.", __func__);
    return JNI_FALSE;
  }

  return sBluetoothInterface->get_remote_pbap_pce_version(&bdaddr);
}

static jboolean pbapPseDynamicVersionUpgradeIsEnabledNative(JNIEnv* env,
                                                            jobject obj) {
  ALOGV("%s", __func__);

  if (!sBluetoothInterface) return JNI_FALSE;

  return sBluetoothInterface->pbap_pse_dynamic_version_upgrade_is_enabled()
             ? JNI_TRUE
             : JNI_FALSE;
}

static JNINativeMethod sMethods[] = {
    /* name, signature, funcPtr */
    {"classInitNative", "()V", (void*)classInitNative},
@@ -2086,6 +2122,10 @@ static JNINativeMethod sMethods[] = {
    {"interopDatabaseAddRemoveNameNative",
     "(ZLjava/lang/String;Ljava/lang/String;)V",
     (void*)interopDatabaseAddRemoveNameNative},
    {"getRemotePbapPceVersionNative", "(Ljava/lang/String;)I",
     (void*)getRemotePbapPceVersionNative},
    {"pbapPseDynamicVersionUpgradeIsEnabledNative", "()Z",
     (void*)pbapPseDynamicVersionUpgradeIsEnabledNative},
};

int register_com_android_bluetooth_btservice_AdapterService(JNIEnv* env) {
+2 −0
Original line number Diff line number Diff line
@@ -13,4 +13,6 @@
    <string name="localPhoneName" msgid="9119254982537191352">"O meu nome"</string>
    <string name="defaultnumber" msgid="5348816189286607406">"000000"</string>
    <string name="pbap_notification_group" msgid="4215789331721465381">"Partilha de contactos por Bluetooth"</string>
    <string name="phonebook_advance_feature_support">Recurso Avançado da Lista Telefônica Suportado</string>
    <string name="repair_for_adv_phonebook_feature">Re-par para Recurso Avançado Agenda</string>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -13,4 +13,6 @@
    <string name="localPhoneName" msgid="9119254982537191352">"Meu nome"</string>
    <string name="defaultnumber" msgid="5348816189286607406">"000000"</string>
    <string name="pbap_notification_group" msgid="4215789331721465381">"Compartilhamento de contato via Bluetooth"</string>
    <string name="phonebook_advance_feature_support">Recurso Avançado da Lista Telefônica Suportado</string>
    <string name="repair_for_adv_phonebook_feature">Re-par para Recurso Avançado Agenda</string>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -14,4 +14,6 @@
    <string name="localPhoneName">My name</string>
    <string name="defaultnumber">000000</string>
    <string name="pbap_notification_group">Bluetooth Contact share</string>
    <string name="phonebook_advance_feature_support">Phonebook Advance Feature Supported</string>
    <string name="repair_for_adv_phonebook_feature">Re-pair for Advance Phonebook Feature</string>
</resources>
+14 −0
Original line number Diff line number Diff line
@@ -96,6 +96,20 @@ public class ObexServerSockets {

    private static final int CREATE_RETRY_TIME = 10;

    /**
      * Creates an RFCOMM {@link BluetoothServerSocket} and a L2CAP {@link BluetoothServerSocket}
      * @param validator a reference to the {@link IObexConnectionHandler} object to call
      *                  to validate an incoming connection.
      * @param rfcommChannel fixed rfcomm channel number to listen on
      * @param l2capPsm fixed l2cap psm to listen on
      * @return a reference to a {@link ObexServerSockets} object instance.
      * @throws IOException if it occurs while creating the {@link BluetoothServerSocket}s.
    */
    public static ObexServerSockets createWithFixedChannels(IObexConnectionHandler validator,
            int rfcommChannel, int l2capPsm) {
        return create(validator, rfcommChannel, l2capPsm, true);
    }

    /**
     * Creates an RFCOMM {@link BluetoothServerSocket} and a L2CAP {@link BluetoothServerSocket}
     * with specific l2cap and RFCOMM channel numbers. It is the responsibility of the caller to
Loading