Rename BluetoothTileDialogViewModel to BluetoothDetailsContentViewModel
Test: BluetoothDetailsContentManagerTest, BluetoothTileDialogDelegateTest, BluetoothDetailsContentViewModelTest, BluetoothTileTest
Flag: NONE rename file only
Change-Id: Iba92aa095c9e957acec5d8a2ab9a1893cc5f49d3
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
index 744388f..63c2fb9 100644
--- a/packages/SystemUI/Android.bp
+++ b/packages/SystemUI/Android.bp
@@ -313,11 +313,11 @@
"tests/src/**/systemui/temporarydisplay/TemporaryViewDisplayControllerTest.kt",
"tests/src/**/systemui/statusbar/policy/WalletControllerImplTest.kt",
"tests/src/**/keyguard/ClockEventControllerTest.kt",
- "tests/src/**/systemui/bluetooth/qsdialog/BluetoothStateInteractorTest.kt",
"tests/src/**/systemui/bluetooth/qsdialog/BluetoothDetailsContentManagerTest.kt",
+ "tests/src/**/systemui/bluetooth/qsdialog/BluetoothDetailsContentViewModelTest.kt",
+ "tests/src/**/systemui/bluetooth/qsdialog/BluetoothStateInteractorTest.kt",
"tests/src/**/systemui/bluetooth/qsdialog/BluetoothTileDialogDelegateTest.kt",
"tests/src/**/systemui/bluetooth/qsdialog/BluetoothTileDialogRepositoryTest.kt",
- "tests/src/**/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModelTest.kt",
"tests/src/**/systemui/bluetooth/qsdialog/DeviceItemFactoryTest.kt",
"tests/src/**/systemui/bluetooth/qsdialog/DeviceItemInteractorTest.kt",
"tests/src/**/systemui/broadcast/UserBroadcastDispatcherTest.kt",
diff --git a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContent.kt b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContent.kt
index 710fde5..c664456 100644
--- a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContent.kt
+++ b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContent.kt
@@ -24,7 +24,7 @@
import com.android.systemui.res.R
@Composable
-fun BluetoothDetailsContent(detailsContentViewModel: BluetoothTileDialogViewModel) {
+fun BluetoothDetailsContent(detailsContentViewModel: BluetoothDetailsContentViewModel) {
AndroidView(
modifier = Modifier.fillMaxSize(),
factory = { context ->
diff --git a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentManager.kt b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentManager.kt
index d873f41..eebcf0b 100644
--- a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentManager.kt
@@ -62,7 +62,7 @@
class BluetoothDetailsContentManager
@AssistedInject
constructor(
- @Assisted private val initialUiProperties: BluetoothTileDialogViewModel.UiProperties,
+ @Assisted private val initialUiProperties: BluetoothDetailsContentViewModel.UiProperties,
@Assisted private val cachedContentHeight: Int,
@Assisted private val bluetoothTileDialogCallback: BluetoothTileDialogCallback,
@Assisted private val isInDialog: Boolean,
@@ -114,7 +114,7 @@
@AssistedFactory
interface Factory {
fun create(
- initialUiProperties: BluetoothTileDialogViewModel.UiProperties,
+ initialUiProperties: BluetoothDetailsContentViewModel.UiProperties,
cachedContentHeight: Int,
dialogCallback: BluetoothTileDialogCallback,
isInDialog: Boolean,
@@ -226,7 +226,7 @@
internal fun onBluetoothStateUpdated(
isEnabled: Boolean,
- uiProperties: BluetoothTileDialogViewModel.UiProperties,
+ uiProperties: BluetoothDetailsContentViewModel.UiProperties,
) {
bluetoothToggle.apply {
isChecked = isEnabled
diff --git a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModel.kt b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentViewModel.kt
similarity index 98%
rename from packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModel.kt
rename to packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentViewModel.kt
index 308c9d1..ff2d9ef 100644
--- a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentViewModel.kt
@@ -61,12 +61,9 @@
/**
* ViewModel for Bluetooth Dialog or Bluetooth Details View after clicking on the Bluetooth QS tile.
- *
- * TODO: b/378513956 Rename this class to BluetoothDetailsContentViewModel, since it's not only used
- * by the dialog view.
*/
@SysUISingleton
-class BluetoothTileDialogViewModel
+class BluetoothDetailsContentViewModel
@Inject
constructor(
private val deviceItemInteractor: DeviceItemInteractor,
@@ -312,7 +309,7 @@
return bluetoothDialogDelegateFactory.create(
getUiProperties(),
getCachedContentHeight(),
- this@BluetoothTileDialogViewModel,
+ this@BluetoothDetailsContentViewModel,
{ cancelJob() },
)
}
@@ -321,7 +318,7 @@
return bluetoothDetailsContentManagerFactory.create(
getUiProperties(),
getCachedContentHeight(),
- this@BluetoothTileDialogViewModel,
+ this@BluetoothDetailsContentViewModel,
/* isInDialog= */ false,
/* doneButtonCallback= */ fun() {},
)
diff --git a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsViewModel.kt b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsViewModel.kt
index 4447531..5863a93 100644
--- a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsViewModel.kt
@@ -20,7 +20,7 @@
class BluetoothDetailsViewModel(
private val onSettingsClick: () -> Unit,
- val detailsContentViewModel: BluetoothTileDialogViewModel,
+ val detailsContentViewModel: BluetoothDetailsContentViewModel,
) : TileDetailsViewModel() {
override fun clickOnSettingsButton() {
onSettingsClick()
diff --git a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogDelegate.kt b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogDelegate.kt
index 01be820..c55f605 100644
--- a/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogDelegate.kt
+++ b/packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogDelegate.kt
@@ -32,7 +32,7 @@
class BluetoothTileDialogDelegate
@AssistedInject
constructor(
- @Assisted private val initialUiProperties: BluetoothTileDialogViewModel.UiProperties,
+ @Assisted private val initialUiProperties: BluetoothDetailsContentViewModel.UiProperties,
@Assisted private val cachedContentHeight: Int,
@Assisted private val bluetoothTileDialogCallback: BluetoothTileDialogCallback,
@Assisted private val dismissListener: Runnable,
@@ -48,7 +48,7 @@
@AssistedFactory
interface Factory {
fun create(
- initialUiProperties: BluetoothTileDialogViewModel.UiProperties,
+ initialUiProperties: BluetoothDetailsContentViewModel.UiProperties,
cachedContentHeight: Int,
dialogCallback: BluetoothTileDialogCallback,
dimissListener: Runnable,
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java
index 973265c..fd5861f 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java
@@ -43,8 +43,8 @@
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.satellite.SatelliteDialogUtils;
import com.android.systemui.animation.Expandable;
+import com.android.systemui.bluetooth.qsdialog.BluetoothDetailsContentViewModel;
import com.android.systemui.bluetooth.qsdialog.BluetoothDetailsViewModel;
-import com.android.systemui.bluetooth.qsdialog.BluetoothTileDialogViewModel;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.flags.FeatureFlags;
@@ -84,7 +84,7 @@
private final Executor mExecutor;
- private final BluetoothTileDialogViewModel mDialogViewModel;
+ private final BluetoothDetailsContentViewModel mDetailsContentViewModel;
private final FeatureFlags mFeatureFlags;
@Nullable
@@ -104,7 +104,7 @@
QSLogger qsLogger,
BluetoothController bluetoothController,
FeatureFlags featureFlags,
- BluetoothTileDialogViewModel dialogViewModel
+ BluetoothDetailsContentViewModel detailsContentViewModel
) {
super(host, uiEventLogger, backgroundLooper, mainHandler, falsingManager, metricsLogger,
statusBarStateController, activityStarter, qsLogger);
@@ -112,7 +112,7 @@
mController.observe(getLifecycle(), mCallback);
mExecutor = new HandlerExecutor(mainHandler);
mFeatureFlags = featureFlags;
- mDialogViewModel = dialogViewModel;
+ mDetailsContentViewModel = detailsContentViewModel;
}
@Override
@@ -133,7 +133,7 @@
callback.accept(new BluetoothDetailsViewModel(() -> {
longClick(null);
return null;
- }, mDialogViewModel))
+ }, mDetailsContentViewModel))
);
return true;
}
@@ -158,7 +158,7 @@
private void handleClickEvent(@Nullable Expandable expandable) {
if (mFeatureFlags.isEnabled(Flags.BLUETOOTH_QS_TILE_DIALOG)) {
- mDialogViewModel.showDetailsContent(expandable, /* view= */ null);
+ mDetailsContentViewModel.showDetailsContent(expandable, /* view= */ null);
} else {
// Secondary clicks are header clicks, just toggle.
toggleBluetooth();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentManagerTest.kt
index 6ed990d..9c93269 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentManagerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentManagerTest.kt
@@ -87,7 +87,7 @@
private val fakeSystemClock = FakeSystemClock()
private val uiProperties =
- BluetoothTileDialogViewModel.UiProperties.build(
+ BluetoothDetailsContentViewModel.UiProperties.build(
isBluetoothEnabled = ENABLED,
isAutoOnToggleFeatureAvailable = ENABLED,
)
@@ -314,7 +314,7 @@
val cachedHeight = Int.MAX_VALUE
val contentManager =
BluetoothDetailsContentManager(
- BluetoothTileDialogViewModel.UiProperties.build(ENABLED, ENABLED),
+ BluetoothDetailsContentViewModel.UiProperties.build(ENABLED, ENABLED),
cachedHeight,
bluetoothTileDialogCallback,
/* isInDialog= */ true,
@@ -339,7 +339,7 @@
testScope.runTest {
val contentManager =
BluetoothDetailsContentManager(
- BluetoothTileDialogViewModel.UiProperties.build(ENABLED, ENABLED),
+ BluetoothDetailsContentViewModel.UiProperties.build(ENABLED, ENABLED),
MATCH_PARENT,
bluetoothTileDialogCallback,
/* isInDialog= */ true,
@@ -364,7 +364,7 @@
testScope.runTest {
val contentManager =
BluetoothDetailsContentManager(
- BluetoothTileDialogViewModel.UiProperties.build(ENABLED, ENABLED),
+ BluetoothDetailsContentViewModel.UiProperties.build(ENABLED, ENABLED),
MATCH_PARENT,
bluetoothTileDialogCallback,
/* isInDialog= */ true,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentViewModelTest.kt
similarity index 90%
rename from packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModelTest.kt
rename to packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentViewModelTest.kt
index 47a834b..bfc5361 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothDetailsContentViewModelTest.kt
@@ -67,14 +67,14 @@
@RunWith(AndroidJUnit4::class)
@TestableLooper.RunWithLooper(setAsMainLooper = true)
@EnableFlags(Flags.FLAG_BLUETOOTH_QS_TILE_DIALOG_AUTO_ON_TOGGLE)
-class BluetoothTileDialogViewModelTest : SysuiTestCase() {
+class BluetoothDetailsContentViewModelTest : SysuiTestCase() {
@get:Rule val mockitoRule: MockitoRule = MockitoJUnit.rule()
private val kosmos = testKosmos()
private val fakeSystemClock = FakeSystemClock()
private val backgroundExecutor = FakeExecutor(fakeSystemClock)
- private lateinit var bluetoothTileDialogViewModel: BluetoothTileDialogViewModel
+ private lateinit var bluetoothDetailsContentViewModel: BluetoothDetailsContentViewModel
@Mock private lateinit var bluetoothDeviceMetadataInteractor: BluetoothDeviceMetadataInteractor
@@ -126,8 +126,8 @@
testScope = kosmos.testScope
// TODO(b/364515243): use real object instead of mock
whenever(kosmos.deviceItemInteractor.deviceItemUpdate).thenReturn(MutableSharedFlow())
- bluetoothTileDialogViewModel =
- BluetoothTileDialogViewModel(
+ bluetoothDetailsContentViewModel =
+ BluetoothDetailsContentViewModel(
deviceItemInteractor,
deviceItemActionInteractor,
BluetoothStateInteractor(
@@ -194,7 +194,7 @@
@Test
fun testShowDetailsContent_noAnimation() {
testScope.runTest {
- bluetoothTileDialogViewModel.showDetailsContent(null, null)
+ bluetoothDetailsContentViewModel.showDetailsContent(null, null)
runCurrent()
verify(mDialogTransitionAnimator, never()).show(any(), any(), any())
@@ -204,7 +204,7 @@
@Test
fun testShowDetailsContent_animated() {
testScope.runTest {
- bluetoothTileDialogViewModel.showDetailsContent(expandable, null)
+ bluetoothDetailsContentViewModel.showDetailsContent(expandable, null)
runCurrent()
verify(mDialogTransitionAnimator).show(any(), any(), anyBoolean())
@@ -214,7 +214,7 @@
@Test
fun testShowDetailsContent_animated_inDetailsView() {
testScope.runTest {
- bluetoothTileDialogViewModel.showDetailsContent(expandable, mockView)
+ bluetoothDetailsContentViewModel.showDetailsContent(expandable, mockView)
runCurrent()
verify(bluetoothDetailsContentManager).bind(mockView)
@@ -226,7 +226,7 @@
fun testShowDetailsContent_animated_callInBackgroundThread() {
testScope.runTest {
backgroundExecutor.execute {
- bluetoothTileDialogViewModel.showDetailsContent(expandable, null)
+ bluetoothDetailsContentViewModel.showDetailsContent(expandable, null)
runCurrent()
verify(mDialogTransitionAnimator).show(any(), any(), anyBoolean())
@@ -238,7 +238,7 @@
fun testShowDetailsContent_animated_callInBackgroundThread_inDetailsView() {
testScope.runTest {
backgroundExecutor.execute {
- bluetoothTileDialogViewModel.showDetailsContent(expandable, mockView)
+ bluetoothDetailsContentViewModel.showDetailsContent(expandable, mockView)
runCurrent()
verify(bluetoothDetailsContentManager).bind(mockView)
@@ -250,7 +250,7 @@
@Test
fun testShowDetailsContent_fetchDeviceItem() {
testScope.runTest {
- bluetoothTileDialogViewModel.showDetailsContent(null, null)
+ bluetoothDetailsContentViewModel.showDetailsContent(null, null)
runCurrent()
verify(deviceItemInteractor).deviceItemUpdate
@@ -261,11 +261,11 @@
fun testStartSettingsActivity_activityLaunched_dialogDismissed() {
testScope.runTest {
whenever(deviceItem.cachedBluetoothDevice).thenReturn(cachedBluetoothDevice)
- bluetoothTileDialogViewModel.showDetailsContent(null, null)
+ bluetoothDetailsContentViewModel.showDetailsContent(null, null)
runCurrent()
val clickedView = View(context)
- bluetoothTileDialogViewModel.onPairNewDeviceClicked(clickedView)
+ bluetoothDetailsContentViewModel.onPairNewDeviceClicked(clickedView)
verify(uiEventLogger).log(BluetoothTileDialogUiEvent.PAIR_NEW_DEVICE_CLICKED)
verify(activityStarter).postStartActivityDismissingKeyguard(any(), anyInt(), nullable())
@@ -276,7 +276,7 @@
fun testBuildUiProperties_bluetoothOn_shouldHideAutoOn() {
testScope.runTest {
val actual =
- BluetoothTileDialogViewModel.UiProperties.build(
+ BluetoothDetailsContentViewModel.UiProperties.build(
isBluetoothEnabled = true,
isAutoOnToggleFeatureAvailable = true,
)
@@ -288,7 +288,7 @@
fun testBuildUiProperties_bluetoothOff_shouldShowAutoOn() {
testScope.runTest {
val actual =
- BluetoothTileDialogViewModel.UiProperties.build(
+ BluetoothDetailsContentViewModel.UiProperties.build(
isBluetoothEnabled = false,
isAutoOnToggleFeatureAvailable = true,
)
@@ -300,7 +300,7 @@
fun testBuildUiProperties_bluetoothOff_autoOnFeatureUnavailable_shouldHideAutoOn() {
testScope.runTest {
val actual =
- BluetoothTileDialogViewModel.UiProperties.build(
+ BluetoothDetailsContentViewModel.UiProperties.build(
isBluetoothEnabled = false,
isAutoOnToggleFeatureAvailable = false,
)
@@ -313,7 +313,7 @@
testScope.runTest {
whenever(bluetoothAdapter.isAutoOnSupported).thenReturn(true)
- val actual = bluetoothTileDialogViewModel.isAutoOnToggleFeatureAvailable()
+ val actual = bluetoothDetailsContentViewModel.isAutoOnToggleFeatureAvailable()
assertThat(actual).isTrue()
}
}
@@ -323,7 +323,7 @@
testScope.runTest {
whenever(bluetoothAdapter.isAutoOnSupported).thenReturn(false)
- val actual = bluetoothTileDialogViewModel.isAutoOnToggleFeatureAvailable()
+ val actual = bluetoothDetailsContentViewModel.isAutoOnToggleFeatureAvailable()
assertThat(actual).isFalse()
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogDelegateTest.kt b/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogDelegateTest.kt
index 2788f1d..7f75b8f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogDelegateTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogDelegateTest.kt
@@ -80,7 +80,7 @@
@Mock private lateinit var dialogTransitionAnimator: DialogTransitionAnimator
private val uiProperties =
- BluetoothTileDialogViewModel.UiProperties.build(
+ BluetoothDetailsContentViewModel.UiProperties.build(
isBluetoothEnabled = ENABLED,
isAutoOnToggleFeatureAvailable = ENABLED,
)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/BluetoothTileTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/BluetoothTileTest.kt
index 1305b0c..cfe34f4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/BluetoothTileTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/BluetoothTileTest.kt
@@ -16,7 +16,7 @@
import com.android.settingslib.Utils
import com.android.settingslib.bluetooth.CachedBluetoothDevice
import com.android.systemui.SysuiTestCase
-import com.android.systemui.bluetooth.qsdialog.BluetoothTileDialogViewModel
+import com.android.systemui.bluetooth.qsdialog.BluetoothDetailsContentViewModel
import com.android.systemui.classifier.FalsingManagerFake
import com.android.systemui.flags.FeatureFlagsClassic
import com.android.systemui.plugins.ActivityStarter
@@ -71,7 +71,7 @@
@Mock private lateinit var bluetoothController: BluetoothController
@Mock private lateinit var uiEventLogger: QsEventLogger
@Mock private lateinit var featureFlags: FeatureFlagsClassic
- @Mock private lateinit var bluetoothTileDialogViewModel: BluetoothTileDialogViewModel
+ @Mock private lateinit var bluetoothDetailsContentViewModel: BluetoothDetailsContentViewModel
@Mock private lateinit var clickJob: Job
private lateinit var testableLooper: TestableLooper
private lateinit var tile: FakeBluetoothTile
@@ -96,7 +96,7 @@
qsLogger,
bluetoothController,
featureFlags,
- bluetoothTileDialogViewModel,
+ bluetoothDetailsContentViewModel,
)
tile.initialize()
@@ -238,7 +238,7 @@
tile.handleClick(null)
- verify(bluetoothTileDialogViewModel)
+ verify(bluetoothDetailsContentViewModel)
.showDetailsContent(/* expandable= */ null, /* view= */ null)
}
@@ -308,7 +308,7 @@
qsLogger: QSLogger,
bluetoothController: BluetoothController,
featureFlags: FeatureFlagsClassic,
- bluetoothTileDialogViewModel: BluetoothTileDialogViewModel,
+ bluetoothDetailsContentViewModel: BluetoothDetailsContentViewModel,
) :
BluetoothTile(
qsHost,
@@ -322,7 +322,7 @@
qsLogger,
bluetoothController,
featureFlags,
- bluetoothTileDialogViewModel,
+ bluetoothDetailsContentViewModel,
) {
var restrictionChecked: String? = null