blob: 33d00c6c591b433cb768d5effcfdbc7566b10073 [file] [log] [blame]
Songchun Fan1e4508c2019-12-04 14:58:07 -08001/*
2 * Copyright (C) 2019 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#pragma once
17
Alex Buynytskyyfd17ea02019-12-11 10:59:34 -080018#include <dataloader.h>
Songchun Fan1e4508c2019-12-04 14:58:07 -080019
Alex Buynytskyyfd17ea02019-12-11 10:59:34 -080020namespace android::dataloader {
Songchun Fan1e4508c2019-12-04 14:58:07 -080021
22// Default DataLoader redirects everything back to Java.
23struct ManagedDataLoader : public DataLoader {
24 ManagedDataLoader(JavaVM* jvm);
25
26private:
27 // Lifecycle.
Alex Buynytskyyfd17ea02019-12-11 10:59:34 -080028 bool onCreate(const android::dataloader::DataLoaderParams&,
29 android::dataloader::FilesystemConnectorPtr ifs,
30 android::dataloader::StatusListenerPtr listener,
31 android::dataloader::ServiceConnectorPtr service,
Alex Buynytskyyebe71e52020-02-10 07:41:22 -080032 android::dataloader::ServiceParamsPtr params) final;
33 bool onStart() final { return true; }
34 void onStop() final {}
35 void onDestroy() final;
Songchun Fan1e4508c2019-12-04 14:58:07 -080036
Songchun Fan3ffdbd52020-02-26 13:05:29 -080037 bool onPrepareImage(DataLoaderInstallationFiles addedFiles) final;
Alex Buynytskyy1be31692019-12-17 10:41:14 -080038
Songchun Fan3ffdbd52020-02-26 13:05:29 -080039 void onPendingReads(PendingReads pendingReads) final {}
40 void onPageReads(PageReads pageReads) final {}
Songchun Fan1e4508c2019-12-04 14:58:07 -080041
42 JavaVM* const mJvm;
43 jobject mDataLoader = nullptr;
44};
45
Alex Buynytskyyfd17ea02019-12-11 10:59:34 -080046} // namespace android::dataloader