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

Commit 73a5ee4d authored by Josh Gao's avatar Josh Gao
Browse files

adb: use adb's unique_fd instead of android::base.

Replace all usages of android::base::unique_fd with the unique_fd from
adb_unique_fd.h, which calls adb_close instead of close on Windows.

Most of these changes are no-ops, except for the ones to
create_service_thread, which was probably pretty broken on Windows.

Test: python test_device.py
Test: adb_test
Test: wine adb_test.exe
Change-Id: Ia4d03f9e2e7ddc88c97dc64172d721f93f3bf853
parent 2deb787e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -527,7 +527,7 @@ static bool handle_sync_command(int fd, std::vector<char>& buffer) {
    return true;
}

void file_sync_service(android::base::unique_fd fd) {
void file_sync_service(unique_fd fd) {
    std::vector<char> buffer(SYNC_DATA_MAX);

    while (handle_sync_command(fd.get(), buffer)) {
+4 −4
Original line number Diff line number Diff line
#pragma once

/*
 * Copyright (C) 2018 The Android Open Source Project
 *
@@ -16,6 +14,8 @@
 * limitations under the License.
 */

#include <android-base/unique_fd.h>
#pragma once

#include "adb_unique_fd.h"

void file_sync_service(android::base::unique_fd fd);
void file_sync_service(unique_fd fd);
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ struct fbinfo {
    unsigned int alpha_length;
} __attribute__((packed));

void framebuffer_service(android::base::unique_fd fd) {
void framebuffer_service(unique_fd fd) {
    struct fbinfo fbinfo;
    unsigned int i, bsize;
    char buf[640];
+3 −6
Original line number Diff line number Diff line
@@ -14,11 +14,8 @@
 * limitations under the License.
 */

#ifndef _DAEMON_FRAMEBUFFER_SERVICE_H_
#define _DAEMON_FRAMEBUFFER_SERVICE_H_
#pragma once

#include <android-base/unique_fd.h>
#include "adb_unique_fd.h"

void framebuffer_service(android::base::unique_fd fd);

#endif  // _DAEMON_FRAMEBUFFER_SERVICE_H_
void framebuffer_service(unique_fd fd);
+2 −2
Original line number Diff line number Diff line
@@ -215,7 +215,7 @@ static void reboot_for_remount(int fd, bool need_fsck) {
    android::base::SetProperty(ANDROID_RB_PROPERTY, reboot_cmd.c_str());
}

void remount_service(android::base::unique_fd fd, const std::string& cmd) {
void remount_service(unique_fd fd, const std::string& cmd) {
    bool user_requested_reboot = cmd != "-R";

    if (getuid() != 0) {
@@ -251,7 +251,7 @@ void remount_service(android::base::unique_fd fd, const std::string& cmd) {
    if (user_requested_reboot) {
        if (!dedup.empty() || verity_enabled) {
            if (verity_enabled) {
                set_verity_enabled_state_service(android::base::unique_fd(dup(fd.get())), false);
                set_verity_enabled_state_service(unique_fd(dup(fd.get())), false);
            }
            reboot_for_remount(fd.get(), !dedup.empty());
            return;
Loading