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

Commit f46291b7 authored by Santiago Seifert's avatar Santiago Seifert
Browse files

Add test for AudioPoliciesDeviceRouteController

The new test is in a media routing specific directory
in order to add the new module to the pre and post
submit of the media routing related code.

Bug: 305199571
Test: atest AudioPoliciesDeviceRouteControllerTest
Change-Id: I0f447d3295c7e1665c5557e1448e440bb3039610
parent dc5d527d
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import android.annotation.RequiresPermission;
import android.annotation.TestApi;
import android.util.SparseIntArray;

import com.android.internal.annotations.VisibleForTesting;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;
@@ -402,7 +404,9 @@ public final class AudioDeviceInfo {

    private final AudioDevicePort mPort;

    AudioDeviceInfo(AudioDevicePort port) {
    /** @hide */
    @VisibleForTesting
    public AudioDeviceInfo(AudioDevicePort port) {
       mPort = port;
    }

+22 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;

import com.android.aconfig.annotations.VisibleForTesting;

import java.util.Arrays;
import java.util.List;

@@ -38,6 +40,26 @@ import java.util.List;

public class AudioDevicePort extends AudioPort {

    /** @hide */
    // TODO: b/316864909 - Remove this method once there's a way to fake audio device ports further
    // down the stack.
    @VisibleForTesting
    public static AudioDevicePort createForTesting(
            int type, @NonNull String name, @NonNull String address) {
        return new AudioDevicePort(
                new AudioHandle(/* id= */ 0),
                name,
                /* samplingRates= */ null,
                /* channelMasks= */ null,
                /* channelIndexMasks= */ null,
                /* formats= */ null,
                /* gains= */ null,
                type,
                address,
                /* encapsulationModes= */ null,
                /* encapsulationMetadataTypes= */ null);
    }

    private final int mType;
    private final String mAddress;
    private final int[] mEncapsulationModes;
+2 −0
Original line number Diff line number Diff line
# Bug component: 137631
include platform/frameworks/av:/media/janitors/media_solutions_OWNERS
+39 −0
Original line number Diff line number Diff line
package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "frameworks_base_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["frameworks_base_license"],
}

android_test {
    name: "MediaRouterServiceTests",
    srcs: [
        "src/**/*.java",
    ],

    static_libs: [
        "androidx.test.core",
        "androidx.test.rules",
        "androidx.test.runner",
        "compatibility-device-util-axt",
        "junit",
        "platform-test-annotations",
        "services.core",
        "truth",
    ],

    platform_apis: true,

    test_suites: [
        // "device-tests",
        "general-tests",
    ],

    certificate: "platform",
    dxflags: ["--multi-dex"],
    optimize: {
        enabled: false,
    },
}
+30 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2023 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.server.media.tests">

    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
    <uses-permission android:name="android.permission.MODIFY_AUDIO_ROUTING" />

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

    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.server.media.tests"
         android:label="Frameworks Services Tests"/>
</manifest>
Loading