Merge changes from topic "ha-new-pairing" into main
* changes: New hearing device pairing page (2/2): MFi devices New hearing device pairing page (1/2)
This commit is contained in:
@@ -32,6 +32,10 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.platform.test.annotations.RequiresFlagsDisabled;
|
||||
import android.platform.test.annotations.RequiresFlagsEnabled;
|
||||
import android.platform.test.flag.junit.CheckFlagsRule;
|
||||
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
@@ -43,6 +47,7 @@ import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.bluetooth.BluetoothPairingDetail;
|
||||
import com.android.settings.bluetooth.HearingAidPairingDialogFragment;
|
||||
import com.android.settings.bluetooth.Utils;
|
||||
import com.android.settings.flags.Flags;
|
||||
import com.android.settings.testutils.shadow.ShadowBluetoothAdapter;
|
||||
import com.android.settings.testutils.shadow.ShadowBluetoothUtils;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
@@ -77,6 +82,9 @@ public class HearingAidPairingDialogFragmentTest {
|
||||
@Rule
|
||||
public final MockitoRule mockito = MockitoJUnit.rule();
|
||||
|
||||
@Rule
|
||||
public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
|
||||
|
||||
private static final String TEST_DEVICE_ADDRESS = "00:A1:A1:A1:A1:A1";
|
||||
private static final int TEST_LAUNCH_PAGE = SettingsEnums.SETTINGS_CONNECTED_DEVICE_CATEGORY;
|
||||
|
||||
@@ -129,7 +137,22 @@ public class HearingAidPairingDialogFragmentTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dialogPositiveButtonClick_intentToA11yPairingPage() {
|
||||
@RequiresFlagsEnabled(Flags.FLAG_NEW_HEARING_DEVICE_PAIRING_PAGE)
|
||||
public void dialogPositiveButtonClick_intentToNewA11yPairingPage() {
|
||||
setupDialog(SettingsEnums.ACCESSIBILITY);
|
||||
final AlertDialog dialog = (AlertDialog) mFragment.onCreateDialog(Bundle.EMPTY);
|
||||
dialog.show();
|
||||
|
||||
dialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();
|
||||
|
||||
final Intent intent = shadowOf(mActivity).getNextStartedActivity();
|
||||
assertThat(intent.getStringExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT))
|
||||
.isEqualTo(HearingDevicePairingFragment.class.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
@RequiresFlagsDisabled(Flags.FLAG_NEW_HEARING_DEVICE_PAIRING_PAGE)
|
||||
public void dialogPositiveButtonClick_intentToOldA11yPairingPage() {
|
||||
setupDialog(SettingsEnums.ACCESSIBILITY);
|
||||
final AlertDialog dialog = (AlertDialog) mFragment.onCreateDialog(Bundle.EMPTY);
|
||||
dialog.show();
|
||||
|
@@ -0,0 +1,318 @@
|
||||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.accessibility;
|
||||
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothProfile;
|
||||
import android.bluetooth.BluetoothUuid;
|
||||
import android.bluetooth.le.ScanRecord;
|
||||
import android.bluetooth.le.ScanResult;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Pair;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
|
||||
import com.android.settings.bluetooth.BluetoothDevicePreference;
|
||||
import com.android.settings.bluetooth.BluetoothProgressCategory;
|
||||
import com.android.settings.testutils.shadow.ShadowBluetoothAdapter;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
|
||||
import com.android.settingslib.bluetooth.HearingAidInfo;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Spy;
|
||||
import org.mockito.junit.MockitoJUnit;
|
||||
import org.mockito.junit.MockitoRule;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** Tests for {@link HearingDevicePairingFragment}. */
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Config(shadows = {ShadowBluetoothAdapter.class})
|
||||
public class HearingDevicePairingFragmentTest {
|
||||
|
||||
private static final String TEST_DEVICE_ADDRESS = "00:A1:A1:A1:A1:A1";
|
||||
|
||||
@Rule
|
||||
public final MockitoRule mockito = MockitoJUnit.rule();
|
||||
|
||||
@Spy
|
||||
private final BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
@Spy
|
||||
private final HearingDevicePairingFragment mFragment = new TestHearingDevicePairingFragment();
|
||||
|
||||
@Mock
|
||||
private LocalBluetoothManager mLocalManager;
|
||||
@Mock
|
||||
private CachedBluetoothDeviceManager mCachedDeviceManager;
|
||||
@Mock
|
||||
private CachedBluetoothDevice mCachedDevice;
|
||||
@Mock
|
||||
private BluetoothProgressCategory mAvailableHearingDeviceGroup;
|
||||
|
||||
private final Context mContext = ApplicationProvider.getApplicationContext();
|
||||
private BluetoothDevice mDevice;
|
||||
private BluetoothDevicePreference mDevicePreference;
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mFragment.mLocalManager = mLocalManager;
|
||||
mFragment.mCachedDeviceManager = mCachedDeviceManager;
|
||||
mFragment.mBluetoothAdapter = mBluetoothAdapter;
|
||||
doReturn(mContext).when(mFragment).getContext();
|
||||
doReturn(mAvailableHearingDeviceGroup).when(mFragment).findPreference(
|
||||
"available_hearing_devices");
|
||||
mFragment.initPreferencesFromPreferenceScreen();
|
||||
|
||||
|
||||
mDevice = mBluetoothAdapter.getRemoteDevice(TEST_DEVICE_ADDRESS);
|
||||
doReturn(mDevice).when(mCachedDevice).getDevice();
|
||||
final Pair<Drawable, String> pair = new Pair<>(mock(Drawable.class), "test_device");
|
||||
doReturn(pair).when(mCachedDevice).getDrawableWithDescription();
|
||||
|
||||
mDevicePreference = new BluetoothDevicePreference(mContext, mCachedDevice, true,
|
||||
BluetoothDevicePreference.SortType.TYPE_DEFAULT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void startAndStopScanning_stateIsCorrect() {
|
||||
mFragment.startScanning();
|
||||
|
||||
verify(mFragment).startLeScanning();
|
||||
|
||||
mFragment.stopScanning();
|
||||
|
||||
verify(mFragment).stopLeScanning();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onDeviceDeleted_stateIsCorrect() {
|
||||
mFragment.mDevicePreferenceMap.put(mCachedDevice, mDevicePreference);
|
||||
|
||||
assertThat(mFragment.mDevicePreferenceMap).isNotEmpty();
|
||||
|
||||
mFragment.onDeviceDeleted(mCachedDevice);
|
||||
|
||||
assertThat(mFragment.mDevicePreferenceMap).isEmpty();
|
||||
verify(mAvailableHearingDeviceGroup).removePreference(mDevicePreference);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addDevice_bluetoothOff_doNothing() {
|
||||
doReturn(BluetoothAdapter.STATE_OFF).when(mBluetoothAdapter).getState();
|
||||
|
||||
assertThat(mFragment.mDevicePreferenceMap.size()).isEqualTo(0);
|
||||
|
||||
mFragment.addDevice(mCachedDevice);
|
||||
|
||||
verify(mAvailableHearingDeviceGroup, never()).addPreference(mDevicePreference);
|
||||
assertThat(mFragment.mDevicePreferenceMap.size()).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addDevice_addToAvailableHearingDeviceGroup() {
|
||||
doReturn(BluetoothAdapter.STATE_ON).when(mBluetoothAdapter).getState();
|
||||
|
||||
assertThat(mFragment.mDevicePreferenceMap.size()).isEqualTo(0);
|
||||
|
||||
mFragment.addDevice(mCachedDevice);
|
||||
|
||||
verify(mAvailableHearingDeviceGroup).addPreference(mDevicePreference);
|
||||
assertThat(mFragment.mDevicePreferenceMap.size()).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handleLeScanResult_markDeviceAsHearingAid() {
|
||||
ScanResult scanResult = mock(ScanResult.class);
|
||||
doReturn(mDevice).when(scanResult).getDevice();
|
||||
doReturn(mCachedDevice).when(mCachedDeviceManager).findDevice(mDevice);
|
||||
|
||||
mFragment.handleLeScanResult(scanResult);
|
||||
|
||||
verify(mCachedDevice).setHearingAidInfo(new HearingAidInfo.Builder().build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handleLeScanResult_isAndroidCompatible_addDevice() {
|
||||
ScanResult scanResult = mock(ScanResult.class);
|
||||
doReturn(mDevice).when(scanResult).getDevice();
|
||||
doReturn(mCachedDevice).when(mCachedDeviceManager).findDevice(mDevice);
|
||||
doReturn(true).when(mFragment).isAndroidCompatibleHearingAid(scanResult);
|
||||
|
||||
mFragment.handleLeScanResult(scanResult);
|
||||
|
||||
verify(mFragment).addDevice(mCachedDevice);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handleLeScanResult_isNotAndroidCompatible_() {
|
||||
ScanResult scanResult = mock(ScanResult.class);
|
||||
doReturn(mDevice).when(scanResult).getDevice();
|
||||
doReturn(mCachedDevice).when(mCachedDeviceManager).findDevice(mDevice);
|
||||
doReturn(false).when(mFragment).isAndroidCompatibleHearingAid(scanResult);
|
||||
|
||||
mFragment.handleLeScanResult(scanResult);
|
||||
|
||||
verify(mFragment).discoverServices(mCachedDevice);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onProfileConnectionStateChanged_deviceConnected_inSelectedList_finish() {
|
||||
doReturn(true).when(mCachedDevice).isConnected();
|
||||
mFragment.mSelectedDeviceList.add(mDevice);
|
||||
|
||||
mFragment.onProfileConnectionStateChanged(mCachedDevice, BluetoothAdapter.STATE_CONNECTED,
|
||||
BluetoothProfile.A2DP);
|
||||
|
||||
verify(mFragment).finish();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onProfileConnectionStateChanged_deviceConnected_notInSelectedList_deleteDevice() {
|
||||
doReturn(true).when(mCachedDevice).isConnected();
|
||||
|
||||
mFragment.onProfileConnectionStateChanged(mCachedDevice, BluetoothAdapter.STATE_CONNECTED,
|
||||
BluetoothProfile.A2DP);
|
||||
|
||||
verify(mFragment).removeDevice(mCachedDevice);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onProfileConnectionStateChanged_deviceNotConnected_doNothing() {
|
||||
doReturn(false).when(mCachedDevice).isConnected();
|
||||
|
||||
mFragment.onProfileConnectionStateChanged(mCachedDevice, BluetoothAdapter.STATE_CONNECTED,
|
||||
BluetoothProfile.A2DP);
|
||||
|
||||
verify(mFragment, never()).finish();
|
||||
verify(mFragment, never()).removeDevice(mCachedDevice);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onBluetoothStateChanged_stateOn_startScanningAndShowToast() {
|
||||
mFragment.onBluetoothStateChanged(BluetoothAdapter.STATE_ON);
|
||||
|
||||
verify(mFragment).startScanning();
|
||||
verify(mFragment).showBluetoothTurnedOnToast();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onBluetoothStateChanged_stateOff_finish() {
|
||||
mFragment.onBluetoothStateChanged(BluetoothAdapter.STATE_OFF);
|
||||
|
||||
verify(mFragment).finish();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onDeviceBondStateChanged_bonded_finish() {
|
||||
mFragment.onDeviceBondStateChanged(mCachedDevice, BluetoothDevice.BOND_BONDED);
|
||||
|
||||
verify(mFragment).finish();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onDeviceBondStateChanged_selectedDeviceNotBonded_startScanning() {
|
||||
mFragment.mSelectedDevice = mDevice;
|
||||
|
||||
mFragment.onDeviceBondStateChanged(mCachedDevice, BluetoothDevice.BOND_NONE);
|
||||
|
||||
verify(mFragment).startScanning();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAndroidCompatibleHearingAid_asha_returnTrue() {
|
||||
ScanResult scanResult = createAshaScanResult();
|
||||
|
||||
boolean isCompatible = mFragment.isAndroidCompatibleHearingAid(scanResult);
|
||||
|
||||
assertThat(isCompatible).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAndroidCompatibleHearingAid_has_returnTrue() {
|
||||
ScanResult scanResult = createHasScanResult();
|
||||
|
||||
boolean isCompatible = mFragment.isAndroidCompatibleHearingAid(scanResult);
|
||||
|
||||
assertThat(isCompatible).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAndroidCompatibleHearingAid_mfiHas_returnFalse() {
|
||||
ScanResult scanResult = createMfiHasScanResult();
|
||||
|
||||
boolean isCompatible = mFragment.isAndroidCompatibleHearingAid(scanResult);
|
||||
|
||||
assertThat(isCompatible).isFalse();
|
||||
}
|
||||
|
||||
private ScanResult createAshaScanResult() {
|
||||
ScanResult scanResult = mock(ScanResult.class);
|
||||
ScanRecord scanRecord = mock(ScanRecord.class);
|
||||
byte[] fakeAshaServiceData = new byte[] {
|
||||
0x09, 0x16, (byte) 0xf0, (byte) 0xfd, 0x01, 0x00, 0x01, 0x02, 0x03, 0x04};
|
||||
doReturn(scanRecord).when(scanResult).getScanRecord();
|
||||
doReturn(fakeAshaServiceData).when(scanRecord).getServiceData(BluetoothUuid.HEARING_AID);
|
||||
return scanResult;
|
||||
}
|
||||
|
||||
private ScanResult createHasScanResult() {
|
||||
ScanResult scanResult = mock(ScanResult.class);
|
||||
ScanRecord scanRecord = mock(ScanRecord.class);
|
||||
doReturn(scanRecord).when(scanResult).getScanRecord();
|
||||
doReturn(List.of(BluetoothUuid.HAS)).when(scanRecord).getServiceUuids();
|
||||
return scanResult;
|
||||
}
|
||||
|
||||
private ScanResult createMfiHasScanResult() {
|
||||
ScanResult scanResult = mock(ScanResult.class);
|
||||
ScanRecord scanRecord = mock(ScanRecord.class);
|
||||
byte[] fakeMfiServiceData = new byte[] {0x00, 0x00, 0x00, 0x00};
|
||||
doReturn(scanRecord).when(scanResult).getScanRecord();
|
||||
doReturn(fakeMfiServiceData).when(scanRecord).getServiceData(BluetoothUuid.MFI_HAS);
|
||||
return scanResult;
|
||||
}
|
||||
|
||||
private class TestHearingDevicePairingFragment extends HearingDevicePairingFragment {
|
||||
@Override
|
||||
protected Preference getCachedPreference(String key) {
|
||||
if (key.equals(TEST_DEVICE_ADDRESS)) {
|
||||
return mDevicePreference;
|
||||
}
|
||||
return super.getCachedPreference(key);
|
||||
}
|
||||
}
|
||||
}
|
@@ -15,34 +15,49 @@
|
||||
*/
|
||||
package com.android.settings.connecteddevice;
|
||||
|
||||
import static com.android.settings.accessibility.AccessibilityHearingAidsFragment.KEY_HEARING_DEVICE_ADD_BT_DEVICES;
|
||||
import static com.android.settings.core.BasePreferenceController.AVAILABLE;
|
||||
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.robolectric.Shadows.shadowOf;
|
||||
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.platform.test.annotations.RequiresFlagsDisabled;
|
||||
import android.platform.test.annotations.RequiresFlagsEnabled;
|
||||
import android.platform.test.flag.junit.CheckFlagsRule;
|
||||
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.accessibility.HearingDevicePairingDetail;
|
||||
import com.android.settings.accessibility.HearingDevicePairingFragment;
|
||||
import com.android.settings.flags.Flags;
|
||||
import com.android.settingslib.RestrictedPreference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.mockito.Spy;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.Shadows;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.shadows.ShadowApplicationPackageManager;
|
||||
import org.robolectric.util.ReflectionHelpers;
|
||||
@@ -51,12 +66,16 @@ import org.robolectric.util.ReflectionHelpers;
|
||||
@Config(shadows = ShadowApplicationPackageManager.class)
|
||||
public class AddDevicePreferenceControllerTest {
|
||||
|
||||
@Rule
|
||||
public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
|
||||
|
||||
@Mock
|
||||
private PreferenceScreen mScreen;
|
||||
@Mock
|
||||
private BluetoothAdapter mBluetoothAdapter;
|
||||
|
||||
private Context mContext;
|
||||
@Spy
|
||||
private Context mContext = ApplicationProvider.getApplicationContext();
|
||||
private AddDevicePreferenceController mAddDevicePreferenceController;
|
||||
private RestrictedPreference mAddDevicePreference;
|
||||
private ShadowApplicationPackageManager mPackageManager;
|
||||
@@ -66,8 +85,7 @@ public class AddDevicePreferenceControllerTest {
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mPackageManager = (ShadowApplicationPackageManager) Shadows.shadowOf(
|
||||
mPackageManager = (ShadowApplicationPackageManager) shadowOf(
|
||||
mContext.getPackageManager());
|
||||
mPackageManager.setSystemFeature(PackageManager.FEATURE_BLUETOOTH, true);
|
||||
|
||||
@@ -82,6 +100,8 @@ public class AddDevicePreferenceControllerTest {
|
||||
when(mBluetoothAdapter.isEnabled()).thenReturn(true);
|
||||
when(mScreen.findPreference(key)).thenReturn(mAddDevicePreference);
|
||||
mAddDevicePreferenceController.displayPreference(mScreen);
|
||||
|
||||
doNothing().when(mContext).startActivity(any(Intent.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -137,4 +157,30 @@ public class AddDevicePreferenceControllerTest {
|
||||
assertThat(mAddDevicePreferenceController.getAvailabilityStatus())
|
||||
.isEqualTo(UNSUPPORTED_ON_DEVICE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@RequiresFlagsEnabled(Flags.FLAG_NEW_HEARING_DEVICE_PAIRING_PAGE)
|
||||
public void handlePreferenceClick_A11yPreference_redirectToNewPairingPage() {
|
||||
mAddDevicePreference.setKey(KEY_HEARING_DEVICE_ADD_BT_DEVICES);
|
||||
final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
|
||||
|
||||
mAddDevicePreferenceController.handlePreferenceTreeClick(mAddDevicePreference);
|
||||
|
||||
verify(mContext).startActivity(intentCaptor.capture());
|
||||
assertThat(intentCaptor.getValue().getStringExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT))
|
||||
.isEqualTo(HearingDevicePairingFragment.class.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
@RequiresFlagsDisabled(Flags.FLAG_NEW_HEARING_DEVICE_PAIRING_PAGE)
|
||||
public void handlePreferenceClick_A11yPreference_redirectToOldPairingPage() {
|
||||
mAddDevicePreference.setKey(KEY_HEARING_DEVICE_ADD_BT_DEVICES);
|
||||
final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
|
||||
|
||||
mAddDevicePreferenceController.handlePreferenceTreeClick(mAddDevicePreference);
|
||||
|
||||
verify(mContext).startActivity(intentCaptor.capture());
|
||||
assertThat(intentCaptor.getValue().getStringExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT))
|
||||
.isEqualTo(HearingDevicePairingDetail.class.getName());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user