/*
 * Copyright (C) 2024 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";

import public "protos/perfetto/trace/track_event/track_event.proto";

package perfetto.protos;

// Information about sending and receiving messages on threads with
// Looper and MessageQueue.
message AndroidMessageQueue {
  // Thread name sending a message on the MessageQueue.
  optional string sending_thread_name = 1;
  // Thread name receiving a message on the MessageQueue.
  optional string receiving_thread_name = 2;
  // User-defined message code for messages in the MessageQueue.
  optional int32 message_code = 3;
  // Intended delay in millis before a message on the MessageQueue is executed.
  optional uint64 message_delay_ms = 4;
}

// Information about an android.graphics.Bitmap.
message AndroidBitmap {
  // Allocation size, in bytes.
  optional int64 size = 1;
  // Width, in pixels.
  optional int32 width = 2;
  // Height, in pixels.
  optional int32 height = 3;
  // Density, in DPI.
  optional int32 density = 4;
  // Config, in android.graphics.Bitmap.Config ordinal values.
  optional int32 config = 5;
  // Whether the pixel data is mutable.
  // b/398624484: this should be a boolean.
  optional int32 mutable_pixels = 6;
  // Pixel storage type, in android::PixelStorageType ordinal values.
  optional int32 pixel_storage_type = 7;
  // Bitmap id; see android.graphics.Bitmap#mId.
  optional int64 id = 8;
}

message AndroidTrackEvent {
  // Usable range: [2001, 2999]
  // Next id: 2006
  extend TrackEvent {
    // The name of a binder service.
    optional string binder_service_name = 2001;
    // The name of a binder interface.
    optional string binder_interface_name = 2002;
    // The name of an apex.
    optional string apex_name = 2003;

    // MessageQueue messages.
    optional AndroidMessageQueue message_queue = 2004;
    // Bitmaps
    optional AndroidBitmap bitmap = 2005;
  }
}
