Add the USB device parameter to usb stylus feature preference provider.

Test: StylusUsbFirmwareControllerTest
Bug: 291922092
Change-Id: Ie43bceb807e18ff56d01f6e99316db6e2820383b
This commit is contained in:
Vania Januar
2023-08-02 12:17:56 +01:00
parent 270b7ef18d
commit 558d9f8750
4 changed files with 5 additions and 4 deletions

View File

@@ -41,7 +41,8 @@ public interface StylusFeatureProvider {
* the list will contain only the preference showing the current firmware version. * the list will contain only the preference showing the current firmware version.
* *
* @param context The context * @param context The context
* @param usbDevice The USB device for which to generate preferences.
*/ */
@Nullable @Nullable
List<Preference> getUsbFirmwareUpdatePreferences(Context context); List<Preference> getUsbFirmwareUpdatePreferences(Context context, UsbDevice usbDevice);
} }

View File

@@ -31,7 +31,7 @@ public class StylusFeatureProviderImpl implements StylusFeatureProvider {
} }
@Override @Override
public List<Preference> getUsbFirmwareUpdatePreferences(Context context) { public List<Preference> getUsbFirmwareUpdatePreferences(Context context, UsbDevice usbDevice) {
return null; return null;
} }
} }

View File

@@ -88,7 +88,7 @@ public class StylusUsbFirmwareController extends BasePreferenceController
StylusFeatureProvider featureProvider = FeatureFactory.getFactory( StylusFeatureProvider featureProvider = FeatureFactory.getFactory(
mContext).getStylusFeatureProvider(); mContext).getStylusFeatureProvider();
List<Preference> preferences = List<Preference> preferences =
featureProvider.getUsbFirmwareUpdatePreferences(mContext); featureProvider.getUsbFirmwareUpdatePreferences(mContext, mStylusUsbDevice);
if (preferences != null) { if (preferences != null) {
mPreference = new PreferenceCategory(mContext); mPreference = new PreferenceCategory(mContext);

View File

@@ -157,7 +157,7 @@ public class StylusUsbFirmwareControllerTest {
when(mFeatureFactory.getStylusFeatureProvider() when(mFeatureFactory.getStylusFeatureProvider()
.isUsbFirmwareUpdateEnabled(any())).thenReturn(true); .isUsbFirmwareUpdateEnabled(any())).thenReturn(true);
when(mFeatureFactory.getStylusFeatureProvider() when(mFeatureFactory.getStylusFeatureProvider()
.getUsbFirmwareUpdatePreferences(any())) .getUsbFirmwareUpdatePreferences(any(), any()))
.thenReturn(Collections.singletonList(mock(Preference.class))); .thenReturn(Collections.singletonList(mock(Preference.class)));
} }
} }