Remove the gear icon and change tapping event
* For fix the conflicts in pi-dev, cherry pick the ag/3944480 in master and merge the conflict. * Remove the gear icon in "currently connected" section. * Change the tapping event in "currently connected" section. When tapping device in this section, take user to device detail page. * Add test to verify when ConnectedBluetoothDeviceUpdater add preference the shouldHideSecondTarget() is return true. Bug: 78490845 Test: make -j40 RunSettingsRoboTests Change-Id: I25f8455def3c38e24dea9af9e9e29ba37c250f67
This commit is contained in:
@@ -56,29 +56,14 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
|
||||
protected final DevicePreferenceCallback mDevicePreferenceCallback;
|
||||
protected final Map<BluetoothDevice, Preference> mPreferenceMap;
|
||||
protected Context mPrefContext;
|
||||
protected DashboardFragment mFragment;
|
||||
|
||||
private final boolean mShowDeviceWithoutNames;
|
||||
private DashboardFragment mFragment;
|
||||
private Preference.OnPreferenceClickListener mDevicePreferenceClickListener = null;
|
||||
|
||||
@VisibleForTesting
|
||||
final GearPreference.OnGearClickListener mDeviceProfilesListener = pref -> {
|
||||
final CachedBluetoothDevice device =
|
||||
((BluetoothDevicePreference) pref).getBluetoothDevice();
|
||||
if (device == null) {
|
||||
return;
|
||||
}
|
||||
final Bundle args = new Bundle();
|
||||
args.putString(BluetoothDeviceDetailsFragment.KEY_DEVICE_ADDRESS,
|
||||
device.getDevice().getAddress());
|
||||
|
||||
new SubSettingLauncher(mFragment.getContext())
|
||||
.setDestination(BluetoothDeviceDetailsFragment.class.getName())
|
||||
.setArguments(args)
|
||||
.setTitle(R.string.device_details_title)
|
||||
.setSourceMetricsCategory(mFragment.getMetricsCategory())
|
||||
.launch();
|
||||
|
||||
launchDeviceDetails(pref);
|
||||
};
|
||||
|
||||
private class PreferenceClickListener implements
|
||||
@@ -201,7 +186,7 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
|
||||
public abstract boolean isFilterMatched(CachedBluetoothDevice cachedBluetoothDevice);
|
||||
|
||||
/**
|
||||
* Update whether to show {@cde cachedBluetoothDevice} in the list.
|
||||
* Update whether to show {@link CachedBluetoothDevice} in the list.
|
||||
*/
|
||||
protected void update(CachedBluetoothDevice cachedBluetoothDevice) {
|
||||
if (isFilterMatched(cachedBluetoothDevice)) {
|
||||
@@ -239,6 +224,28 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get {@link CachedBluetoothDevice} from {@link Preference} and it is used to init
|
||||
* {@link SubSettingLauncher} to launch {@link BluetoothDeviceDetailsFragment}
|
||||
*/
|
||||
protected void launchDeviceDetails(Preference preference) {
|
||||
final CachedBluetoothDevice device =
|
||||
((BluetoothDevicePreference) preference).getBluetoothDevice();
|
||||
if (device == null) {
|
||||
return;
|
||||
}
|
||||
final Bundle args = new Bundle();
|
||||
args.putString(BluetoothDeviceDetailsFragment.KEY_DEVICE_ADDRESS,
|
||||
device.getDevice().getAddress());
|
||||
|
||||
new SubSettingLauncher(mFragment.getContext())
|
||||
.setDestination(BluetoothDeviceDetailsFragment.class.getName())
|
||||
.setArguments(args)
|
||||
.setTitle(R.string.device_details_title)
|
||||
.setSourceMetricsCategory(mFragment.getMetricsCategory())
|
||||
.launch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if {@code cachedBluetoothDevice} is connected
|
||||
* and the bond state is bonded.
|
||||
|
Reference in New Issue
Block a user