diff options
author | Roy Luo <royluo@google.com> | 2023-11-30 21:40:10 +0000 |
---|---|---|
committer | Roy Luo <royluo@google.com> | 2023-11-30 21:42:18 +0000 |
commit | 8b898807764292f29a4cadfe7ad9b501072988c1 (patch) | |
tree | 1c04f03e0cc0803da0d9a627838b2fe31223ff72 | |
parent | 9ece305563167ad2f18b6bee9e7c5dc3db7093e3 (diff) | |
download | pixel-8b898807764292f29a4cadfe7ad9b501072988c1.tar.gz |
Use boot_clock for BuildVendorUsbDataSessionEvent
This is to cover system suspend use case.
Bug: 297224564
Bug: 296119135
Test: usb data session upload in device and host mode
Change-Id: Ibbab3d043ecc6e003f8995d8e69b4ee91872becb
-rw-r--r-- | usb/CommonUtils.cpp | 6 | ||||
-rw-r--r-- | usb/include/pixelusb/CommonUtils.h | 9 |
2 files changed, 8 insertions, 7 deletions
diff --git a/usb/CommonUtils.cpp b/usb/CommonUtils.cpp index 91688b98..6e0f08c9 100644 --- a/usb/CommonUtils.cpp +++ b/usb/CommonUtils.cpp @@ -200,10 +200,10 @@ static VendorUsbDataSessionEvent_UsbDeviceState stringToUsbDeviceStateProto( } } -void BuildVendorUsbDataSessionEvent(bool is_host, steady_clock::time_point currentTime, - steady_clock::time_point startTime, +void BuildVendorUsbDataSessionEvent(bool is_host, boot_clock::time_point currentTime, + boot_clock::time_point startTime, std::vector<std::string> *states, - std::vector<steady_clock::time_point> *timestamps, + std::vector<boot_clock::time_point> *timestamps, VendorUsbDataSessionEvent *event) { if (is_host) { event->set_usb_role(VendorUsbDataSessionEvent_UsbDataRole_USB_ROLE_HOST); diff --git a/usb/include/pixelusb/CommonUtils.h b/usb/include/pixelusb/CommonUtils.h index 93855be3..dbd59c63 100644 --- a/usb/include/pixelusb/CommonUtils.h +++ b/usb/include/pixelusb/CommonUtils.h @@ -17,6 +17,7 @@ #ifndef HARDWARE_GOOGLE_PIXEL_USB_UTILSCOMMON_H_ #define HARDWARE_GOOGLE_PIXEL_USB_UTILSCOMMON_H_ +#include <android-base/chrono_utils.h> #include <android-base/unique_fd.h> #include <hardware/google/pixel/pixelstats/pixelatoms.pb.h> @@ -58,8 +59,8 @@ constexpr char kUvcEnabled[] = "ro.usb.uvc.enabled"; #define FUNCTION_PATH CONFIG_PATH FUNCTION_NAME #define RNDIS_PATH FUNCTIONS_PATH "gsi.rndis" +using ::android::base::boot_clock; using android::hardware::google::pixel::PixelAtoms::VendorUsbDataSessionEvent; -using ::std::chrono::steady_clock; // Adds the given fd to the epollfd(epfd). int addEpollFd(const ::android::base::unique_fd &epfd, const ::android::base::unique_fd &fd); @@ -73,10 +74,10 @@ int linkFunction(const char *function, int index); bool setVidPidCommon(const char *vid, const char *pid); // Pulls down USB gadget. Returns true on success, false on failure bool resetGadgetCommon(); -void BuildVendorUsbDataSessionEvent(bool is_host, steady_clock::time_point currentTime, - steady_clock::time_point startTime, +void BuildVendorUsbDataSessionEvent(bool is_host, boot_clock::time_point currentTime, + boot_clock::time_point startTime, std::vector<std::string> *states, - std::vector<steady_clock::time_point> *timestamps, + std::vector<boot_clock::time_point> *timestamps, VendorUsbDataSessionEvent *event); } // namespace usb |