Show dialog on BT entries in Settings

- When satellite mode is switched on BT entries shall show the warning dialog and avoid user uses these functions.

Bug: 337154438
Test: Manual test.
Test: atest pass
Change-Id: Ic9b6d44731684d1cfba87570d72dcacb905a66d2
This commit is contained in:
tomhsu
2024-05-08 03:52:36 +00:00
parent 42b714f450
commit c8f52f816c
3 changed files with 89 additions and 0 deletions

View File

@@ -34,6 +34,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.AndroidRuntimeException;
import android.view.View;
import androidx.preference.PreferenceViewHolder;
@@ -101,6 +102,19 @@ public class BluetoothEnablerTest {
mShadowBluetoothAdapter = Shadow.extract(BluetoothAdapter.getDefaultAdapter());
}
@Test
public void onSwitchToggled_satelliteOn_showWarningDialog() {
mBluetoothEnabler.mIsSatelliteOn.set(true);
try {
mBluetoothEnabler.onSwitchToggled(true);
} catch (AndroidRuntimeException e) {
// Catch exception of starting activity .
}
verify(mContext).startActivity(any());
}
@Test
public void onSwitchToggled_shouldLogActionWithSuppliedEvent() {
// WHEN the switch is toggled...