1 /* 2 * Copyright (C) 2024 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.systemui.volume.domain.model 18 19 import android.graphics.drawable.Drawable 20 import com.android.settingslib.bluetooth.CachedBluetoothDevice 21 22 /** Models an audio output device. */ 23 sealed interface AudioOutputDevice { 24 25 val name: String 26 val icon: Drawable? 27 28 /** Models a built audio output device. */ 29 data class BuiltIn( 30 override val name: String, 31 override val icon: Drawable?, 32 ) : AudioOutputDevice 33 34 /** Models a wired audio output device. */ 35 data class Wired( 36 override val name: String, 37 override val icon: Drawable?, 38 ) : AudioOutputDevice 39 40 /** Models a bluetooth audio output device. */ 41 data class Bluetooth( 42 override val name: String, 43 override val icon: Drawable?, 44 val cachedBluetoothDevice: CachedBluetoothDevice, 45 ) : AudioOutputDevice 46 47 /** Models a state when the current audio output device is unknown. */ 48 data object Unknown : AudioOutputDevice { 49 override val name: String 50 get() = error("Unsupported for unknown device") 51 52 override val icon: Drawable 53 get() = error("Unsupported for unknown device") 54 } 55 } 56