Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit facebfa8 authored by jinfaw's avatar jinfaw Committed by Linux Build Service Account
Browse files

Framework: Add regional carrier bootanimation

 Add regionalization carrier bootanimation to system
 bootanimation process

Change-Id: I1df06fcaf6e3c7581cb9e77698e0b59c6a384e08
CRs-Fixed: 1025803
parent 59fe09b0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -23,7 +23,8 @@ LOCAL_SHARED_LIBRARIES := \
    libEGL \
    libGLESv1_CM \
    libgui \
    libtinyalsa
    libtinyalsa \
    libregionalization

LOCAL_MODULE:= bootanimation

+38 −6
Original line number Diff line number Diff line
@@ -57,9 +57,12 @@
#include "BootAnimation.h"
#include "AudioPlayer.h"

#include <private/regionalization/Environment.h>

#define OEM_BOOTANIMATION_FILE "/oem/media/bootanimation.zip"
#define SYSTEM_BOOTANIMATION_FILE "/system/media/bootanimation.zip"
#define SYSTEM_ENCRYPTED_BOOTANIMATION_FILE "/system/media/bootanimation-encrypted.zip"

#define EXIT_PROP_NAME "service.bootanim.exit"

namespace android {
@@ -224,6 +227,35 @@ status_t BootAnimation::initTexture(const Animation::Frame& frame)
    return NO_ERROR;
}


// Get bootup Animation File
// Parameter: ImageID: IMG_OEM IMG_SYS IMG_ENC
// Return Value : File path
const char *BootAnimation::getAnimationFileName(ImageID image)
{
    const char *fileName[3] = { OEM_BOOTANIMATION_FILE,
            SYSTEM_BOOTANIMATION_FILE,
            SYSTEM_ENCRYPTED_BOOTANIMATION_FILE };

    // Load animations of Carrier through regionalization environment
    if (Environment::isSupported()) {
        Environment* environment = new Environment();
        const char* animFile = environment->getMediaFile(
                Environment::ANIMATION_TYPE, Environment::BOOT_STATUS);
        ALOGE("Get Carrier Animation type: %d,status:%d", Environment::ANIMATION_TYPE,Environment::BOOT_STATUS);
        if (animFile != NULL && strcmp(animFile, "") != 0) {
           return animFile;
        }else{
           ALOGD("Get Carrier Animation file: %s failed", animFile);
        }
        delete environment;
    }else{
           ALOGE("Get Carrier Animation file,since it's not support carrier");
    }

    return fileName[image];
}

status_t BootAnimation::readyToRun() {
    mAssets.addDefaultAssets();

@@ -285,14 +317,14 @@ status_t BootAnimation::readyToRun() {

    bool encryptedAnimation = atoi(decrypt) != 0 || !strcmp("trigger_restart_min_framework", decrypt);

    if (encryptedAnimation && (access(SYSTEM_ENCRYPTED_BOOTANIMATION_FILE, R_OK) == 0)) {
        mZipFileName = SYSTEM_ENCRYPTED_BOOTANIMATION_FILE;
    if (encryptedAnimation && (access(getAnimationFileName(IMG_ENC), R_OK) == 0)) {
        mZipFileName = getAnimationFileName(IMG_ENC);
    }
    else if (access(OEM_BOOTANIMATION_FILE, R_OK) == 0) {
        mZipFileName = OEM_BOOTANIMATION_FILE;
    else if (access(getAnimationFileName(IMG_OEM), R_OK) == 0) {
        mZipFileName = getAnimationFileName(IMG_OEM);
    }
    else if (access(SYSTEM_BOOTANIMATION_FILE, R_OK) == 0) {
        mZipFileName = SYSTEM_BOOTANIMATION_FILE;
    else if (access(getAnimationFileName(IMG_SYS), R_OK) == 0) {
        mZipFileName = getAnimationFileName(IMG_SYS);
    }
    return NO_ERROR;
}
+7 −0
Original line number Diff line number Diff line
@@ -87,6 +87,13 @@ private:
        ZipFileRO* zip;
    };

    /**
     *IMG_OEM: bootanimation file from oem/media
     *IMG_SYS: bootanimation file from system/media
     *IMG_ENC: encrypted bootanimation file from system/media
     */
    enum ImageID { IMG_OEM = 0, IMG_SYS = 1, IMG_ENC = 2 };
    const char *getAnimationFileName(ImageID image);
    status_t initTexture(Texture* texture, AssetManager& asset, const char* name);
    status_t initTexture(const Animation::Frame& frame);
    bool android();