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

Commit 4df87f65 authored by Felka Chang's avatar Felka Chang
Browse files

Disable storage crates functionalities

The Storage Crates functionalities is disable by default. In order to
make installd to grow smoothly, the crate function should not add into
installd until it addes more tests such as benchmark and memory regression
tests.

Test: make -j installd && \
        grep crates $OUT/system/bin/installd ; \
        if [ $? -eq 0 ] ; \
        then \
            echo "include crate" ; \
        else \
            echo  "not include crate " ; \
        fi
Test: #should skip the test
      adb root; \
      adb shell setprop fw.storage_crates true \
      atest CtsOsTestCases:android.os.storage.cts.StorageCrateTest \
         CtsOsTestCases:android.os.storage.cts.StorageStatsManagerTest \
         CtsOsTestCases:android.os.storage.cts.CrateInfoTest
Test: #should test fail because installd disable the functionalities
      adb root; \
      adb shell "setprop fw.storage_crates ''" \
      atest CtsOsTestCases:android.os.storage.cts.StorageCrateTest \
         CtsOsTestCases:android.os.storage.cts.StorageStatsManagerTest \
         CtsOsTestCases:android.os.storage.cts.CrateInfoTest
Bug: 148179319
Change-Id: I1fd142c9c9e5d7e133ebd994f4645966ee432916
parent b0d738af
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

#include "CrateManager.h"

#ifdef ENABLE_STORAGE_CRATES

#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <android/log.h>
@@ -127,3 +129,5 @@ void CrateManager::dump(std::unique_ptr<CrateMetadata>& CrateMetadata) {

} // namespace installd
} // namespace android

#endif // ENABLE_STORAGE_CRATES
 No newline at end of file
+7 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
#ifndef ANDROID_INSTALLD_CRATE_INFO_MANAGER_H
#define ANDROID_INSTALLD_CRATE_INFO_MANAGER_H

#ifdef ENABLE_STORAGE_CRATES

#include <android/os/storage/CrateMetadata.h>
#include <cutils/multiuser.h>
#include <fts.h>
@@ -79,4 +81,9 @@ private:
} // namespace installd
} // namespace android

#else // ENABLE_STORAGE_CRATES
#include <android/os/storage/CrateMetadata.h>
using android::os::storage::CrateMetadata;
#endif // ENABLE_STORAGE_CRATES

#endif // ANDROID_INSTALLD_CRATE_INFO_MANAGER_H
+18 −0
Original line number Diff line number Diff line
@@ -2054,6 +2054,7 @@ binder::Status InstalldNativeService::getAppCrates(
    for (const auto& packageName : packageNames) {
        CHECK_ARGUMENT_PACKAGE_NAME(packageName);
    }
#ifdef ENABLE_STORAGE_CRATES
    std::lock_guard<std::recursive_mutex> lock(mLock);

    auto retVector = std::make_unique<std::vector<std::unique_ptr<CrateMetadata>>>();
@@ -2083,6 +2084,14 @@ binder::Status InstalldNativeService::getAppCrates(
#endif

    *_aidl_return = std::move(retVector);
#else // ENABLE_STORAGE_CRATES
    *_aidl_return = nullptr;

    /* prevent compile warning fail */
    if (userId < 0) {
        return error();
    }
#endif // ENABLE_STORAGE_CRATES
    return ok();
}

@@ -2091,6 +2100,7 @@ binder::Status InstalldNativeService::getUserCrates(
        std::unique_ptr<std::vector<std::unique_ptr<CrateMetadata>>>* _aidl_return) {
    ENFORCE_UID(AID_SYSTEM);
    CHECK_ARGUMENT_UUID(uuid);
#ifdef ENABLE_STORAGE_CRATES
    std::lock_guard<std::recursive_mutex> lock(mLock);

    const char* uuid_ = uuid ? uuid->c_str() : nullptr;
@@ -2118,6 +2128,14 @@ binder::Status InstalldNativeService::getUserCrates(
#endif

    *_aidl_return = std::move(retVector);
#else // ENABLE_STORAGE_CRATES
    *_aidl_return = nullptr;

    /* prevent compile warning fail */
    if (userId < 0) {
        return error();
    }
#endif // ENABLE_STORAGE_CRATES
    return ok();
}