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

Commit dbebdcd6 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by android-build-merger
Browse files

Merge "Change storage migration to use quota APIs."

am: 42a57522

Change-Id: Ica12e7378f6c67a488bc66fcd33be72cacca811b
parents 2168bda5 42a57522
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -1644,6 +1644,7 @@ binder::Status InstalldNativeService::getExternalSize(const std::unique_ptr<std:
    int64_t videoSize = 0;
    int64_t imageSize = 0;
    int64_t appSize = 0;
    int64_t obbSize = 0;

    auto device = findQuotaDeviceForUuid(uuid);
    if (device.empty()) {
@@ -1691,6 +1692,13 @@ binder::Status InstalldNativeService::getExternalSize(const std::unique_ptr<std:
#endif
            imageSize = dq.dqb_curspace;
        }
        if (quotactl(QCMD(Q_GETQUOTA, GRPQUOTA), device.c_str(), AID_MEDIA_OBB,
                reinterpret_cast<char*>(&dq)) == 0) {
#if MEASURE_DEBUG
            LOG(DEBUG) << "quotactl() for GID " << AID_MEDIA_OBB << " " << dq.dqb_curspace;
#endif
            obbSize = dq.dqb_curspace;
        }
        ATRACE_END();

        ATRACE_BEGIN("apps");
@@ -1747,6 +1755,11 @@ binder::Status InstalldNativeService::getExternalSize(const std::unique_ptr<std:
        }
        fts_close(fts);
        ATRACE_END();

        ATRACE_BEGIN("obb");
        auto obbPath = create_data_media_obb_path(uuid_, "");
        calculate_tree_size(obbPath, &obbSize);
        ATRACE_END();
    }

    std::vector<int64_t> ret;
@@ -1755,6 +1768,7 @@ binder::Status InstalldNativeService::getExternalSize(const std::unique_ptr<std:
    ret.push_back(videoSize);
    ret.push_back(imageSize);
    ret.push_back(appSize);
    ret.push_back(obbSize);
#if MEASURE_DEBUG
    LOG(DEBUG) << "Final result " << toString(ret);
#endif