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

Commit d77b5783 authored by Christian Brunschen's avatar Christian Brunschen Committed by Android (Google) Code Review
Browse files

Merge "Adds Westworld logging of RescueParty reset events."

parents 9ab23c5b f86039e1
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -180,6 +180,7 @@ message Atom {
        DocsUISearchModeReported docs_ui_search_mode_reported = 119;
        DocsUISearchTypeReported docs_ui_search_type_reported = 120;
        DataStallEvent data_stall_event = 121;
        RescuePartyResetReported rescue_party_reset_reported = 122;
    }

    // Pulled events will start at field 10000.
@@ -3847,3 +3848,14 @@ message DataStallEvent {
    // See definition in data_stall_event.proto.
    optional com.android.server.connectivity.DnsEvent dns_event = 6 [(log_mode) = MODE_BYTES];
}

/*
 * Logs when RescueParty resets some set of experiment flags.
 *
 * Logged from:
 *     frameworks/base/services/core/java/com/android/server/RescueParty.java
 */
message RescuePartyResetReported {
    // The rescue level of this reset. A value of 0 indicates missing or unknown level information.
    optional int32 rescue_level = 1;
}
+2 −1
Original line number Diff line number Diff line
@@ -34,9 +34,9 @@ import android.util.Log;
import android.util.MathUtils;
import android.util.Slog;
import android.util.SparseArray;
import android.util.StatsLog;

import com.android.internal.util.ArrayUtils;
import com.android.server.pm.PackageManagerService;

import java.io.File;

@@ -179,6 +179,7 @@ public class RescueParty {
    }

    private static void executeRescueLevelInternal(Context context, int level) throws Exception {
        StatsLog.write(StatsLog.RESCUE_PARTY_RESET_REPORTED, level);
        switch (level) {
            case LEVEL_RESET_SETTINGS_UNTRUSTED_DEFAULTS:
                resetAllSettings(context, Settings.RESET_MODE_UNTRUSTED_DEFAULTS);
+23 −0
Original line number Diff line number Diff line
// Copyright (C) 2008 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

cc_test {
    name: "log_rescueparty_reset_event_reported",
    srcs: ["log_rescueparty_reset_event_reported.cpp"],
    shared_libs: [
        "libbase",
        "libstatslog",
    ],
    gtest: false,
}
+9 −0
Original line number Diff line number Diff line
# Per http://go/westworld-local-development#step3-test-atom-and-metric-locally-on-device ,
# In one terminal:
make statsd_testdrive
./out/host/linux-x86/bin/statsd_testdrive 122

# In another terminal:
mma -j $(nproc) log_rescueparty_reset_event_reported
adb push $OUT/testcases/log_rescueparty_reset_event_reported/arm64/log_rescueparty_reset_event_reported /data
adb shell /data/log_rescueparty_reset_event_reported 1234
+24 −0
Original line number Diff line number Diff line
// Copyright (C) 2008 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <statslog.h>
#include <cstdlib>

int main(int argc, const char** argv) {
    int level = 0;
    if (argc > 1) {
        level = std::atoi(argv[1]);
    }
    android::util::stats_write(android::util::RESCUE_PARTY_RESET_REPORTED, level);
}