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.interactor 18 19 import android.content.Context 20 import android.util.FeatureFlagUtils 21 import com.android.systemui.dagger.qualifiers.Application 22 import com.android.systemui.volume.domain.model.VolumePanelRoute 23 import com.android.systemui.volume.panel.shared.flag.VolumePanelFlag 24 import javax.inject.Inject 25 26 /** Provides navigation routes for Volume space. */ 27 class VolumePanelNavigationInteractor 28 @Inject 29 constructor( 30 @Application private val context: Context, 31 private val volumePanelFlag: VolumePanelFlag, 32 ) { 33 getVolumePanelRoutenull34 fun getVolumePanelRoute(): VolumePanelRoute { 35 return when { 36 volumePanelFlag.canUseNewVolumePanel() -> VolumePanelRoute.COMPOSE_VOLUME_PANEL 37 FeatureFlagUtils.isEnabled( 38 context, 39 FeatureFlagUtils.SETTINGS_VOLUME_PANEL_IN_SYSTEMUI 40 ) -> VolumePanelRoute.SYSTEM_UI_VOLUME_PANEL 41 else -> VolumePanelRoute.SETTINGS_VOLUME_PANEL 42 } 43 } 44 } 45