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

Commit 582ee08b authored by Jakub Tyszkowski's avatar Jakub Tyszkowski
Browse files

LeAudio: Fix broadcast code padding

According to Core Spec. 5.3, Vol 3, Part C, Sec. 3.2.6.3
The code should be LSB first, with MSB padding bytes when
needed.

Tag: #feature
Bug: 266444992
Test: atest BluetoothInstrumentationTests
Test: verified in btsnoop logs
Change-Id: I1101138b727633825fa5ea253d7d2197e30769c5
parent 7b36532a
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -1163,10 +1163,8 @@ static void CreateBroadcastNative(JNIEnv* env, jobject object,
      return;
    }

    // Padding with zeros on LSB positions if code is shorter than 16 octets
    env->GetByteArrayRegion(
        broadcast_code, 0, size,
        (jbyte*)code_array.data() + code_array.size() - size);
    // Padding with zeros on MSB positions if code is shorter than 16 octets
    env->GetByteArrayRegion(broadcast_code, 0, size, (jbyte*)code_array.data());
  }

  jbyte* meta = env->GetByteArrayElements(metadata, nullptr);