Check usb functions support with USB Gadget Hal version
Currently, UsbDeviceManager will send usb functions in GadgetFunction to Hal implementation without any check. It is possible to send the functions defined in newer Hal to older Hal implementation. This patch will add a check to avoid this symptom before sending the usb function. Bug: 182507868 Test: verified pass Change-Id: I621809b8c7236937ab4c76e3fa943d00f761922f
This commit is contained in:
@@ -2139,6 +2139,12 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
|
||||
Slog.d(TAG, "setEnabledFunctions functions=" + functions + ", "
|
||||
+ "forceRestart=" + forceRestart);
|
||||
}
|
||||
if (mCurrentGadgetHalVersion < UsbManager.GADGET_HAL_V1_2) {
|
||||
if ((functions & UsbManager.FUNCTION_NCM) != 0) {
|
||||
Slog.e(TAG, "Could not set unsupported function for the GadgetHal");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (mCurrentFunctions != functions
|
||||
|| !mCurrentFunctionsApplied
|
||||
|| forceRestart) {
|
||||
|
||||
Reference in New Issue
Block a user