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

Commit be09c954 authored by David Pursell's avatar David Pursell
Browse files

iot bootaction: provide default lib name

We want to provide a sane default for the bootaction library name so
that the developer isn't required to mess with read-only properties to
get this working.

Also small cleanup to remove duplicate and unused libs from Android.mk.

Bug: 67644323
Test: builds (master)
Test: properly loads default lib (nyc-iot-dev)
Test: logs and exits when lib doesn't exist (nyc-iot-dev)
Change-Id: I865a45f43b3594c99419e7e27c9798ee944d0db2
parent 32f38bde
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -34,13 +34,6 @@ LOCAL_SRC_FILES += \
    iot/BootAction.cpp \
    iot/BootParameters.cpp \

LOCAL_SHARED_LIBRARIES += \
    libandroidthings \
    libbase \
    libbinder \

LOCAL_STATIC_LIBRARIES += cpufeatures

else

LOCAL_SRC_FILES += \
+8 −5
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

#define LOG_TAG "IotBootAnimation"

#include <android-base/file.h>
#include <base/files/file_util.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
#include <binder/ProcessState.h>
@@ -31,13 +31,14 @@
#include "BootParameters.h"

using namespace android;
using android::base::ReadFileToString;

// Create a typedef for readability.
typedef android::BootAnimation::Animation Animation;

namespace {

constexpr const char* kDefaultLibName = "libbootaction.so";

class BootActionAnimationCallbacks : public android::BootAnimation::Callbacks {
public:
    BootActionAnimationCallbacks(std::unique_ptr<BootParameters> bootParameters)
@@ -49,11 +50,13 @@ public:
        // This value is optionally provided by the user and will be written to
        // /oem/oem.prop.
        char property[PROP_VALUE_MAX] = {0};
        if (property_get("ro.oem.bootactions.lib", property, "") < 1) {
            ALOGI("No bootaction specified");
        property_get("ro.oem.bootactions.lib", property, kDefaultLibName);
        library_path += property;

        if (!::base::PathExists(::base::FilePath(library_path))) {
            ALOGI("Skipping boot actions: %s does not exist", library_path.c_str());
            return;
        }
        library_path += property;

        mBootAction = new BootAction();
        if (!mBootAction->init(library_path, mBootParameters->getParameters())) {