2019-11-29 14:23:45 -08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <binder/BinderService.h>
|
|
|
|
#include <binder/IServiceManager.h>
|
2021-02-24 22:25:59 +00:00
|
|
|
#include <binder/PersistableBundle.h>
|
2020-04-09 19:22:30 -07:00
|
|
|
#include <jni.h>
|
2019-11-29 14:23:45 -08:00
|
|
|
|
|
|
|
#include "IncrementalService.h"
|
2020-02-04 13:42:59 -08:00
|
|
|
#include "android/os/incremental/BnIncrementalService.h"
|
2019-11-29 14:23:45 -08:00
|
|
|
#include "incremental_service.h"
|
|
|
|
|
|
|
|
namespace android::os::incremental {
|
|
|
|
|
2020-02-04 13:42:59 -08:00
|
|
|
class BinderIncrementalService : public BnIncrementalService,
|
2019-11-29 14:23:45 -08:00
|
|
|
public BinderService<BinderIncrementalService> {
|
|
|
|
public:
|
2020-04-09 19:22:30 -07:00
|
|
|
BinderIncrementalService(const sp<IServiceManager>& sm, JNIEnv* env);
|
2019-11-29 14:23:45 -08:00
|
|
|
|
2020-04-09 19:22:30 -07:00
|
|
|
static BinderIncrementalService* start(JNIEnv* env);
|
2020-03-05 09:16:08 -08:00
|
|
|
static const char16_t* getServiceName() { return u"incremental"; }
|
2020-02-05 17:41:25 -08:00
|
|
|
status_t dump(int fd, const Vector<String16>& args) final;
|
2019-11-29 14:23:45 -08:00
|
|
|
|
|
|
|
void onSystemReady();
|
|
|
|
void onInvalidStorage(int mountId);
|
|
|
|
|
2020-01-10 11:53:24 -08:00
|
|
|
binder::Status openStorage(const std::string& path, int32_t* _aidl_return) final;
|
2021-01-27 06:58:55 -08:00
|
|
|
binder::Status createStorage(const ::std::string& path,
|
|
|
|
const ::android::content::pm::DataLoaderParamsParcel& params,
|
|
|
|
int32_t createMode, int32_t* _aidl_return) final;
|
|
|
|
binder::Status createLinkedStorage(const std::string& path, int32_t otherStorageId,
|
|
|
|
int32_t createMode, int32_t* _aidl_return) final;
|
|
|
|
binder::Status startLoading(
|
|
|
|
int32_t storageId, const ::android::content::pm::DataLoaderParamsParcel& params,
|
2020-05-08 16:18:52 -07:00
|
|
|
const ::android::sp<::android::content::pm::IDataLoaderStatusListener>& statusListener,
|
|
|
|
const ::android::os::incremental::StorageHealthCheckParams& healthCheckParams,
|
|
|
|
const ::android::sp<IStorageHealthListener>& healthListener,
|
2020-12-14 21:50:04 -08:00
|
|
|
const ::std::vector<::android::os::incremental::PerUidReadTimeouts>& perUidReadTimeouts,
|
2021-01-27 06:58:55 -08:00
|
|
|
bool* _aidl_return) final;
|
2021-03-31 22:19:42 -07:00
|
|
|
binder::Status onInstallationComplete(int32_t storageId) final;
|
|
|
|
|
2020-01-10 11:53:24 -08:00
|
|
|
binder::Status makeBindMount(int32_t storageId, const std::string& sourcePath,
|
|
|
|
const std::string& targetFullPath, int32_t bindType,
|
|
|
|
int32_t* _aidl_return) final;
|
|
|
|
binder::Status deleteBindMount(int32_t storageId, const std::string& targetFullPath,
|
|
|
|
int32_t* _aidl_return) final;
|
|
|
|
binder::Status makeDirectory(int32_t storageId, const std::string& path,
|
|
|
|
int32_t* _aidl_return) final;
|
|
|
|
binder::Status makeDirectories(int32_t storageId, const std::string& path,
|
|
|
|
int32_t* _aidl_return) final;
|
|
|
|
binder::Status makeFile(int32_t storageId, const std::string& path,
|
2020-09-12 16:12:36 -07:00
|
|
|
const IncrementalNewFileParams& params,
|
|
|
|
const ::std::optional<::std::vector<uint8_t>>& content,
|
|
|
|
int32_t* _aidl_return) final;
|
2020-01-10 11:53:24 -08:00
|
|
|
binder::Status makeFileFromRange(int32_t storageId, const std::string& targetPath,
|
|
|
|
const std::string& sourcePath, int64_t start, int64_t end,
|
|
|
|
int32_t* _aidl_return) final;
|
|
|
|
binder::Status makeLink(int32_t sourceStorageId, const std::string& sourcePath,
|
|
|
|
int32_t destStorageId, const std::string& destPath,
|
|
|
|
int32_t* _aidl_return) final;
|
|
|
|
binder::Status unlink(int32_t storageId, const std::string& path, int32_t* _aidl_return) final;
|
2020-08-25 12:45:22 -07:00
|
|
|
binder::Status isFileFullyLoaded(int32_t storageId, const std::string& path,
|
|
|
|
int32_t* _aidl_return) final;
|
2021-01-27 06:58:55 -08:00
|
|
|
binder::Status isFullyLoaded(int32_t storageId, int32_t* _aidl_return) final;
|
2020-08-20 08:40:29 -07:00
|
|
|
binder::Status getLoadingProgress(int32_t storageId, float* _aidl_return) final;
|
2020-01-10 11:53:24 -08:00
|
|
|
binder::Status getMetadataByPath(int32_t storageId, const std::string& path,
|
|
|
|
std::vector<uint8_t>* _aidl_return) final;
|
|
|
|
binder::Status getMetadataById(int32_t storageId, const std::vector<uint8_t>& id,
|
|
|
|
std::vector<uint8_t>* _aidl_return) final;
|
2019-11-29 14:23:45 -08:00
|
|
|
binder::Status deleteStorage(int32_t storageId) final;
|
2020-12-14 21:50:04 -08:00
|
|
|
binder::Status disallowReadLogs(int32_t storageId) final;
|
2020-02-05 17:41:25 -08:00
|
|
|
binder::Status configureNativeBinaries(int32_t storageId, const std::string& apkFullPath,
|
|
|
|
const std::string& libDirRelativePath,
|
2020-05-21 18:19:07 -07:00
|
|
|
const std::string& abi, bool extractNativeLibs,
|
|
|
|
bool* _aidl_return) final;
|
2020-04-07 15:35:21 -07:00
|
|
|
binder::Status waitForNativeBinariesExtraction(int storageId, bool* _aidl_return) final;
|
2020-09-03 11:45:53 -07:00
|
|
|
binder::Status registerLoadingProgressListener(
|
|
|
|
int32_t storageId,
|
|
|
|
const ::android::sp<::android::os::incremental::IStorageLoadingProgressListener>&
|
|
|
|
progressListener,
|
|
|
|
bool* _aidl_return) final;
|
|
|
|
binder::Status unregisterLoadingProgressListener(int32_t storageId, bool* _aidl_return) final;
|
2021-02-24 22:25:59 +00:00
|
|
|
binder::Status getMetrics(int32_t storageId,
|
|
|
|
android::os::PersistableBundle* _aidl_return) final;
|
2019-11-29 14:23:45 -08:00
|
|
|
|
|
|
|
private:
|
|
|
|
android::incremental::IncrementalService mImpl;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace android::os::incremental
|