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

Commit a10fd8df authored by Mathias Agopian's avatar Mathias Agopian
Browse files

Merge commit 'goog/master' into merge_master

parents af20325a f8b8288c
Loading
Loading
Loading
Loading
+3 −55
Original line number Diff line number Diff line
@@ -33,10 +33,6 @@
#  endif
#endif

#ifndef HAVE_WIN32_PROC
#include <sys/poll.h>
#endif

typedef struct stinfo stinfo;

struct stinfo {
@@ -271,54 +267,6 @@ static int create_subprocess(const char *cmd, const char *arg0, const char *arg1
#define SHELL_COMMAND "/system/bin/sh"
#endif

static void shell_service(int s, void *command)
{
    char    buffer[MAX_PAYLOAD];
    int     fd, ret = 0;
    unsigned count = 0;

    fd = create_subprocess(SHELL_COMMAND, "-c", (char *)command);

    while (1) {
        while (count < sizeof(buffer)) {
#ifndef HAVE_WIN32_PROC
            /* add a 200ms timeout so we don't block indefinitely with our
               buffer partially filled.
            */
            if (count > 0) {
                struct pollfd pollfd;

                pollfd.fd = fd;
                pollfd.events = POLLIN;
                ret = poll(&pollfd, 1, 200);
                if (ret <= 0) {
                    D("poll returned %d\n", ret);
                    // file has closed or we timed out
                    // set ret to 1 so we don't exit the outer loop
                    ret = 1;
                    break;
                }
            }
#endif
            ret = adb_read(fd, buffer + count, sizeof(buffer) - count);
            D("ret: %d, count: %d\n", ret, count);
            if (ret > 0)
                count += ret;
            else
                break;
        }

        D("writing: %d\n", count);
        adb_write(s, buffer, count);
        count = 0;
        if (ret <= 0)
            break;
    }

    adb_close(fd);
    adb_close(s);
}

int service_to_fd(const char *name)
{
    int ret = -1;
@@ -372,7 +320,7 @@ int service_to_fd(const char *name)
#endif
    } else if(!HOST && !strncmp(name, "shell:", 6)) {
        if(name[6]) {
            ret = create_service_thread(shell_service, (void *)(name + 6));
            ret = create_subprocess(SHELL_COMMAND, "-c", name + 6);
        } else {
            ret = create_subprocess(SHELL_COMMAND, "-", 0);
        }
+4 −2
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@
#define AID_DHCP          1014  /* dhcp client */
#define AID_SDCARD_RW     1015  /* external storage write access */
#define AID_VPN           1016  /* vpn system */
#define AID_KEYSTORE      1017  /* keystore subsystem */

#define AID_SHELL         2000  /* adb and debug shell user */
#define AID_CACHE         2001  /* cache access */
@@ -97,6 +98,7 @@ static struct android_id_info android_ids[] = {
    { "net_bt",    AID_NET_BT, },
    { "sdcard_rw", AID_SDCARD_RW, },
    { "vpn",       AID_VPN, },
    { "keystore",  AID_KEYSTORE, },
    { "inet",      AID_INET, },
    { "net_raw",   AID_NET_RAW, },
    { "misc",      AID_MISC, },
@@ -155,7 +157,7 @@ static struct fs_path_config android_files[] = {
    { 00550, AID_ROOT,      AID_SHELL,     "system/etc/init.gprs-pppd" },
    { 00550, AID_DHCP,      AID_SHELL,     "system/etc/dhcpcd/dhcpcd-run-hooks" },
    { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/dbus.conf" },
    { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluez/hcid.conf" },
    { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluez/main.conf" },
    { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluez/input.conf" },
    { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluez/audio.conf" },
    { 00440, AID_RADIO,     AID_AUDIO,     "/system/etc/AudioPara4.csv" },
+1 −1
Original line number Diff line number Diff line
@@ -21,8 +21,8 @@
#include <stddef.h>
#include <string.h>
#include <sys/types.h>
#include <endian.h>

#include <utils/Endian.h>
#include <pixelflinger/pixelflinger.h>
#include <private/pixelflinger/ggl_fixed.h>

+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ public:
    FrameworkCommand(const char *cmd);
    virtual ~FrameworkCommand() { }

    virtual int runCommand(SocketClient *c, char *data) = 0;
    virtual int runCommand(SocketClient *c, int argc, char **argv) = 0;

    const char *getCommand() { return mCommand; }
};
+3 −1
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@
class SocketClient;

class FrameworkListener : public SocketListener {
public:
    static const int CMD_ARGS_MAX = 8;
private:
    FrameworkCommandCollection *mCommands;

@@ -34,6 +36,6 @@ protected:
    virtual bool onDataAvailable(SocketClient *c);

private:
    void dispatchCommand(SocketClient *c, char *cmd);
    void dispatchCommand(SocketClient *c, char *data);
};
#endif
Loading