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

Commit e3ffd1bf authored by Yifan Hong's avatar Yifan Hong
Browse files

charger: make libhealthd_charger_ui vendor_available.

This is a prerequisite to move charger to vendor partition.

Because vendor domains can't read ro.charger.*, they are all assumed
to be the default value. They aren't set in the ecosystem anyway,
so it is time to deprecate them.

Test: builds
Bug: 203246116
Change-Id: I0b17e62ab3ac5a89df091333fd9f24e33bdfd49a
parent b200c602
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ sysprop_library {

cc_library_static {
    name: "libhealthd_draw",
    vendor_available: true,
    export_include_dirs: ["."],
    static_libs: [
        "libcharger_sysprop",
@@ -117,10 +118,19 @@ cc_library_static {
    header_libs: ["libbatteryservice_headers"],

    srcs: ["healthd_draw.cpp"],

    target: {
        vendor: {
            exclude_static_libs: [
                "libcharger_sysprop",
            ],
        },
    },
}

cc_library_static {
    name: "libhealthd_charger_ui",
    vendor_available: true,
    export_include_dirs: [
        "include",
        "include_charger",
@@ -156,6 +166,14 @@ cc_library_static {
        "healthd_mode_charger.cpp",
        "AnimationParser.cpp",
    ],

    target: {
        vendor: {
            exclude_static_libs: [
                "libcharger_sysprop",
            ],
        },
    },
}

cc_library_static {
+12 −1
Original line number Diff line number Diff line
@@ -18,19 +18,30 @@
#include <batteryservice/BatteryService.h>
#include <cutils/klog.h>

#include "charger.sysprop.h"
#include "healthd_draw.h"

#if !defined(__ANDROID_VNDK__)
#include "charger.sysprop.h"
#endif

#define LOGE(x...) KLOG_ERROR("charger", x);
#define LOGW(x...) KLOG_WARNING("charger", x);
#define LOGV(x...) KLOG_DEBUG("charger", x);

static bool get_split_screen() {
#if !defined(__ANDROID_VNDK__)
    return android::sysprop::ChargerProperties::draw_split_screen().value_or(false);
#else
    return false;
#endif
}

static int get_split_offset() {
#if !defined(__ANDROID_VNDK__)
    int64_t value = android::sysprop::ChargerProperties::draw_split_offset().value_or(0);
#else
    int64_t value = 0;
#endif
    if (value < static_cast<int64_t>(std::numeric_limits<int>::min())) {
        LOGW("draw_split_offset = %" PRId64 " overflow for an int; resetting to %d.\n", value,
             std::numeric_limits<int>::min());
+6 −1
Original line number Diff line number Diff line
@@ -50,13 +50,16 @@
#include <suspend/autosuspend.h>

#include "AnimationParser.h"
#include "charger.sysprop.h"
#include "healthd_draw.h"

#include <aidl/android/hardware/health/BatteryStatus.h>
#include <health/HealthLoop.h>
#include <healthd/healthd.h>

#if !defined(__ANDROID_VNDK__)
#include "charger.sysprop.h"
#endif

using std::string_literals::operator""s;
using namespace android;
using aidl::android::hardware::health::BatteryStatus;
@@ -314,10 +317,12 @@ void Charger::UpdateScreenState(int64_t now) {
        healthd_draw_ = HealthdDraw::Create(&batt_anim_);
        if (healthd_draw_ == nullptr) return;

#if !defined(__ANDROID_VNDK__)
        if (android::sysprop::ChargerProperties::disable_init_blank().value_or(false)) {
            healthd_draw_->blank_screen(true);
            screen_blanked_ = true;
        }
#endif
    }

    /* animation is over, blank screen and leave */