summaryrefslogtreecommitdiff
path: root/cmds/bootanimation/BootAnimation.h
diff options
context:
space:
mode:
authorMarin Shalamanov <shalamanov@google.com>2020-05-18 19:05:17 +0200
committerMarin Shalamanov <shalamanov@google.com>2020-05-27 11:50:23 +0200
commit1a6e368920459558a8193efec035be2f41b4f01b (patch)
tree16701f435dee272f917291c97fc75753e327f680 /cmds/bootanimation/BootAnimation.h
parent0131d5018826d995f434be52a53f52189f127a71 (diff)
Resize boot animation on display changes
Use DisplayEventReceiver to listen for display hotplug events and resize the boot animation is display size changes. Bug: 156448328 Test: manually make sure the boot animation has correct dimensions in the following cases I. With boot animation file 1. scrcpy 2. start boot animation with adb shell /system/bin/bootanimation when no physical display is connected (= 480p fake HWC display). Use the virtual display from scrcpy to check the boot animation size. 3. connect a 1080p display (HWC sends hotplug connect to change the display) 4. disconnect the real display II. Same steps without boot animation file (android logo should be displayed) Merged-In: Ib3f0383686399669e8de10456092baaec607fa01 Change-Id: Ib3f0383686399669e8de10456092baaec607fa01
Diffstat (limited to 'cmds/bootanimation/BootAnimation.h')
-rw-r--r--cmds/bootanimation/BootAnimation.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmds/bootanimation/BootAnimation.h b/cmds/bootanimation/BootAnimation.h
index 574d65e425cf..36cd91bdee0d 100644
--- a/cmds/bootanimation/BootAnimation.h
+++ b/cmds/bootanimation/BootAnimation.h
@@ -18,11 +18,14 @@
#define ANDROID_BOOTANIMATION_H
#include <vector>
+#include <queue>
#include <stdint.h>
#include <sys/types.h>
#include <androidfw/AssetManager.h>
+#include <gui/DisplayEventReceiver.h>
+#include <utils/Looper.h>
#include <utils/Thread.h>
#include <binder/IBinder.h>
@@ -145,6 +148,11 @@ private:
BootAnimation* mBootAnimation;
};
+ // Display event handling
+ class DisplayEventCallback;
+ int displayEventCallback(int fd, int events, void* data);
+ void processDisplayEvents();
+
status_t initTexture(Texture* texture, AssetManager& asset, const char* name);
status_t initTexture(FileMap* map, int* width, int* height);
status_t initFont(Font* font, const char* fallback);
@@ -161,6 +169,8 @@ private:
void findBootAnimationFile();
bool findBootAnimationFileInternal(const std::vector<std::string>& files);
bool preloadAnimation();
+ EGLConfig getEglConfig(const EGLDisplay&);
+ void resizeSurface(int newWidth, int newHeight);
void checkExit();
@@ -189,6 +199,8 @@ private:
sp<TimeCheckThread> mTimeCheckThread = nullptr;
sp<Callbacks> mCallbacks;
Animation* mAnimation = nullptr;
+ std::unique_ptr<DisplayEventReceiver> mDisplayEventReceiver;
+ sp<Looper> mLooper;
};
// ---------------------------------------------------------------------------