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

import "frameworks/proto_logging/stats/atom_field_options.proto";
import "frameworks/proto_logging/stats/enums/display/display_enums.proto";
import "frameworks/proto_logging/stats/enums/view/enums.proto";
import "frameworks/proto_logging/stats/enums/stats/mediametrics/mediametrics.proto";

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

/**
 * Logs when the screen state changes on devices with multiple displays.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/display/DisplayPowerController.java
 *   frameworks/base/services/core/java/com/android/server/display/DisplayPowerController2.java
 */
message ScreenStateChangedV2 {
    // New screen state, from frameworks/proto_logging/stats/enums/view/enums.proto.
    optional android.view.DisplayStateEnum state = 1
            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
    optional int32 display_id = 2 [(state_field_option).primary_field = true];
    optional android.view.DisplayStateReason reason = 3 [(state_field_option).primary_field = true];
}

/**
 * Logs the HDR capabilities of a device:
 * - The supported HDR conversion formats?
 * - Has the user disabled the HDR conversion?
 * - Has the user chosen to force convert to an HDR output format, and to which format?
 * - Does the device have the 4k30Hz Dolby Vision issue?
 * - Does the device support HDR output control?
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
 */
message HdrCapabilities {
    message HdrOutputCapability {
        optional int32 output_type = 2;
        reserved 1, 3;
    }

    message HdrOutputCapabilities {
        repeated HdrOutputCapability hdr_output_capabilities = 1;
    }

    // The HDR conversion capabilities of the device
    optional HdrOutputCapabilities device_hdr_output_capabilities = 1 [(log_mode) = MODE_BYTES];
    // Whether the user has disabled HDR conversion
    optional bool has_user_disabled_hdr_conversion = 2;
    // The format to which user chose to force HDR conversion.
    optional android.stats.mediametrics.HdrFormat force_hdr_format = 3;
    // Whether the device has 4k30 Hz Dolby Vision issue
    optional bool has_4k30_dolby_vision_issue = 4;
    // Whether the device supports HDR output control
    optional bool device_supports_hdr_output_control = 5;
}

