diff options
author | Ed Coyne <edcoyne@google.com> | 2017-06-08 12:26:48 -0700 |
---|---|---|
committer | Ed Coyne <edcoyne@google.com> | 2017-06-19 17:27:08 -0700 |
commit | 7464ac9bd7fe89061e47617e4b6004b88c91d636 (patch) | |
tree | 7466478571007709d256f4876cb12cd1ce0aea53 /cmds/bootanimation/BootAnimation.h | |
parent | 2cb3f59668d9cbb91785feee312fff6945425281 (diff) |
Allow IO During boot process, BootActions.
NOTE: this is only compiled into products with PRODUCT_IOT=true.
Introduce BootActions that a developer can provide to manipulate IO
before the android framework comes up on boot.
We will look for a configuration file at /oem/app/etc/boot_action.conf and
expect it to tell us the name of a shared library. We will then fetch
this library from /oem/app/lib/${arch}/ and load it. We expect it to export
boot_action_init(), boot_action_shutdown(), and optionally
boot_action_start_part(int partNumber, int playNumber).
We will then call boot_action_init() during boot after PeripheralManager
is up and call boot_action_shutdown() when the android framework is up
and we are going to start loading APKs.
We will also call boot_action_start_part(*) when each part of the boot
animation is started, use this if you want to synchronize the boot
action and the boot animation.
Boot actions run in a restricted environment and in general can only
make calls to PeripheralManager.
Bug: 37992717
Test: Pushed to local imx7d to test boot actions, pushed to bullhead test that animation+sound still works.
Change-Id: I9e53a17567f8028ea84486d637e1d231ee1125e1
Diffstat (limited to 'cmds/bootanimation/BootAnimation.h')
-rw-r--r-- | cmds/bootanimation/BootAnimation.h | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/cmds/bootanimation/BootAnimation.h b/cmds/bootanimation/BootAnimation.h index 3ebe7d6e4dff..56e131523bcb 100644 --- a/cmds/bootanimation/BootAnimation.h +++ b/cmds/bootanimation/BootAnimation.h @@ -93,22 +93,27 @@ public: Font clockFont; }; - // Callback will be called during initialization after we have loaded - // the animation and be provided with all parts in animation. - typedef std::function<void(const Vector<Animation::Part>& parts)> InitCallback; - - // Callback will be called while animation is playing before each part is - // played. It will be provided with the part and play count for it. - // It will be provided with the partNumber for the part about to be played, - // as well as a reference to the part itself. It will also be provided with - // which play of that part is about to start, some parts are repeated - // multiple times. - typedef std::function<void(int partNumber, const Animation::Part& part, int playNumber)> - PlayPartCallback; - - // Callbacks may be null and will be called from this class's internal - // thread. - BootAnimation(InitCallback initCallback, PlayPartCallback partCallback); + // All callbacks will be called from this class's internal thread. + class Callbacks : public RefBase { + public: + // Will be called during initialization after we have loaded + // the animation and be provided with all parts in animation. + virtual void init(const Vector<Animation::Part>& /*parts*/) {} + + // Will be called while animation is playing before each part is + // played. It will be provided with the part and play count for it. + // It will be provided with the partNumber for the part about to be played, + // as well as a reference to the part itself. It will also be provided with + // which play of that part is about to start, some parts are repeated + // multiple times. + virtual void playPart(int /*partNumber*/, const Animation::Part& /*part*/, + int /*playNumber*/) {} + + // Will be called when animation is done and thread is shutting down. + virtual void shutdown() {} + }; + + BootAnimation(sp<Callbacks> callbacks); sp<SurfaceComposerClient> session() const; @@ -170,8 +175,7 @@ private: String8 mZipFileName; SortedVector<String8> mLoadedFiles; sp<TimeCheckThread> mTimeCheckThread = nullptr; - InitCallback mInitCallback = nullptr; - PlayPartCallback mPlayPartCallback = nullptr; + sp<Callbacks> mCallbacks; }; // --------------------------------------------------------------------------- |