Migrate IUsbGadget to AIDL (Fixed Commnets)
Fixed the comments for aosp/2361672
Bug: 218791946
Test: USB function switch success and AIDL service is running.
Signed-off-by: Ricky Niu <rickyniu@google.com>
Change-Id: I1bd5b96cfe0d994091338a827efe49d07be8c578
diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadgetCallback.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadgetCallback.aidl
index 8672a0c..9de68de 100644
--- a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadgetCallback.aidl
+++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadgetCallback.aidl
@@ -34,7 +34,7 @@
package android.hardware.usb.gadget;
@VintfStability
interface IUsbGadgetCallback {
+ oneway void setCurrentUsbFunctionsCb(in long functions, in android.hardware.usb.gadget.Status status, long transactionId);
oneway void getCurrentUsbFunctionsCb(in long functions, in android.hardware.usb.gadget.Status status, long transactionId);
oneway void getUsbSpeedCb(in android.hardware.usb.gadget.UsbSpeed speed, long transactionId);
- oneway void setCurrentUsbFunctionsCb(in long functions, in android.hardware.usb.gadget.Status status, long transactionId);
}
diff --git a/usb/gadget/aidl/android/hardware/usb/gadget/GadgetFunction.aidl b/usb/gadget/aidl/android/hardware/usb/gadget/GadgetFunction.aidl
index 18b31b8..d82b427 100644
--- a/usb/gadget/aidl/android/hardware/usb/gadget/GadgetFunction.aidl
+++ b/usb/gadget/aidl/android/hardware/usb/gadget/GadgetFunction.aidl
@@ -29,29 +29,29 @@
/**
* Android open accessory protocol function.
*/
- const long ACCESSORY = 2;
+ const long ACCESSORY = 1 << 1;
/**
* Media Transfer protocol function.
*/
- const long MTP = 4;
+ const long MTP = 1 << 2;
/**
* Peripheral mode USB Midi function.
*/
- const long MIDI = 8;
+ const long MIDI = 1 << 3;
/**
* Picture transfer protocol function.
*/
- const long PTP = 16;
+ const long PTP = 1 << 4;
/**
* Tethering function.
*/
- const long RNDIS = 32;
+ const long RNDIS = 1 << 5;
/**
* AOAv2.0 - Audio Source function.
*/
- const long AUDIO_SOURCE = 64;
+ const long AUDIO_SOURCE = 1 << 6;
/**
* NCM - NCM function.
*/
- const long NCM = 1024;
+ const long NCM = 1 << 10;
}
diff --git a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl
index 658f11b..da644d6 100644
--- a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl
+++ b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl
@@ -23,8 +23,7 @@
oneway interface IUsbGadget {
/**
* This function is used to set the current USB gadget configuration.
- * Usb gadget needs to teared down if an USB configuration is already
- * active.
+ * Usb gadget needs to be reset if an USB configuration is already.
*
* @param functions The GadgetFunction bitmap. See GadgetFunction for
* the value of each bit.
diff --git a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl
index 75ff02b..5a682d6 100644
--- a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl
+++ b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl
@@ -23,6 +23,20 @@
@VintfStability
oneway interface IUsbGadgetCallback {
/**
+ * Callback function used to propagate the status of configuration
+ * switch to the caller.
+ *
+ * @param functions list of functions defined by GadgetFunction
+ * included in the current USB gadget composition.
+ * @param status SUCCESS when the functions are applied.
+ * FUNCTIONS_NOT_SUPPORTED when the configuration is
+ * not supported.
+ * ERROR otherwise.
+ * @param transactionId ID to be used when invoking the callback.
+ */
+ void setCurrentUsbFunctionsCb(in long functions, in Status status, long transactionId);
+
+ /**
* Callback function used to propagate the current USB gadget
* configuration.
* @param functions The GadgetFunction bitmap. See GadgetFunction for
@@ -46,18 +60,4 @@
* @param transactionId ID to be used when invoking the callback.
*/
void getUsbSpeedCb(in UsbSpeed speed, long transactionId);
-
- /**
- * Callback function used to propagate the status of configuration
- * switch to the caller.
- *
- * @param functions list of functions defined by GadgetFunction
- * included in the current USB gadget composition.
- * @param status SUCCESS when the functions are applied.
- * FUNCTIONS_NOT_SUPPORTED when the configuration is
- * not supported.
- * ERROR otherwise.
- * @param transactionId ID to be used when invoking the callback.
- */
- void setCurrentUsbFunctionsCb(in long functions, in Status status, long transactionId);
}