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
This commit is contained in:
Yifan Hong 2021-10-20 22:18:16 -07:00
parent b200c60221
commit e3ffd1bfc2
3 changed files with 36 additions and 2 deletions

View file

@ -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 {

View file

@ -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());

View file

@ -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 */