/*
 * Copyright (C) 2022 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.
 */

syntax = "proto2";

package android.os.statsd.kernel;

import "frameworks/proto_logging/stats/atom_field_options.proto";
import "frameworks/proto_logging/stats/enums/app_shared/app_enums.proto";

option java_package = "com.android.os.kernel";
option java_multiple_files = true;

/**
 * Logs each kernel wakeup reason that caused a kernel wakeup with more detailed
 * high level attribution information.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/power/stats/CpuWakeupStats.java
 */
message KernelWakeupAttributed {
    enum Type {
        TYPE_UNKNOWN = 0;
        TYPE_IRQ = 1;
        TYPE_ABNORMAL = 2;
    }

    // The type of kernel wakeup.
    optional Type type = 1;

    enum Reason {
        UNKNOWN = 0;
        ALARM = 1;
        WIFI = 2;
        SOUND_TRIGGER = 3;
        SENSOR = 4;
        CELLULAR_DATA = 5;
    }

    optional Reason reason = 2;
    repeated int32 uids = 3 [(is_uid) = true];
    optional int64 elapsed_millis = 4;
    // The process states for each of the uids in the field above.
    repeated android.app.ProcessStateEnum process_states = 5;
}
