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

Commit 6de3641a authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4560043 from 736e4f10 to pi-release

Change-Id: Idd461216979557c07a5b6089abec76afb9a26203
parents a98c6e31 736e4f10
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -26,12 +26,10 @@ cc_binary {
    vendor: true,
    relative_install_path: "hw",
    srcs: [
        "HealthServiceCommon.cpp",
        "HealthServiceDefault.cpp",
    ],

    cflags: [
        "-DHEALTH_INSTANCE_NAME=\"default\"",
        "-Wall",
        "-Werror",
    ],
@@ -39,6 +37,7 @@ cc_binary {
    static_libs: [
        "android.hardware.health@2.0-impl",
        "android.hardware.health@1.0-convert",
        "libhealthservice",
        "libhealthstoragedefault",
        "libbatterymonitor",
    ],
@@ -58,13 +57,11 @@ cc_binary {
cc_binary {
    name: "healthd",
    srcs: [
        "HealthServiceCommon.cpp",
        "HealthServiceHealthd.cpp",
    ],
    local_include_dirs: ["include"],

    cflags: [
        "-DHEALTH_INSTANCE_NAME=\"backup\"",
        "-Wall",
        "-Werror",
    ],
@@ -72,6 +69,7 @@ cc_binary {
    static_libs: [
        "android.hardware.health@2.0-impl",
        "android.hardware.health@1.0-convert",
        "libhealthservice",
        "libbatterymonitor",
        "libhealthstoragedefault",
    ],

healthd/HealthServiceCommon.cpp

deleted100644 → 0
+0 −89
Original line number Diff line number Diff line
/*
 * Copyright 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// This is a reference implementation for health@2.0 HAL. A vendor
// can write its own HealthService.cpp with customized init and update functions.

#define LOG_TAG "health@2.0/" HEALTH_INSTANCE_NAME
#include <android-base/logging.h>

#include <android/hardware/health/1.0/types.h>
#include <hal_conversion.h>
#include <health2/Health.h>
#include <healthd/healthd.h>
#include <hidl/HidlTransportSupport.h>

using android::hardware::IPCThreadState;
using android::hardware::configureRpcThreadpool;
using android::hardware::handleTransportPoll;
using android::hardware::setupTransportPolling;
using android::hardware::health::V2_0::HealthInfo;
using android::hardware::health::V1_0::hal_conversion::convertToHealthInfo;
using android::hardware::health::V2_0::IHealth;
using android::hardware::health::V2_0::implementation::Health;

extern int healthd_main(void);

static int gBinderFd = -1;

static void binder_event(uint32_t /*epevents*/) {
    if (gBinderFd >= 0) handleTransportPoll(gBinderFd);
}

void healthd_mode_service_2_0_init(struct healthd_config* config) {
    LOG(INFO) << LOG_TAG << " Hal is starting up...";

    gBinderFd = setupTransportPolling();

    if (gBinderFd >= 0) {
        if (healthd_register_event(gBinderFd, binder_event))
            LOG(ERROR) << LOG_TAG << ": Register for binder events failed";
    }

    android::sp<IHealth> service = Health::initInstance(config);
    CHECK_EQ(service->registerAsService(HEALTH_INSTANCE_NAME), android::OK)
        << LOG_TAG << ": Failed to register HAL";

    LOG(INFO) << LOG_TAG << ": Hal init done";
}

int healthd_mode_service_2_0_preparetowait(void) {
    IPCThreadState::self()->flushCommands();
    return -1;
}

void healthd_mode_service_2_0_heartbeat(void) {
    // noop
}

void healthd_mode_service_2_0_battery_update(struct android::BatteryProperties* prop) {
    HealthInfo info;
    convertToHealthInfo(prop, info.legacy);
    Health::getImplementation()->notifyListeners(&info);
}

static struct healthd_mode_ops healthd_mode_service_2_0_ops = {
    .init = healthd_mode_service_2_0_init,
    .preparetowait = healthd_mode_service_2_0_preparetowait,
    .heartbeat = healthd_mode_service_2_0_heartbeat,
    .battery_update = healthd_mode_service_2_0_battery_update,
};

int main() {
    healthd_mode_ops = &healthd_mode_service_2_0_ops;
    LOG(INFO) << LOG_TAG << ": Hal starting main loop...";
    return healthd_main();
}
+5 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
 * limitations under the License.
 */

#include <health2/service.h>
#include <healthd/healthd.h>

void healthd_board_init(struct healthd_config*) {
@@ -32,3 +33,7 @@ int healthd_board_battery_update(struct android::BatteryProperties*) {
    // return 0 to log periodic polled battery status to kernel log
    return 0;
}

int main() {
    return health_service_main();
}
+5 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <android/hardware/health/1.0/IHealth.h>
#include <android/hardware/health/1.0/types.h>
#include <hal_conversion.h>
#include <health2/service.h>
#include <healthd/healthd.h>
#include <hidl/HidlTransportSupport.h>

@@ -86,3 +87,7 @@ int healthd_board_battery_update(struct android::BatteryProperties* props) {

    return logthis;
}

int main() {
    return health_service_main("backup");
}
+42 −69
Original line number Diff line number Diff line
@@ -58,6 +58,34 @@ cc_defaults {
            cppflags: ["-DUSER_MODE_LINUX"],
        }
    },
    static_libs: [
        "libbootloader_message",
        "libfs_mgr",
        "libfec",
        "libfec_rs",
        "libhidl-gen-utils",
        "libsquashfs_utils",
        "liblogwrap",
        "libext4_utils",
        "libcutils",
        "libbase",
        "libc",
        "libseccomp_policy",
        "libselinux",
        "liblog",
        "libcrypto_utils",
        "libcrypto",
        "libc++_static",
        "libdl",
        "libsparse",
        "libz",
        "libprocessgroup",
        "libavb",
        "libkeyutils",
        "libprotobuf-cpp-lite",
        "libpropertyinfoserializer",
        "libpropertyinfoparser",
    ],
}

cc_library_static {
@@ -65,40 +93,38 @@ cc_library_static {
    defaults: ["init_defaults"],
    srcs: [
        "action.cpp",
        "bootchart.cpp",
        "builtins.cpp",
        "capabilities.cpp",
        "descriptors.cpp",
        "devices.cpp",
        "firmware_handler.cpp",
        "import_parser.cpp",
        "init.cpp",
        "init_first_stage.cpp",
        "keychords.cpp",
        "log.cpp",
        "parser.cpp",
        "persistent_properties.cpp",
        "persistent_properties.proto",
        "property_service.cpp",
        "property_type.cpp",
        "reboot.cpp",
        "security.cpp",
        "selinux.cpp",
        "service.cpp",
        "sigchld_handler.cpp",
        "subcontext.cpp",
        "subcontext.proto",
        "rlimit_parser.cpp",
        "tokenizer.cpp",
        "uevent_listener.cpp",
        "ueventd.cpp",
        "ueventd_parser.cpp",
        "util.cpp",
        "watchdogd.cpp",
    ],
    whole_static_libs: ["libcap"],
    static_libs: [
        "libbase",
        "libhidl-gen-utils",
        "libselinux",
        "liblog",
        "libprocessgroup",
        "libfs_mgr",
        "libprotobuf-cpp-lite",
        "libpropertyinfoserializer",
        "libpropertyinfoparser",
    ],
    include_dirs: [
        "system/core/mkbootimg",
    ],
@@ -125,42 +151,7 @@ cc_binary {
        "make_f2fs",
    ],
    static_executable: true,
    srcs: [
        "bootchart.cpp",
        "builtins.cpp",
        "init.cpp",
        "init_first_stage.cpp",
        "keychords.cpp",
        "reboot.cpp",
        "sigchld_handler.cpp",
        "ueventd.cpp",
        "watchdogd.cpp",
    ],
    static_libs: [
        "libinit",
        "libbootloader_message",
        "libfs_mgr",
        "libfec",
        "libfec_rs",
        "libhidl-gen-utils",
        "libsquashfs_utils",
        "liblogwrap",
        "libext4_utils",
        "libcutils",
        "libbase",
        "libc",
        "libselinux",
        "liblog",
        "libcrypto_utils",
        "libcrypto",
        "libc++_static",
        "libdl",
        "libsparse",
        "libz",
        "libprocessgroup",
        "libavb",
        "libkeyutils",
    ],
    srcs: ["main.cpp"],
    symlinks: [
        "sbin/ueventd",
        "sbin/watchdogd",
@@ -174,6 +165,7 @@ cc_binary {
cc_test {
    name: "init_tests",
    defaults: ["init_defaults"],
    static_executable: true,
    srcs: [
        "devices_test.cpp",
        "init_test.cpp",
@@ -187,36 +179,17 @@ cc_test {
        "ueventd_test.cpp",
        "util_test.cpp",
    ],
    shared_libs: [
        "libbase",
        "libcutils",
    ],
    static_libs: [
        "libinit",
        "libhidl-gen-utils",
        "libselinux",
        "libcrypto",
        "libprotobuf-cpp-lite",
        "libpropertyinfoparser",
    ],
    static_libs: ["libinit"],
}

cc_benchmark {
    name: "init_benchmarks",
    static_executable: true,
    defaults: ["init_defaults"],
    srcs: [
        "subcontext_benchmark.cpp",
    ],
    shared_libs: [
        "libbase",
        "libcutils",
    ],
    static_libs: [
        "libinit",
        "libselinux",
        "libcrypto",
        "libprotobuf-cpp-lite",
    ],
    static_libs: ["libinit"],
}

subdirs = ["*"]
Loading