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

Commit 6c0aff04 authored by Phil Burk's avatar Phil Burk
Browse files

BluetoothMidi test: test encoder and decoder

Also test MidiFramer
Add end-to-end test through encoder and decoder.
Add test for reserved bit in header.

Bug: 35669198
Bug: 140638458
Bug: 149927520
Test: atest BluetoothMidiTests
Change-Id: I767deab6847d2b45e01bed29f5eed3df0f0e46c0
Merged-In: I767deab6847d2b45e01bed29f5eed3df0f0e46c0
parent b164ea9d
Loading
Loading
Loading
Loading
+30 −1
Original line number Diff line number Diff line
//
// Copyright (C) 2019 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.
//

android_library {
    name: "BluetoothMidiLib",
    srcs: [
        "src/**/*.java",
    ],
    platform_apis: true,
    plugins: ["java_api_finder"],
    manifest: "AndroidManifestBase.xml",
}

android_app {
    name: "BluetoothMidiService",
    srcs: ["src/**/*.java"],
    srcs: [
        "src/**/*.java",
    ],
    platform_apis: true,
    certificate: "platform",
    manifest: "AndroidManifest.xml",
}
+23 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
 * Copyright (C) 2015 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.
 */
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        package="com.android.bluetoothmidiservice"
        android:versionCode="1"
        android:versionName="R-initial"
        >
    <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29" />

    <uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
    <uses-feature android:name="android.software.midi" android:required="true"/>
    <uses-permission android:name="android.permission.BLUETOOTH"/>

    <application
        tools:replace="android:label"
        android:label="@string/app_name">
        <service android:name=".BluetoothMidiService"
            android:permission="android.permission.BIND_MIDI_DEVICE_SERVICE">
+30 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
 * Copyright (C) 2020 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.
 */
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.android.bluetoothmidiservice"
          android:versionCode="1"
          android:versionName="R-initial"
          >
    <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29" />
    <application
        android:label="BluetoothMidi"
        android:defaultToDeviceProtectedStorage="true"
        android:directBootAware="true">
    </application>
</manifest>
+38 −0
Original line number Diff line number Diff line
//
// Copyright (C) 2019 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.
//

android_test {
    name: "BluetoothMidiTests",
    srcs: ["src/**/*.java"],
    certificate: "platform",
    static_libs: [
        //"frameworks-base-testutils",
        "android-support-test",
        "androidx.test.core",
        "androidx.test.ext.truth",
        "androidx.test.runner",
        "androidx.test.rules",
        "platform-test-annotations",
        "BluetoothMidiLib",
    ],
    test_suites: ["device-tests"],
    libs: [
        "framework-res",
        "android.test.runner",
        "android.test.base",
        "android.test.mock",
    ],
}
+32 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2019 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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          package="com.android.bluetoothmidiservice.tests.unit">
    <uses-sdk
        android:minSdkVersion="29"
        android:targetSdkVersion="29" />

    <application android:testOnly="true">
        <uses-library android:name="android.test.runner" />
    </application>

    <instrumentation
        android:name="androidx.test.runner.AndroidJUnitRunner"
        android:targetPackage="com.android.bluetoothmidiservice.tests.unit"
        android:label="Bluetooth MIDI Service tests">
    </instrumentation>
</manifest>
Loading