/*
 * Copyright (C) 2023 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.hdmi;

import "frameworks/proto_logging/stats/atoms.proto";
import "frameworks/proto_logging/stats/atom_field_options.proto";
import "frameworks/proto_logging/stats/enums/stats/hdmi/enums.proto";

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

extend Atom {
  optional HdmiEarcStatusReported hdmi_earc_status_reported = 701 [(module) = "framework"];
  optional HdmiSoundbarModeStatusReported hdmi_soundbar_mode_status_reported
      = 724 [(module) = "framework"];
  optional HdmiPowerStateChangeOnActiveSourceLostToggled
      hdmi_power_state_change_on_active_source_lost_toggled = 991 [(module) = "framework"];
}
/**
* Push atom that logs the status of the eARC feature in 3 dimensions: whether the
* hardware supports it, whether the setting is enabled and whether a connection is
* established.
*
* Logged whenever the device wakes up and when the HAL reports an update in the
* connection state.
**/
message HdmiEarcStatusReported {
  // whether the hardware supports eARC
  optional bool is_supported = 1;
  // whether eARC is enabled
  optional bool is_enabled = 2;
  // If log_reason == LOG_REASON_EARC_STATUS_CHANGED, the state just before the change.
  // Otherwise, the current state.
  optional android.stats.hdmi.ConnectionState old_connected_state = 3;
  // If log_reason == LOG_REASON_EARC_STATUS_CHANGED, the state just after the change.
  // Otherwise, the current state.
  optional android.stats.hdmi.ConnectionState new_connected_state = 4;
  // The event that triggered the log.
  optional android.stats.hdmi.LogReason log_reason = 5;
}

/**
* Push atom that logs the status of the Dynamic Soundbar mode feature in 2 dimensions: whether the
* hardware supports it and whether the setting is enabled.
*
* Logged whenever the device wakes up or the Dynamic Soundbar mode setting is toggled.
**/
message HdmiSoundbarModeStatusReported {
  // whether the hardware supports Dynamic soundbar mode
  optional bool is_supported = 1;
  // whether the Dynamic soundbar mode setting is enabled
  optional bool is_enabled = 2;
  // the event that triggered the log.
  optional android.stats.hdmi.DynamicSoundbarModeLogReason log_reason = 3;
}

/**
* Push atom that logs the status of POWER_STATE_CHANGE_ON_ACTIVE_SOURCE_LOST in 2 dimensions:
* whether the setting is enabled and connected device manufacturer information (PNP Id, year,
* week).
*
* Logged whenever the setting is toggled.
**/

message HdmiPowerStateChangeOnActiveSourceLostToggled {
  // whether the setting is enabled.
  optional bool is_enabled = 1;
  // the event that triggered the log.
  optional android.stats.hdmi.PowerStateChangeOnActiveSourceLostToggleReason log_reason = 2;
  // stores the PNP Id reported in the EDID by the connected device. The PNP Id can be
  // decoded here - https://uefi.org/PNP_ID_List.
  optional string manufacturer_device_pnp_id = 3;
  // stores the manufacturer year reported in the EDID by the connected device
  optional int32 manufacturer_device_year = 4;
  // stores the manufacturer week reported in the EDID by the connected device
  optional int32 manufacturer_device_week = 5;
}
