Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 96c01713 authored by Yiwei Zhang's avatar Yiwei Zhang
Browse files

Game Driver: update the format of driver build date

This change updates the original string base driver build date to
int64_t based driver build time. The build time is the Unix epoch
timestamp.

Bug: 123156461
Test: Build, flash and boot. Verify the GpuService receiver side.
Change-Id: Ia9e0c64c5dfa6f4bb84a0c05e982b481079158a7
parent 7127e800
Loading
Loading
Loading
Loading
+12 −14
Original line number Diff line number Diff line
@@ -158,24 +158,23 @@ void GraphicsEnv::setDriverPath(const std::string path) {

void GraphicsEnv::setGpuStats(const std::string& driverPackageName,
                              const std::string& driverVersionName, uint64_t driverVersionCode,
                              const std::string& driverBuildDate,
                              const std::string& appPackageName) {
                              int64_t driverBuildTime, const std::string& appPackageName) {
    ATRACE_CALL();

    std::lock_guard<std::mutex> lock(mStatsLock);
    ALOGV("setGpuStats:\n"
          "\tdriverPackageName[%s]\n"
          "\tdriverVersionName[%s]\n"
          "\tdriverVersionCode[%llu]\n"
          "\tdriverBuildDate[%s]\n"
          "\tdriverVersionCode[%" PRIu64 "]\n"
          "\tdriverBuildTime[%" PRId64 "]\n"
          "\tappPackageName[%s]\n",
          driverPackageName.c_str(), driverVersionName.c_str(),
          (unsigned long long)driverVersionCode, driverBuildDate.c_str(), appPackageName.c_str());
          driverPackageName.c_str(), driverVersionName.c_str(), driverVersionCode, driverBuildTime,
          appPackageName.c_str());

    mGpuStats.driverPackageName = driverPackageName;
    mGpuStats.driverVersionName = driverVersionName;
    mGpuStats.driverVersionCode = driverVersionCode;
    mGpuStats.driverBuildDate = driverBuildDate;
    mGpuStats.driverBuildTime = driverBuildTime;
    mGpuStats.appPackageName = appPackageName;
}

@@ -264,21 +263,20 @@ void GraphicsEnv::sendGpuStatsLocked(GraphicsEnv::Driver driver, bool isDriverLo
    ALOGV("sendGpuStats:\n"
          "\tdriverPackageName[%s]\n"
          "\tdriverVersionName[%s]\n"
          "\tdriverVersionCode[%llu]\n"
          "\tdriverBuildDate[%s]\n"
          "\tdriverVersionCode[%" PRIu64 "]\n"
          "\tdriverBuildTime[%" PRId64 "]\n"
          "\tappPackageName[%s]\n"
          "\tdriver[%d]\n"
          "\tisDriverLoaded[%d]\n"
          "\tdriverLoadingTime[%lld]",
          "\tdriverLoadingTime[%" PRId64 "]",
          mGpuStats.driverPackageName.c_str(), mGpuStats.driverVersionName.c_str(),
          (unsigned long long)mGpuStats.driverVersionCode, mGpuStats.driverBuildDate.c_str(),
          mGpuStats.appPackageName.c_str(), static_cast<int32_t>(driver), isDriverLoaded,
          (long long)driverLoadingTime);
          mGpuStats.driverVersionCode, mGpuStats.driverBuildTime, mGpuStats.appPackageName.c_str(),
          static_cast<int32_t>(driver), isDriverLoaded, driverLoadingTime);

    const sp<IGpuService> gpuService = getGpuService();
    if (gpuService) {
        gpuService->setGpuStats(mGpuStats.driverPackageName, mGpuStats.driverVersionName,
                                mGpuStats.driverVersionCode, mGpuStats.driverBuildDate,
                                mGpuStats.driverVersionCode, mGpuStats.driverBuildTime,
                                mGpuStats.appPackageName, driver, isDriverLoaded,
                                driverLoadingTime);
    }
+5 −5
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ public:

    virtual void setGpuStats(const std::string& driverPackageName,
                             const std::string& driverVersionName, uint64_t driverVersionCode,
                             const std::string& driverBuildDate, const std::string& appPackageName,
                             int64_t driverBuildTime, const std::string& appPackageName,
                             GraphicsEnv::Driver driver, bool isDriverLoaded,
                             int64_t driverLoadingTime) {
        Parcel data, reply;
@@ -38,7 +38,7 @@ public:
        data.writeUtf8AsUtf16(driverPackageName);
        data.writeUtf8AsUtf16(driverVersionName);
        data.writeUint64(driverVersionCode);
        data.writeUtf8AsUtf16(driverBuildDate);
        data.writeInt64(driverBuildTime);
        data.writeUtf8AsUtf16(appPackageName);
        data.writeInt32(static_cast<int32_t>(driver));
        data.writeBool(isDriverLoaded);
@@ -68,8 +68,8 @@ status_t BnGpuService::onTransact(uint32_t code, const Parcel& data, Parcel* rep
            uint64_t driverVersionCode;
            if ((status = data.readUint64(&driverVersionCode)) != OK) return status;

            std::string driverBuildDate;
            if ((status = data.readUtf8FromUtf16(&driverBuildDate)) != OK) return status;
            int64_t driverBuildTime;
            if ((status = data.readInt64(&driverBuildTime)) != OK) return status;

            std::string appPackageName;
            if ((status = data.readUtf8FromUtf16(&appPackageName)) != OK) return status;
@@ -83,7 +83,7 @@ status_t BnGpuService::onTransact(uint32_t code, const Parcel& data, Parcel* rep
            int64_t driverLoadingTime;
            if ((status = data.readInt64(&driverLoadingTime)) != OK) return status;

            setGpuStats(driverPackageName, driverVersionName, driverVersionCode, driverBuildDate,
            setGpuStats(driverPackageName, driverVersionName, driverVersionCode, driverBuildTime,
                        appPackageName, static_cast<GraphicsEnv::Driver>(driver), isDriverLoaded,
                        driverLoadingTime);

+3 −3
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ private:
        std::string driverPackageName;
        std::string driverVersionName;
        uint64_t driverVersionCode;
        std::string driverBuildDate;
        int64_t driverBuildTime;
        std::string appPackageName;
        Driver glDriverToLoad;
        Driver glDriverFallback;
@@ -59,7 +59,7 @@ private:
              : driverPackageName(""),
                driverVersionName(""),
                driverVersionCode(0),
                driverBuildDate(""),
                driverBuildTime(0),
                appPackageName(""),
                glDriverToLoad(Driver::NONE),
                glDriverFallback(Driver::NONE),
@@ -80,7 +80,7 @@ public:
    void setDriverPath(const std::string path);
    android_namespace_t* getDriverNamespace();
    void setGpuStats(const std::string& driverPackageName, const std::string& driverVersionName,
                     uint64_t versionCode, const std::string& driverBuildDate,
                     uint64_t versionCode, int64_t driverBuildTime,
                     const std::string& appPackageName);
    void setDriverToLoad(Driver driver);
    void setDriverLoaded(Api api, bool isDriverLoaded, int64_t driverLoadingTime);
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ public:
    // set GPU stats from GraphicsEnvironment.
    virtual void setGpuStats(const std::string& driverPackageName,
                             const std::string& driverVersionName, uint64_t driverVersionCode,
                             const std::string& driverBuildDate, const std::string& appPackageName,
                             int64_t driverBuildTime, const std::string& appPackageName,
                             GraphicsEnv::Driver driver, bool isDriverLoaded,
                             int64_t driverLoadingTime) = 0;
};
+6 −7
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ GpuService::GpuService() = default;

void GpuService::setGpuStats(const std::string& driverPackageName,
                             const std::string& driverVersionName, uint64_t driverVersionCode,
                             const std::string& driverBuildDate, const std::string& appPackageName,
                             int64_t driverBuildTime, const std::string& appPackageName,
                             GraphicsEnv::Driver driver, bool isDriverLoaded,
                             int64_t driverLoadingTime) {
    ATRACE_CALL();
@@ -48,15 +48,14 @@ void GpuService::setGpuStats(const std::string& driverPackageName,
    ALOGV("Received:\n"
          "\tdriverPackageName[%s]\n"
          "\tdriverVersionName[%s]\n"
          "\tdriverVersionCode[%llu]\n"
          "\tdriverBuildDate[%s]\n"
          "\tdriverVersionCode[%" PRIu64 "]\n"
          "\tdriverBuildTime[%" PRId64 "]\n"
          "\tappPackageName[%s]\n"
          "\tdriver[%d]\n"
          "\tisDriverLoaded[%d]\n"
          "\tdriverLoadingTime[%lld]",
          driverPackageName.c_str(), driverVersionName.c_str(),
          (unsigned long long)driverVersionCode, driverBuildDate.c_str(), appPackageName.c_str(),
          static_cast<int32_t>(driver), isDriverLoaded, (long long)driverLoadingTime);
          "\tdriverLoadingTime[%" PRId64 "]",
          driverPackageName.c_str(), driverVersionName.c_str(), driverVersionCode, driverBuildTime,
          appPackageName.c_str(), static_cast<int32_t>(driver), isDriverLoaded, driverLoadingTime);
}

status_t GpuService::shellCommand(int /*in*/, int out, int err, std::vector<String16>& args) {
Loading