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.content.Context;
20 import android.graphics.drawable.Drawable;
21 import android.media.MediaRoute2Info;
22 import android.media.MediaRouter2Manager;
23 import android.media.RouteListingPreference;
24 
25 import com.android.settingslib.R;
26 
27 /**
28  * ComplexMediaDevice extends MediaDevice to represents device with signals from a number of
29  * sources.
30  */
31 public class ComplexMediaDevice extends MediaDevice {
32 
33     private final String mSummary = "";
34 
ComplexMediaDevice(Context context, MediaRouter2Manager routerManager, MediaRoute2Info info, String packageName, RouteListingPreference.Item item)35     ComplexMediaDevice(Context context, MediaRouter2Manager routerManager,
36             MediaRoute2Info info, String packageName,
37             RouteListingPreference.Item item) {
38         super(context, routerManager, info, packageName, item);
39     }
40 
41     // MediaRoute2Info.getName was made public on API 34, but exists since API 30.
42     @SuppressWarnings("NewApi")
43     @Override
getName()44     public String getName() {
45         return mRouteInfo.getName().toString();
46     }
47 
48     @Override
getSummary()49     public String getSummary() {
50         return mSummary;
51     }
52 
53     @Override
getIcon()54     public Drawable getIcon() {
55         return mContext.getDrawable(R.drawable.ic_media_avr_device);
56     }
57 
58     @Override
getIconWithoutBackground()59     public Drawable getIconWithoutBackground() {
60         return mContext.getDrawable(R.drawable.ic_media_avr_device);
61     }
62 
63     @Override
getId()64     public String getId() {
65         return MediaDeviceUtils.getId(mRouteInfo);
66     }
67 
isConnected()68     public boolean isConnected() {
69         return true;
70     }
71 }
72