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

Commit f11e2bd0 authored by Xin Li's avatar Xin Li
Browse files

Merge pi-dev-plus-aosp-without-vendor into stage-aosp-master

Bug: 79597307
Change-Id: I6d6bee71b9424eb478780bbfc06b830eb8ded342
parents aabd6b7f 5c947cdf
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@ cc_binary {
        "libcutils",
        "libz",
        "libbase",
    ],
    static_libs: [
        "libpdx_default_transport",
    ],

+5 −1
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ static const TracingCategory k_categories[] = {
        { OPT,      "events/sched/sched_waking/enable" },
        { OPT,      "events/sched/sched_blocked_reason/enable" },
        { OPT,      "events/sched/sched_cpu_hotplug/enable" },
        { OPT,      "events/sched/sched_pi_setprio/enable" },
        { OPT,      "events/cgroup/enable" },
    } },
    { "irq",        "IRQ Events",   0, {
@@ -187,7 +188,10 @@ static const TracingCategory k_categories[] = {
        { REQ,      "events/cpufreq_interactive/enable" },
    } },
    { "sync",       "Synchronization",  0, {
        { REQ,      "events/sync/enable" },
        // before linux kernel 4.9
        { OPT,      "events/sync/enable" },
        // starting in linux kernel 4.9
        { OPT,      "events/fence/enable" },
    } },
    { "workq",      "Kernel Workqueues", 0, {
        { REQ,      "events/workqueue/enable" },
+9 −1
Original line number Diff line number Diff line
## Permissions to allow system-wide tracing to the kernel trace buffer.
##
on post-fs
on late-init

# Allow writing to the kernel trace log.
    chmod 0222 /sys/kernel/debug/tracing/trace_marker
@@ -29,6 +29,8 @@ on post-fs
    chmod 0666 /sys/kernel/tracing/events/sched/sched_blocked_reason/enable
    chmod 0666 /sys/kernel/debug/tracing/events/sched/sched_cpu_hotplug/enable
    chmod 0666 /sys/kernel/tracing/events/sched/sched_cpu_hotplug/enable
    chmod 0666 /sys/kernel/debug/tracing/events/sched/sched_pi_setprio/enable
    chmod 0666 /sys/kernel/tracing/events/sched/sched_pi_setprio/enable
    chmod 0666 /sys/kernel/debug/tracing/events/cgroup/enable
    chmod 0666 /sys/kernel/tracing/events/cgroup/enable
    chmod 0666 /sys/kernel/debug/tracing/events/power/cpu_frequency/enable
@@ -119,6 +121,12 @@ on post-fs
    chmod 0666 /sys/kernel/tracing/events/block/block_rq_complete/enable
    chmod 0666 /sys/kernel/debug/tracing/events/block/block_rq_complete/enable

    # graphics
    chmod 0666 /sys/kernel/tracing/events/sde/enable
    chmod 0666 /sys/kernel/debug/tracing/events/sde/enable
    chmod 0666 /sys/kernel/tracing/events/mdss/enable
    chmod 0666 /sys/kernel/debug/tracing/events/mdss/enable

# Tracing disabled by default
    write /sys/kernel/debug/tracing/tracing_on 0
    write /sys/kernel/tracing/tracing_on 0
+58 −17
Original line number Diff line number Diff line
@@ -61,7 +61,8 @@ class MyShellCallback : public BnShellCallback
public:
    bool mActive = true;

    virtual int openOutputFile(const String16& path, const String16& seLinuxContext) {
    virtual int openFile(const String16& path, const String16& seLinuxContext,
            const String16& mode) {
        String8 path8(path);
        char cwd[256];
        getcwd(cwd, 256);
@@ -71,7 +72,32 @@ public:
            aerr << "Open attempt after active for: " << fullPath << endl;
            return -EPERM;
        }
        int fd = open(fullPath.string(), O_WRONLY|O_CREAT|O_TRUNC, S_IRWXU|S_IRWXG);
#if DEBUG
        ALOGD("openFile: %s, full=%s", path8.string(), fullPath.string());
#endif
        int flags = 0;
        bool checkRead = false;
        bool checkWrite = false;
        if (mode == String16("w")) {
            flags = O_WRONLY|O_CREAT|O_TRUNC;
            checkWrite = true;
        } else if (mode == String16("w+")) {
            flags = O_RDWR|O_CREAT|O_TRUNC;
            checkRead = checkWrite = true;
        } else if (mode == String16("r")) {
            flags = O_RDONLY;
            checkRead = true;
        } else if (mode == String16("r+")) {
            flags = O_RDWR;
            checkRead = checkWrite = true;
        } else {
            aerr << "Invalid mode requested: " << mode.string() << endl;
            return -EINVAL;
        }
        int fd = open(fullPath.string(), flags, S_IRWXU|S_IRWXG);
#if DEBUG
        ALOGD("openFile: fd=%d", fd);
#endif
        if (fd < 0) {
            return fd;
        }
@@ -80,16 +106,35 @@ public:
            security_context_t tmp = NULL;
            getfilecon(fullPath.string(), &tmp);
            Unique_SecurityContext context(tmp);
            if (checkWrite) {
                int accessGranted = selinux_check_access(seLinuxContext8.string(), context.get(),
                        "file", "write", NULL);
                if (accessGranted != 0) {
#if DEBUG
                    ALOGD("openFile: failed selinux write check!");
#endif
                    close(fd);
                aerr << "System server has no access to file context " << context.get()
                    aerr << "System server has no access to write file context " << context.get()
                            << " (from path " << fullPath.string() << ", context "
                            << seLinuxContext8.string() << ")" << endl;
                    return -EPERM;
                }
            }
            if (checkRead) {
                int accessGranted = selinux_check_access(seLinuxContext8.string(), context.get(),
                        "file", "read", NULL);
                if (accessGranted != 0) {
#if DEBUG
                    ALOGD("openFile: failed selinux read check!");
#endif
                    close(fd);
                    aerr << "System server has no access to read file context " << context.get()
                            << " (from path " << fullPath.string() << ", context "
                            << seLinuxContext8.string() << ")" << endl;
                    return -EPERM;
                }
            }
        }
        return fd;
    }
};
@@ -122,15 +167,11 @@ int main(int argc, char* const argv[])
{
    signal(SIGPIPE, SIG_IGN);
    sp<ProcessState> proc = ProcessState::self();
    // setThreadPoolMaxThreadCount(0) actually tells the kernel it's
    // not allowed to spawn any additional threads, but we still spawn
    // a binder thread from userspace when we call startThreadPool().
    // This is safe because we only have 2 callbacks, neither of which
    // block.
    // See b/36066697 for rationale
    proc->setThreadPoolMaxThreadCount(0);
    proc->startThreadPool();

#if DEBUG
    ALOGD("cmd: starting");
#endif
    sp<IServiceManager> sm = defaultServiceManager();
    fflush(stdout);
    if (sm == NULL) {
+30 −23
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
// limitations under the License.

cc_defaults {
    name: "dumpstate_defaults",
    name: "dumpstate_cflag_defaults",
    cflags: [
        "-Wall",
        "-Werror",
@@ -26,7 +26,7 @@ cc_defaults {

cc_library_shared {
    name: "libdumpstateutil",
    defaults: ["dumpstate_defaults"],
    defaults: ["dumpstate_cflag_defaults"],
    vendor_available: true,
    vndk: {
        enabled: true,
@@ -47,7 +47,7 @@ cc_library_shared {

cc_library_shared {
    name: "libdumpstateaidl",
    defaults: ["dumpstate_defaults"],
    defaults: ["dumpstate_cflag_defaults"],
    shared_libs: [
        "libbinder",
        "libutils",
@@ -63,9 +63,9 @@ cc_library_shared {
    ],
}

cc_binary {
    name: "dumpstate",
    defaults: ["dumpstate_defaults"],
cc_defaults {
    name: "dumpstate_defaults",
    defaults: ["dumpstate_cflag_defaults"],
    shared_libs: [
        "android.hardware.dumpstate@1.0",
        "libziparchive",
@@ -76,16 +76,29 @@ cc_binary {
        "libdebuggerd_client",
        "libdumpstateaidl",
        "libdumpstateutil",
        "libdumputils",
        "libhidlbase",
        "libhidltransport",
        "liblog",
        "libutils",
    ],
    srcs: [
        "DumpstateInternal.cpp",
        "DumpstateSectionReporter.cpp",
        "DumpstateService.cpp",
        "utils.cpp",
    ],
    static_libs: [
        "libdumpsys",
        "libserviceutils"
    ],
}

cc_binary {
    name: "dumpstate",
    defaults: ["dumpstate_defaults"],
    srcs: [
        "dumpstate.cpp",
        "main.cpp",
    ],
    init_rc: ["dumpstate.rc"],
}
@@ -93,24 +106,18 @@ cc_binary {
cc_test {
    name: "dumpstate_test",
    defaults: ["dumpstate_defaults"],
    shared_libs: [
        "libziparchive",
        "libbase",
        "libbinder",
        "libcutils",
        "libdebuggerd_client",
        "libdumpstateaidl",
        "libdumpstateutil",
        "libhidlbase",
        "libhidltransport",
        "liblog",
        "libutils",
    ],
    srcs: [
        "DumpstateInternal.cpp",
        "DumpstateService.cpp",
        "utils.cpp",
        "tests/dumpstate_test.cpp",
    ],
    static_libs: ["libgmock"],
}

cc_test {
    name: "dumpstate_smoke_test",
    defaults: ["dumpstate_defaults"],
    srcs: [
        "dumpstate.cpp",
        "tests/dumpstate_smoke_test.cpp",
    ],
    static_libs: ["libgmock"],
}
Loading