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

Commit 7ee94150 authored by Yao Chen's avatar Yao Chen
Browse files

fix the permission check crash in statsd.

And change the fake config uid to be 1000, so we can dump it from the test app.

Test: manual
Change-Id: I99b4cd28b351add8cf3e315e1dccf8cf511a0be8
parent 902cb0b6
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -543,9 +543,7 @@ void StatsService::OnLogEvent(const LogEvent& event) {

Status StatsService::getData(const String16& key, vector<uint8_t>* output) {
    IPCThreadState* ipc = IPCThreadState::self();
    if (checkCallingPermission(String16(kPermissionDump),
                               reinterpret_cast<int32_t*>(ipc->getCallingPid()),
                               reinterpret_cast<int32_t*>(ipc->getCallingUid()))) {
    if (checkCallingPermission(String16(kPermissionDump))) {
        // TODO: Implement this.
        return Status::ok();
    } else {
@@ -559,8 +557,7 @@ Status StatsService::addConfiguration(const String16& key,
                                      bool* success) {
    IPCThreadState* ipc = IPCThreadState::self();
    int32_t* uid = reinterpret_cast<int32_t*>(ipc->getCallingUid());
    if (checkCallingPermission(String16(kPermissionDump),
                               reinterpret_cast<int32_t*>(ipc->getCallingPid()), uid)) {
    if (checkCallingPermission(String16(kPermissionDump))) {
        string keyString = string(String8(key).string());
        ConfigKey configKey(*uid, keyString);
        StatsdConfig cfg;
@@ -577,9 +574,7 @@ Status StatsService::addConfiguration(const String16& key,

Status StatsService::removeConfiguration(const String16& key, bool* success) {
    IPCThreadState* ipc = IPCThreadState::self();
    if (checkCallingPermission(String16(kPermissionDump),
                               reinterpret_cast<int32_t*>(ipc->getCallingPid()),
                               reinterpret_cast<int32_t*>(ipc->getCallingUid()))) {
    if (checkCallingPermission(String16(kPermissionDump))) {
        // TODO: Implement this.
        return Status::ok();
    } else {
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ void ConfigManager::Startup() {
    // Instead, we'll just make a fake one.

    // this should be called from StatsService when it receives a statsd_config
    UpdateConfig(ConfigKey(0, "fake"), build_fake_config());
    UpdateConfig(ConfigKey(1000, "fake"), build_fake_config());
}

void ConfigManager::AddListener(const sp<ConfigListener>& listener) {