blob: 495aa4f2180c28791b179bfa5440b6ef5c1845a0 [file] [log] [blame]
Ed Coyne7464ac92017-06-08 12:26:48 -07001/*
2 * Copyright (C) 2017 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#ifndef _BOOTANIMATION_BOOTACTION_H
18#define _BOOTANIMATION_BOOTACTION_H
19
20#include <string>
21
22#include <utils/RefBase.h>
23
24namespace android {
25
26class BootAction : public RefBase {
27public:
28 ~BootAction();
Ed Coyne428ed512017-08-14 15:10:06 -070029
30 // libraryPath is a fully qualified path to the target .so library.
31 bool init(const std::string& libraryPath);
Ed Coyne7464ac92017-06-08 12:26:48 -070032
33 // The animation is going to start playing partNumber for the playCount'th
34 // time, update the action as needed.
35 // This is run in the same thread as the boot animation,
36 // you must not block here.
37 void startPart(int partNumber, int playCount);
38
39 // Shutdown the boot action, this will be called shortly before the
40 // process is shut down to allow time for cleanup.
41 void shutdown();
42
43private:
44 typedef bool (*libInit)();
45 typedef void (*libStartPart)(int partNumber, int playNumber);
46 typedef void (*libShutdown)();
47
Ed Coyne7464ac92017-06-08 12:26:48 -070048 bool loadSymbol(const char* symbol, void** loaded);
Ed Coyne7464ac92017-06-08 12:26:48 -070049
50 void* mLibHandle = nullptr;
51 libInit mLibInit = nullptr;
52 libStartPart mLibStartPart = nullptr;
53 libShutdown mLibShutdown = nullptr;
54};
55
56} // namespace android
57
58
59#endif // _BOOTANIMATION_BOOTACTION_H