Update frameworks/base patches for android-7.1.1_r21
[GitHub/Stricted/android_vendor_extra.git] / patches / frameworks / base / 0024-N-Extras-Add-dynamic-theme-BootAnimation-support.patch
1 From 7d856f5f2b292f031b79cab69ed2fa52e58e6579 Mon Sep 17 00:00:00 2001
2 From: 0xD34D <clark@scheffsblend.com>
3 Date: Mon, 9 Jan 2017 07:19:41 +0530
4 Subject: [PATCH 24/39] N-Extras: Add dynamic theme BootAnimation support
5
6 Extracted from "Themes: Port to CM13 [1/3]"
7 http://review.cyanogenmod.org/#/c/113273/14
8
9 Change-Id: I394897c10f02695f0416e87e9bf960e840bcb3b7
10 ---
11 cmds/bootanimation/BootAnimation.cpp | 11 ++++++++---
12 cmds/bootanimation/BootAnimation.h | 3 ++-
13 2 files changed, 10 insertions(+), 4 deletions(-)
14
15 diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
16 index d4a9326fc0d..dfa70e3e44c 100644
17 --- a/cmds/bootanimation/BootAnimation.cpp
18 +++ b/cmds/bootanimation/BootAnimation.cpp
19 @@ -68,6 +68,7 @@ namespace android {
20 static const char OEM_BOOTANIMATION_FILE[] = "/oem/media/bootanimation.zip";
21 static const char SYSTEM_BOOTANIMATION_FILE[] = "/system/media/bootanimation.zip";
22 static const char SYSTEM_ENCRYPTED_BOOTANIMATION_FILE[] = "/system/media/bootanimation-encrypted.zip";
23 +static const char THEME_BOOTANIMATION_FILE[] = "/data/system/theme/bootanimation.zip";
24 static const char SYSTEM_DATA_DIR_PATH[] = "/data/system";
25 static const char SYSTEM_TIME_DIR_NAME[] = "time";
26 static const char SYSTEM_TIME_DIR_PATH[] = "/data/system/time";
27 @@ -250,13 +251,14 @@ status_t BootAnimation::initTexture(const Animation::Frame& frame)
28
29
30 // Get bootup Animation File
31 -// Parameter: ImageID: IMG_OEM IMG_SYS IMG_ENC
32 +// Parameter: ImageID: IMG_OEM IMG_SYS IMG_ENC IMG_THM
33 // Return Value : File path
34 const char *BootAnimation::getAnimationFileName(ImageID image)
35 {
36 - const char *fileName[3] = { OEM_BOOTANIMATION_FILE,
37 + const char *fileName[4] = { OEM_BOOTANIMATION_FILE,
38 SYSTEM_BOOTANIMATION_FILE,
39 - SYSTEM_ENCRYPTED_BOOTANIMATION_FILE };
40 + SYSTEM_ENCRYPTED_BOOTANIMATION_FILE,
41 + THEME_BOOTANIMATION_FILE };
42
43 // Load animations of Carrier through regionalization environment
44 if (Environment::isSupported()) {
45 @@ -341,6 +343,9 @@ status_t BootAnimation::readyToRun() {
46 if (encryptedAnimation && (access(getAnimationFileName(IMG_ENC), R_OK) == 0)) {
47 mZipFileName = getAnimationFileName(IMG_ENC);
48 }
49 + else if (access(getAnimationFileName(IMG_THM), R_OK) == 0) {
50 + mZipFileName = getAnimationFileName(IMG_THM);
51 + }
52 else if (access(getAnimationFileName(IMG_OEM), R_OK) == 0) {
53 mZipFileName = getAnimationFileName(IMG_OEM);
54 }
55 diff --git a/cmds/bootanimation/BootAnimation.h b/cmds/bootanimation/BootAnimation.h
56 index c0ae6b6edb1..e779246da46 100644
57 --- a/cmds/bootanimation/BootAnimation.h
58 +++ b/cmds/bootanimation/BootAnimation.h
59 @@ -114,8 +114,9 @@ private:
60 *IMG_OEM: bootanimation file from oem/media
61 *IMG_SYS: bootanimation file from system/media
62 *IMG_ENC: encrypted bootanimation file from system/media
63 + *IMG_THM: bootanimation file from data/system/theme
64 */
65 - enum ImageID { IMG_OEM = 0, IMG_SYS = 1, IMG_ENC = 2 };
66 + enum ImageID { IMG_OEM = 0, IMG_SYS = 1, IMG_ENC = 2, IMG_THM = 3 };
67 const char *getAnimationFileName(ImageID image);
68 status_t initTexture(Texture* texture, AssetManager& asset, const char* name);
69 status_t initTexture(const Animation::Frame& frame);
70 --
71 2.11.1
72