/*
 * 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.microxr;

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

option java_package = "com.android.os.statsd.microxr";
option java_multiple_files = true;

extend Atom {
  // Pushed Atom
  optional MicroXrDeviceBootCompleteReported
      micro_xr_device_boot_complete_reported = 901 [(module) = "microxr"];
  optional MicroXrDonDoffStateChanged micro_xr_don_doff_state_changed = 1182
      [(module) = "microxr"];
  optional MicroXrMcuCrashOccurred micro_xr_mcu_crash_occurred = 1183
      [(module) = "microxr"];
  optional MicroXrSoundTriggerDetected micro_xr_sound_trigger_detected = 1188
      [(module) = "microxr"];
}

/**
 * Logged when a MicroXR Device is done booting.
 */
message MicroXrDeviceBootCompleteReported {
  // Device ready elapsed time in milliseconds.
  // Logged from microxr-system-ui.
  optional int64 device_ready_time_millis = 1;
}

/**
 * Represents the current Don or Doff state.
 */
enum DonDoffState {
  DON_DOFF_STATE_UNKNOWN = 0;
  // Glasses are "donned", i.e. worn.
  DON_DOFF_STATE_DONNED = 1;
  // Glasses are "doffed", i.e. not worn.
  DON_DOFF_STATE_DOFFED = 2;
  // Don/doff detection is disabled.
  DON_DOFF_STATE_DISABLED = 3;
}

/**
 * Logged each time the don/doff state changed
 *
 * Estimated Logging Rate:
 *   Avg on the order of tens per day at most
 */
message MicroXrDonDoffStateChanged {
  optional DonDoffState don_doff_new_state = 1;
}

/**
 * Logged when the MCU crashes.
 */
message MicroXrMcuCrashOccurred {
}

/**
 * Logged when a sound trigger (hotword) is detected by a local 1st
 * stage activation.
 *
 * Estimated Logging Rate:
 *   Avg on the order of tens or hundreds per day at most
 */
message MicroXrSoundTriggerDetected {
  enum ValidationType {
    VALIDATION_TYPE_UNSPECIFIED = 0;
    VALIDATION_TYPE_LOCAL = 1;
    VALIDATION_TYPE_REMOTE = 2;
  }

  enum ValidationStatus {
    VALIDATION_STATUS_UNSPECIFIED = 0;
    VALIDATION_STATUS_ACCEPTED = 1;
    VALIDATION_STATUS_REJECTED = 2;
  }

  optional ValidationType validation_type = 1;
  optional ValidationStatus validation_status = 2;
}
