1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.settingslib.media;
18 
19 import android.annotation.NonNull;
20 import android.annotation.Nullable;
21 import android.content.Context;
22 import android.graphics.drawable.Drawable;
23 import android.media.MediaRoute2Info;
24 import android.media.RouteListingPreference;
25 
26 import com.android.settingslib.R;
27 
28 /**
29  * ComplexMediaDevice extends MediaDevice to represents device with signals from a number of
30  * sources.
31  */
32 public class ComplexMediaDevice extends MediaDevice {
33 
34     private final String mSummary = "";
35 
ComplexMediaDevice( @onNull Context context, @NonNull MediaRoute2Info info, @Nullable RouteListingPreference.Item item)36     ComplexMediaDevice(
37             @NonNull Context context,
38             @NonNull MediaRoute2Info info,
39             @Nullable RouteListingPreference.Item item) {
40         super(context, info, item);
41     }
42 
43     // MediaRoute2Info.getName was made public on API 34, but exists since API 30.
44     @SuppressWarnings("NewApi")
45     @Override
getName()46     public String getName() {
47         return mRouteInfo.getName().toString();
48     }
49 
50     @Override
getSummary()51     public String getSummary() {
52         return mSummary;
53     }
54 
55     @Override
getIcon()56     public Drawable getIcon() {
57         return mContext.getDrawable(R.drawable.ic_media_avr_device);
58     }
59 
60     @Override
getIconWithoutBackground()61     public Drawable getIconWithoutBackground() {
62         return mContext.getDrawable(R.drawable.ic_media_avr_device);
63     }
64 
65     @Override
getId()66     public String getId() {
67         return mRouteInfo.getId();
68     }
69 
isConnected()70     public boolean isConnected() {
71         return true;
72     }
73 }
74