Redirect user to original pairing page from pair dialog
After pairing ASHA devices from "Hearing devices", the pair another dialog will bring user to the "Connected devices" pairing page. We should redirect user to "Hearing devices" pairing page if user is pairing their devices from A11y hearing devices page. Bug: 295713308 Test: atest HearingAidPairingDialogFragmentTest Test: manually connect an ASHA device and check the redirect page Change-Id: Ia18e53a85e2b21a17e7a843d8979917c8c468e09
This commit is contained in:
@@ -38,9 +38,10 @@ public final class HearingAidUtils {
|
||||
*
|
||||
* @param fragmentManager The {@link FragmentManager} used to show dialog fragment
|
||||
* @param device The {@link CachedBluetoothDevice} need to be hearing aid device
|
||||
* @param launchPage The page id where the dialog is launched
|
||||
*/
|
||||
public static void launchHearingAidPairingDialog(FragmentManager fragmentManager,
|
||||
@NonNull CachedBluetoothDevice device) {
|
||||
@NonNull CachedBluetoothDevice device, int launchPage) {
|
||||
// No need to show the pair another ear dialog if the device supports and enables CSIP.
|
||||
// CSIP will pair other devices in the same set automatically.
|
||||
if (isCsipSupportedAndEnabled(device)) {
|
||||
@@ -49,18 +50,18 @@ public final class HearingAidUtils {
|
||||
if (device.isConnectedAshaHearingAidDevice()
|
||||
&& device.getDeviceMode() == HearingAidInfo.DeviceMode.MODE_BINAURAL
|
||||
&& device.getSubDevice() == null) {
|
||||
launchHearingAidPairingDialogInternal(fragmentManager, device);
|
||||
launchHearingAidPairingDialogInternal(fragmentManager, device, launchPage);
|
||||
}
|
||||
}
|
||||
|
||||
private static void launchHearingAidPairingDialogInternal(FragmentManager fragmentManager,
|
||||
@NonNull CachedBluetoothDevice device) {
|
||||
@NonNull CachedBluetoothDevice device, int launchPage) {
|
||||
if (device.getDeviceSide() == HearingAidInfo.DeviceSide.SIDE_INVALID) {
|
||||
Log.w(TAG, "Can not launch hearing aid pairing dialog for invalid side");
|
||||
return;
|
||||
}
|
||||
HearingAidPairingDialogFragment.newInstance(device.getAddress()).show(fragmentManager,
|
||||
HearingAidPairingDialogFragment.TAG);
|
||||
HearingAidPairingDialogFragment.newInstance(device.getAddress(), launchPage)
|
||||
.show(fragmentManager, HearingAidPairingDialogFragment.TAG);
|
||||
}
|
||||
|
||||
private static boolean isCsipSupportedAndEnabled(@NonNull CachedBluetoothDevice device) {
|
||||
|
||||
Reference in New Issue
Block a user