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

Commit 117a99e4 authored by Ethan Chen's avatar Ethan Chen Committed by Gerrit Code Review
Browse files

bootanimation: Set CPU boost hint

Change-Id: Idaefc6fa5044afb3ca6b40e70e81cf01307adb51
parent f1b4f65f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ LOCAL_SHARED_LIBRARIES := \
	libandroidfw \
	libutils \
	libbinder \
	libhardware \
    libui \
	libskia \
    libEGL \
+22 −0
Original line number Diff line number Diff line
@@ -56,6 +56,8 @@
#include <media/mediaplayer.h>
#include <media/IMediaHTTPService.h>

#include <hardware/power.h>

#include "BootAnimation.h"
#include "AudioPlayer.h"

@@ -117,6 +119,24 @@ class MPlayerListener : public MediaPlayerListener
    }
};

static void setPowerHint(int durationMs) {
    int rc;
    power_module_t *power_module = NULL;

    rc = hw_get_module(POWER_HARDWARE_MODULE_ID,
            (const hw_module_t **)&power_module);
    if (rc) {
        ALOGE("%s: Failed to obtain reference to power module %s\n",
                __func__, strerror(-rc));
        return;
    }

    if (power_module && power_module->powerHint) {
        power_module->powerHint(power_module, POWER_HINT_CPU_BOOST,
                (void *)(static_cast<int64_t>(durationMs)));
    }
}

static long getFreeMemory(void)
{
    int fd = open("/proc/meminfo", O_RDONLY);
@@ -772,6 +792,8 @@ bool BootAnimation::movie()

        }

        setPowerHint(frameDuration * 1000 * fcount);

        for (int r=0 ; !part.count || r<part.count ; r++) {
            // Exit any non playuntil complete parts immediately
            if(exitPending() && !part.playUntilComplete)