Use sysfs control for storage device GC

Sometimes, waiting for the HAL makes infinite calls to HAL and ending
up with power consuming issues. While tracking the root cause, we will
temporally turn off HAL for storage device GC.

Bug: 235470321
Test: run "sm idle-maint run"
Ignore-AOSP-First: This is a temporal fix for Android TM devices.
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Change-Id: Ieb371b7fdebfe938206a45547bb24dfbf2c2e7be
This commit is contained in:
Daeho Jeong 2022-06-17 11:06:37 -07:00
parent baee102002
commit d96b2ac076

View file

@ -391,28 +391,6 @@ static void runDevGcOnHal(Service service, GcCallbackImpl cb, GetDescription get
}
static void runDevGc(void) {
auto aidl_service_name = AStorage::descriptor + "/default"s;
if (AServiceManager_isDeclared(aidl_service_name.c_str())) {
ndk::SpAIBinder binder(AServiceManager_waitForService(aidl_service_name.c_str()));
if (binder.get() != nullptr) {
std::shared_ptr<AStorage> aidl_service = AStorage::fromBinder(binder);
if (aidl_service != nullptr) {
runDevGcOnHal<IDL::AIDL>(aidl_service, ndk::SharedRefBase::make<AGcCallbackImpl>(),
&ndk::ScopedAStatus::getDescription);
return;
}
}
LOG(WARNING) << "Device declares " << aidl_service_name
<< " but it is not running, skip dev GC on AIDL HAL";
return;
}
auto hidl_service = HStorage::getService();
if (hidl_service != nullptr) {
runDevGcOnHal<IDL::HIDL>(hidl_service, sp<HGcCallbackImpl>(new HGcCallbackImpl()),
&Return<void>::description);
return;
}
// fallback to legacy code path
runDevGcFstab();
}