1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include "Storage.h" 18 19 #include <sstream> 20 21 #include <android-base/logging.h> 22 #include <health-storage-impl/common.h> 23 24 namespace android { 25 namespace hardware { 26 namespace health { 27 namespace storage { 28 namespace V1_0 { 29 namespace implementation { 30 garbageCollect(uint64_t timeoutSeconds,const sp<IGarbageCollectCallback> & cb)31Return<void> Storage::garbageCollect(uint64_t timeoutSeconds, 32 const sp<IGarbageCollectCallback>& cb) { 33 Result result = GarbageCollect(timeoutSeconds); 34 35 if (cb != nullptr) { 36 auto ret = cb->onFinish(result); 37 if (!ret.isOk()) { 38 LOG(WARNING) << "Cannot return result to callback: " << ret.description(); 39 } 40 } 41 return Void(); 42 } 43 debug(const hidl_handle & handle,const hidl_vec<hidl_string> &)44Return<void> Storage::debug(const hidl_handle& handle, const hidl_vec<hidl_string>&) { 45 if (handle == nullptr || handle->numFds < 1) { 46 return Void(); 47 } 48 49 int fd = handle->data[0]; 50 DebugDump(fd); 51 52 return Void(); 53 } 54 55 } // namespace implementation 56 } // namespace V1_0 57 } // namespace storage 58 } // namespace health 59 } // namespace hardware 60 } // namespace android 61