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

Commit 6e15b6ab authored by William Escande's avatar William Escande Committed by Android (Google) Code Review
Browse files

Merge changes I8785e725,I44d5d114,I26f4b725,Ib717faa5,I45adfe7c, ... into tm-qpr-dev

* changes:
  Enable tidy for aptx and aptxHD
  Fix more tidy error
  Apply and fix clang-tidy on aptx and aptxhd
  Add regression test for aptx
  Link AptX and AptXHD encoder into Bt
  Apply format on aptx and aptxhd
  Add AptX and AptXHD Headers
  Add encoder for aptX and encoder for aptX HD source code.
  Clean com.android.bluetooth to prevent visibility error
parents 24c4dc0b d929d202
Loading
Loading
Loading
Loading

TEST_MAPPING

100755 → 100644
+6 −0
Original line number Original line Diff line number Diff line
@@ -62,6 +62,12 @@
    {
    {
      "name" : "net_test_btif_hf_client_service"
      "name" : "net_test_btif_hf_client_service"
    },
    },
    {
      "name" : "libaptx_enc_tests"
    },
    {
      "name" : "libaptxhd_enc_tests"
    },
    {
    {
      "name" : "net_test_stack_btm"
      "name" : "net_test_stack_btm"
    }
    }
+0 −21
Original line number Original line Diff line number Diff line
@@ -22,27 +22,6 @@ apex {
    bootclasspath_fragments: ["com.android.btservices-bootclasspath-fragment"],
    bootclasspath_fragments: ["com.android.btservices-bootclasspath-fragment"],
    systemserverclasspath_fragments: ["com.android.btservices-systemserverclasspath-fragment"],
    systemserverclasspath_fragments: ["com.android.btservices-systemserverclasspath-fragment"],
    compat_configs: ["bluetooth-compat-config"],
    compat_configs: ["bluetooth-compat-config"],
    apps: ["Bluetooth"],

    multilib: {
        first: {
            // Extractor process runs only with the primary ABI.
            jni_libs: [
                "libbluetooth_jni",
            ],
        },
    },

    prebuilts: [
        "audio_set_configurations_bfbs",
        "audio_set_configurations_json",
        "audio_set_scenarios_bfbs",
        "audio_set_scenarios_json",
        "btservices-linker-config",
        "bt_did.conf",
        "bt_stack.conf",
        "privapp_allowlist_com.android.bluetooth.xml",
    ],
    key: "com.android.btservices.key",
    key: "com.android.btservices.key",
    certificate: ":com.android.btservices.certificate",
    certificate: ":com.android.btservices.certificate",
    updatable: false,
    updatable: false,
+0 −2
Original line number Original line Diff line number Diff line
@@ -7,7 +7,5 @@
  ],
  ],
  "name": "com.android.btservices",
  "name": "com.android.btservices",
  "requireNativeLibs": [
  "requireNativeLibs": [
    "libaptX_encoder.so",
    "libaptXHD_encoder.so"
  ]
  ]
}
}
+37 −0
Original line number Original line Diff line number Diff line
tidy_errors = [
    "*",
    "-altera-struct-pack-align",
    "-altera-unroll-loops",
    "-bugprone-narrowing-conversions",
    "-cppcoreguidelines-avoid-magic-numbers",
    "-cppcoreguidelines-init-variables",
    "-cppcoreguidelines-narrowing-conversions",
    "-hicpp-signed-bitwise",
    "-llvm-header-guard",
    "-readability-avoid-const-params-in-decls",
    "-readability-identifier-length",
    "-readability-magic-numbers",
]

cc_library_static {
    name: "libaptx_enc",
    host_supported: true,
    export_include_dirs: ["include"],
    srcs: [
        "src/aptXbtenc.c",
        "src/ProcessSubband.c",
        "src/QmfConv.c",
        "src/QuantiseDifference.c",
    ],
    cflags: ["-O2", "-Werror", "-Wall", "-Wextra"],
    tidy: true,
    tidy_checks: tidy_errors,
    tidy_checks_as_errors: tidy_errors,
    min_sdk_version: "Tiramisu",
    apex_available: [
        "com.android.btservices",
    ],
    visibility: [
        "//packages/modules/Bluetooth:__subpackages__",
    ],
}
+71 −0
Original line number Original line Diff line number Diff line
/**
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*------------------------------------------------------------------------------
 *
 *  This file exposes a public interface to allow clients to invoke aptX
 *  encoding on 4 new PCM samples, generating 2 new codeword (one for the
 *  left channel and one for the right channel).
 *
 *----------------------------------------------------------------------------*/

#ifndef APTXBTENC_H
#define APTXBTENC_H

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifdef _DLLEXPORT
#define APTXBTENCEXPORT __declspec(dllexport)
#else
#define APTXBTENCEXPORT
#endif

/* SizeofAptxbtenc returns the size (in byte) of the memory
 * allocation required to store the state of the encoder */
APTXBTENCEXPORT int SizeofAptxbtenc(void);

/* aptxbtenc_version can be used to extract the version number
 * of the aptX encoder */
APTXBTENCEXPORT const char* aptxbtenc_version(void);

/* aptxbtenc_init is used to initialise the encoder structure.
 * _state should be a pointer to the encoder structure (stereo).
 * endian represent the endianness of the output data
 * (0=little endian. Big endian otherwise)
 * The function returns 1 if an error occurred during the initialisation.
 * The function returns 0 if no error occurred during the initialisation. */
APTXBTENCEXPORT int aptxbtenc_init(void* _state, short endian);

/* aptxbtenc_setsync_mode is used to initialise the sync mode in the encoder
 * state structure. _state should be a pointer to the encoder structure (stereo,
 * though strictly-speaking it is dual channel). 'sync_mode' is an enumerated
 * type  {stereo=0, dualmono=1, no_sync=2} The function returns 0 if no error
 * occurred during the initialisation. */
APTXBTENCEXPORT int aptxbtenc_setsync_mode(void* _state, int32_t sync_mode);

/* StereoEncode will take 8 audio samples (16-bit per sample)
 * and generate one 32-bit codeword with autosync inserted. */
APTXBTENCEXPORT int aptxbtenc_encodestereo(void* _state, void* _pcmL,
                                           void* _pcmR, void* _buffer);

#ifdef __cplusplus
}  //  /extern "C"
#endif

#endif  // APTXBTENC_H
Loading