Merge "Show dialog on BT entries in Settings" into main

This commit is contained in:
Tom Hsu
2024-05-09 06:54:11 +00:00
committed by Android (Google) Code Review
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...