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

Commit 1399ef20 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4447680 from 00e169ec to pi-release

Change-Id: I2ce42246c22c0719a7ba4dc4326200ca2e566eb5
parents bf7c17ca 00e169ec
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -485,7 +485,7 @@ static void* load_bootable_image(const std::string& kernel, const std::string& r
    return bdata;
}

static void* unzip_file(ZipArchiveHandle zip, const char* entry_name, int64_t* sz) {
static void* unzip_to_memory(ZipArchiveHandle zip, const char* entry_name, int64_t* sz) {
    ZipString zip_entry_name(entry_name);
    ZipEntry zip_entry;
    if (FindEntry(zip, zip_entry_name, &zip_entry) != 0) {
@@ -495,7 +495,7 @@ static void* unzip_file(ZipArchiveHandle zip, const char* entry_name, int64_t* s

    *sz = zip_entry.uncompressed_length;

    fprintf(stderr, "extracting %s (%" PRId64 " MB)...\n", entry_name, *sz / 1024 / 1024);
    fprintf(stderr, "extracting %s (%" PRId64 " MB) to RAM...\n", entry_name, *sz / 1024 / 1024);
    uint8_t* data = reinterpret_cast<uint8_t*>(malloc(zip_entry.uncompressed_length));
    if (data == nullptr) die("failed to allocate %" PRId64 " bytes for '%s'", *sz, entry_name);

@@ -613,17 +613,20 @@ static int unzip_to_file(ZipArchiveHandle zip, const char* entry_name) {
        return -1;
    }

    fprintf(stderr, "extracting %s (%" PRIu32 " MB)...\n", entry_name,
    fprintf(stderr, "extracting %s (%" PRIu32 " MB) to disk...", entry_name,
            zip_entry.uncompressed_length / 1024 / 1024);
    double start = now();
    int error = ExtractEntryToFile(zip, &zip_entry, fd);
    if (error != 0) {
        die("failed to extract '%s': %s", entry_name, ErrorCodeString(error));
        die("\nfailed to extract '%s': %s", entry_name, ErrorCodeString(error));
    }

    if (lseek(fd, 0, SEEK_SET) != 0) {
        die("lseek on extracted file '%s' failed: %s", entry_name, strerror(errno));
        die("\nlseek on extracted file '%s' failed: %s", entry_name, strerror(errno));
    }

    fprintf(stderr, " took %.3fs\n", now() - start);

    return fd.release();
}

@@ -1091,7 +1094,7 @@ static void do_flash(Transport* transport, const char* pname, const char* fname)

static void do_update_signature(ZipArchiveHandle zip, const char* filename) {
    int64_t sz;
    void* data = unzip_file(zip, filename, &sz);
    void* data = unzip_to_memory(zip, filename, &sz);
    if (data == nullptr) return;
    fb_queue_download("signature", data, sz);
    fb_queue_command("signature", "installing signature");
@@ -1130,7 +1133,7 @@ static void do_update(Transport* transport, const char* filename, const std::str
    }

    int64_t sz;
    void* data = unzip_file(zip, "android-info.txt", &sz);
    void* data = unzip_to_memory(zip, "android-info.txt", &sz);
    if (data == nullptr) {
        die("update package '%s' has no android-info.txt", filename);
    }
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ bool fs_mgr_update_for_slotselect(struct fstab *fstab) {
            char *tmp;
            if (ab_suffix.empty()) {
                ab_suffix = fs_mgr_get_slot_suffix();
                // Returns false as non A/B devices should not have MF_SLOTSELECT.
                // Return false if failed to get ab_suffix when MF_SLOTSELECT is specified.
                if (ab_suffix.empty()) return false;
            }
            if (asprintf(&tmp, "%s%s", fstab->recs[n].blk_device, ab_suffix.c_str()) > 0) {
+9 −2
Original line number Diff line number Diff line
@@ -53,7 +53,10 @@ cc_binary {
    init_rc: ["android.hardware.health@2.0-service.rc"],
    vendor: true,
    relative_install_path: "hw",
    srcs: ["HealthService.cpp"],
    srcs: [
        "HealthServiceCommon.cpp",
        "HealthServiceDefault.cpp",
    ],

    cflags: ["-DHEALTH_INSTANCE_NAME=\"default\""],

@@ -77,7 +80,10 @@ cc_binary {

cc_binary {
    name: "healthd",
    srcs: ["HealthService.cpp"],
    srcs: [
        "HealthServiceCommon.cpp",
        "HealthServiceHealthd.cpp",
    ],
    local_include_dirs: ["include"],

    cflags: ["-DHEALTH_INSTANCE_NAME=\"backup\""],
@@ -96,6 +102,7 @@ cc_binary {
        "libhwbinder",
        "liblog",
        "libutils",
        "android.hardware.health@1.0",
        "android.hardware.health@2.0",
    ],

+12 −18
Original line number Diff line number Diff line
@@ -36,38 +36,33 @@ using android::hardware::health::V2_0::implementation::Health;
// see healthd_common.cpp
android::sp<IHealth> gHealth;

static int gBinderFd;

extern int healthd_main(void);

static void binder_event(uint32_t /*epevents*/) {
    IPCThreadState::self()->handlePolledCommands();
}

// TODO(b/67463967): healthd_board_* functions should be removed in health@2.0
int healthd_board_battery_update(struct android::BatteryProperties*)
{
    // return 0 to log periodic polled battery status to kernel log
    return 0;
}

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

    // Implementation-defined init logic goes here.
    // 1. config->periodic_chores_interval_* variables
    // 2. config->battery*Path variables
    // 3. config->energyCounter. In this implementation, energyCounter is not defined.
    LOG(INFO) << LOG_TAG << " Hal is starting up...";

    configureRpcThreadpool(1, false /* callerWillJoin */);
    IPCThreadState::self()->disableBackgroundScheduling(true);
    IPCThreadState::self()->setupPolling(&gBinderFd);
    IPCThreadState::self()->setupPolling(&binderFd);

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

    // Implementation-defined init logic goes here.
    // 1. config->periodic_chores_interval_* variables
    // 2. config->battery*Path variables
    // 3. config->energyCounter. In this implementation, energyCounter is not defined.
    // TODO(b/68724651): healthd_board_* functions should be removed in health@2.0
    healthd_board_init(config);

    gHealth = new ::android::hardware::health::V2_0::implementation::Health(config);
    CHECK_EQ(gHealth->registerAsService(HEALTH_INSTANCE_NAME), android::OK)
        << LOG_TAG << ": Failed to register HAL";
@@ -85,7 +80,6 @@ void healthd_mode_service_2_0_heartbeat(void) {
}

void healthd_mode_service_2_0_battery_update(struct android::BatteryProperties* prop) {

    // Implementation-defined update logic goes here. An implementation
    // can make modifications to prop before broadcasting it to all callbacks.

+26 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 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.
 */

#include <healthd/healthd.h>

void healthd_board_init(struct healthd_config*) {
    // use defaults
}

int healthd_board_battery_update(struct android::BatteryProperties*) {
    // return 0 to log periodic polled battery status to kernel log
    return 0;
}
Loading