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

Commit 1cdd1b5a authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

Merge tag 'android-6.0.0_r26' into HEAD

Android 6.0.0 release 26

Conflicts:
	include/android/input.h

Change-Id: Ifa374c6d3055be3b8a5d60967f8b4c0043da739b
parents 5e78568d 3492a218
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -264,9 +264,27 @@ static bool appendStr(const char* filename, const char* str)
static void writeClockSyncMarker()
{
  char buffer[128];
  int len = 0;
  int fd = open(k_traceMarkerPath, O_WRONLY);
  if (fd == -1) {
      fprintf(stderr, "error opening %s: %s (%d)\n", k_traceMarkerPath,
              strerror(errno), errno);
      return;
  }
  float now_in_seconds = systemTime(CLOCK_MONOTONIC) / 1000000000.0f;
  snprintf(buffer, 128, "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds);
  writeStr(k_traceMarkerPath, buffer);

  len = snprintf(buffer, 128, "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds);
  if (write(fd, buffer, len) != len) {
      fprintf(stderr, "error writing clock sync marker %s (%d)\n", strerror(errno), errno);
  }

  int64_t realtime_in_ms = systemTime(CLOCK_REALTIME) / 1000000;
  len = snprintf(buffer, 128, "trace_event_clock_sync: realtime_ts=%" PRId64 "\n", realtime_in_ms);
  if (write(fd, buffer, len) != len) {
      fprintf(stderr, "error writing clock sync marker %s (%d)\n", strerror(errno), errno);
  }

  close(fd);
}

// Enable or disable a kernel option by writing a "1" or a "0" into a /sys
@@ -646,7 +664,6 @@ static bool startTrace()
// Disable tracing in the kernel.
static void stopTrace()
{
    writeClockSyncMarker();
    setTracingEnabled(false);
}

@@ -940,6 +957,7 @@ int main(int argc, char **argv)
        // another.
        ok = clearTrace();

        writeClockSyncMarker();
        if (ok && !async) {
            // Sleep to allow the trace to be captured.
            struct timespec timeLeft;
+15 −13
Original line number Diff line number Diff line
@@ -434,8 +434,6 @@ static void dumpstate() {
    run_command("ARP CACHE", 10, "ip", "-4", "neigh", "show", NULL);
    run_command("IPv6 ND CACHE", 10, "ip", "-6", "neigh", "show", NULL);

    run_command("NETWORK DIAGNOSTICS", 10, "dumpsys", "connectivity", "--diag", NULL);

    run_command("IPTABLES", 10, SU_PATH, "root", "iptables", "-L", "-nvx", NULL);
    run_command("IP6TABLES", 10, SU_PATH, "root", "ip6tables", "-L", "-nvx", NULL);
    run_command("IPTABLE NAT", 10, SU_PATH, "root", "iptables", "-t", "nat", "-L", "-nvx", NULL);
@@ -447,25 +445,29 @@ static void dumpstate() {
            SU_PATH, "root", "wpa_cli", "IFNAME=wlan0", "list_networks", NULL);

#ifdef FWDUMP_bcmdhd
    run_command("DUMP WIFI INTERNAL COUNTERS", 20,
    run_command("ND OFFLOAD TABLE", 5,
            SU_PATH, "root", "wlutil", "nd_hostip", NULL);

    run_command("DUMP WIFI INTERNAL COUNTERS (1)", 20,
            SU_PATH, "root", "wlutil", "counters", NULL);

    run_command("ND OFFLOAD STATUS (1)", 5,
            SU_PATH, "root", "wlutil", "nd_status", NULL);

#endif
    dump_file("INTERRUPTS (1)", "/proc/interrupts");

    property_get("dhcp.wlan0.gateway", network, "");
    if (network[0])
        run_command("PING GATEWAY", 10, "ping", "-c", "3", "-i", ".5", network, NULL);
    property_get("dhcp.wlan0.dns1", network, "");
    if (network[0])
        run_command("PING DNS1", 10, "ping", "-c", "3", "-i", ".5", network, NULL);
    property_get("dhcp.wlan0.dns2", network, "");
    if (network[0])
        run_command("PING DNS2", 10, "ping", "-c", "3", "-i", ".5", network, NULL);
    run_command("NETWORK DIAGNOSTICS", 10, "dumpsys", "connectivity", "--diag", NULL);

#ifdef FWDUMP_bcmdhd
    run_command("DUMP WIFI STATUS", 20,
            SU_PATH, "root", "dhdutil", "-i", "wlan0", "dump", NULL);
    run_command("DUMP WIFI INTERNAL COUNTERS", 20,

    run_command("DUMP WIFI INTERNAL COUNTERS (2)", 20,
            SU_PATH, "root", "wlutil", "counters", NULL);

    run_command("ND OFFLOAD STATUS (2)", 5,
            SU_PATH, "root", "wlutil", "nd_status", NULL);
#endif
    dump_file("INTERRUPTS (2)", "/proc/interrupts");

+35 −13
Original line number Diff line number Diff line
@@ -746,7 +746,7 @@ static bool check_boolean_property(const char* property_name, bool default_value

static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
    const char* output_file_name, int swap_fd, const char *pkgname, const char *instruction_set,
    bool vm_safe_mode, bool debuggable)
    bool vm_safe_mode, bool debuggable, bool post_bootcomplete)
{
    static const unsigned int MAX_INSTRUCTION_SET_LEN = 7;

@@ -770,8 +770,24 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
                                                          dex2oat_compiler_filter_flag, NULL) > 0;

    char dex2oat_threads_buf[PROPERTY_VALUE_MAX];
    bool have_dex2oat_threads_flag = property_get("dalvik.vm.dex2oat-threads", dex2oat_threads_buf,
    bool have_dex2oat_threads_flag = false;
    if (!post_bootcomplete) {
        have_dex2oat_threads_flag = property_get("dalvik.vm.boot-dex2oat-threads",
                                                 dex2oat_threads_buf,
                                                 NULL) > 0;
        // If there's no boot property, fall back to the image property.
        if (!have_dex2oat_threads_flag) {
            have_dex2oat_threads_flag = property_get("dalvik.vm.image-dex2oat-threads",
                                                     dex2oat_threads_buf,
                                                     NULL) > 0;
        }
        // If there's neither, fall back to the default property.
    }
    if (!have_dex2oat_threads_flag) {
        have_dex2oat_threads_flag = property_get("dalvik.vm.dex2oat-threads",
                                                 dex2oat_threads_buf,
                                                 NULL) > 0;
    }
    char dex2oat_threads_arg[PROPERTY_VALUE_MAX + 2];
    if (have_dex2oat_threads_flag) {
        sprintf(dex2oat_threads_arg, "-j%s", dex2oat_threads_buf);
@@ -1065,9 +1081,22 @@ static bool calculate_odex_file_path(char path[PKG_PATH_MAX],
    return true;
}

static void SetDex2OatAndPatchOatScheduling(bool set_to_bg) {
    if (set_to_bg) {
        if (set_sched_policy(0, SP_BACKGROUND) < 0) {
            ALOGE("set_sched_policy failed: %s\n", strerror(errno));
            exit(70);
        }
        if (setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_BACKGROUND) < 0) {
            ALOGE("setpriority failed: %s\n", strerror(errno));
            exit(71);
        }
    }
}

int dexopt(const char *apk_path, uid_t uid, bool is_public,
           const char *pkgname, const char *instruction_set, int dexopt_needed,
           bool vm_safe_mode, bool debuggable, const char* oat_dir)
           bool vm_safe_mode, bool debuggable, const char* oat_dir, bool boot_complete)
{
    struct utimbuf ut;
    struct stat input_stat;
@@ -1198,14 +1227,7 @@ int dexopt(const char *apk_path, uid_t uid, bool is_public,
            ALOGE("capset failed: %s\n", strerror(errno));
            exit(66);
        }
        if (set_sched_policy(0, SP_BACKGROUND) < 0) {
            ALOGE("set_sched_policy failed: %s\n", strerror(errno));
            exit(70);
        }
        if (setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_BACKGROUND) < 0) {
            ALOGE("setpriority failed: %s\n", strerror(errno));
            exit(71);
        }
        SetDex2OatAndPatchOatScheduling(boot_complete);
        if (flock(out_fd, LOCK_EX | LOCK_NB) != 0) {
            ALOGE("flock(%s) failed: %s\n", out_path, strerror(errno));
            exit(67);
@@ -1222,7 +1244,7 @@ int dexopt(const char *apk_path, uid_t uid, bool is_public,
                input_file_name++;
            }
            run_dex2oat(input_fd, out_fd, input_file_name, out_path, swap_fd, pkgname,
                        instruction_set, vm_safe_mode, debuggable);
                        instruction_set, vm_safe_mode, debuggable, boot_complete);
        } else {
            ALOGE("Invalid dexopt needed: %d\n", dexopt_needed);
            exit(73);
+3 −3
Original line number Diff line number Diff line
@@ -48,9 +48,9 @@ static int do_install(char **arg, char reply[REPLY_MAX] __unused)
static int do_dexopt(char **arg, char reply[REPLY_MAX] __unused)
{
    /* apk_path, uid, is_public, pkgname, instruction_set,
     * dexopt_needed, vm_safe_mode, debuggable, oat_dir */
     * dexopt_needed, vm_safe_mode, debuggable, oat_dir, boot_complete */
    return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]),
                  atoi(arg[6]), atoi(arg[7]), arg[8]);
                  atoi(arg[6]), atoi(arg[7]), arg[8], atoi(arg[9]));
}

static int do_mark_boot_complete(char **arg, char reply[REPLY_MAX] __unused)
@@ -204,7 +204,7 @@ struct cmdinfo {
struct cmdinfo cmds[] = {
    { "ping",                 0, do_ping },
    { "install",              5, do_install },
    { "dexopt",               9, do_dexopt },
    { "dexopt",               10, do_dexopt },
    { "markbootcomplete",     1, do_mark_boot_complete },
    { "movedex",              3, do_move_dex },
    { "rmdex",                2, do_rm_dex },
+1 −1
Original line number Diff line number Diff line
@@ -243,7 +243,7 @@ int get_size(const char *uuid, const char *pkgname, int userid,
int free_cache(const char *uuid, int64_t free_size);
int dexopt(const char *apk_path, uid_t uid, bool is_public, const char *pkgName,
           const char *instruction_set, int dexopt_needed, bool vm_safe_mode,
           bool debuggable, const char* oat_dir);
           bool debuggable, const char* oat_dir, bool boot_complete);
int mark_boot_complete(const char *instruction_set);
int movefiles();
int linklib(const char* uuid, const char* pkgname, const char* asecLibDir, int userId);
Loading