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

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

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

extend Atom {
  optional ApplicationGrammaticalInflectionChanged application_grammatical_inflection_changed
      = 584 [(module) = "framework"];
  optional SystemGrammaticalInflectionChanged system_grammatical_inflection_changed
      = 816 [(module) = "framework"];
}

/**
 * Logs when app grammatical inflection changed.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/grammaticalinflection/GrammaticalInflectionService.java
 */
message ApplicationGrammaticalInflectionChanged {
  // The id for which component invokes this API.
  optional SourceId source_id = 1;

  // The uid for which the gender change is being done.
  optional int32 target_uid = 2 [(is_uid) = true];

  // Indicate if the grammatical gender is specified in this change
  optional bool is_grammatical_gender_specified = 3;

  // Indicate if the grammatical gender was specified before this change
  optional bool was_grammatical_gender_specified = 4;

  // The caller id
  enum SourceId {
    UNKNOWN = 0;

    // Frameworks invoke this API. It may happen when B&R.
    FRAMEWORKS = 1;

    // Apps invoke this API.
    OTHERS = 2;
  }
}

message SystemGrammaticalInflectionChanged {
  // The id for which component invokes this API.
  optional SourceId source_id = 1;

  // Android user id, e.g. 0 is the owners.
  optional int32 user_id = 2;

  // Indicate if the grammatical gender is specified in this change. For example, user sets the
  // grammatical gender to neutral, feminine or masculine from not_specified.
  optional bool is_grammatical_gender_specified = 3;

  // Indicate if the grammatical gender was specified before this change. For example, user sets the
  // grammatical gender to not_specified from neutral, feminine or masculine.
  optional bool was_grammatical_gender_specified = 4;

  // The caller id
  enum SourceId {
    UNKNOWN = 0;

    // System invokes this API.
    SYSTEM = 1;
  }
}
