/*
 * 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";

package com.android.server.art.proto;
option java_multiple_files = true;

// These protobufs are currently used as an ART-internal API for pre-reboot
// dexopt to pass parameters from a version of the ART module to a potentially
// more recent version in an OTA package. It's a 1:1 mapping to the
// BatchDexoptParams API used for (normal) batch dexopt. That approach does not
// add any extra compatibility constraints, because: a) We need to keep the
// BatchDexoptParams API for all SDK levels the ART module gets pushed to, and
// b) we only allow pre-reboot dexopt from SDK level N to N+1. Since (a) always
// has a longer support window than (b), we cannot end up in a situation where
// these protobufs forces us to keep support for a feature we wouldn't need to
// keep anyway for batch dexopt.

// The protobuf representation of `BatchDexoptParams`. See classes in
// java/com/android/server/art/model/BatchDexoptParams.java and
// java/com/android/server/art/model/DexoptParams.java for details.
// Fields added to classes after Android B must be optional in the protos.
message BatchDexoptParamsProto {
    // Required.
    repeated string package = 1;
    // Required.
    optional DexoptParamsProto dexopt_params = 2;
}

// The protobuf representation of `DexoptParams`.
// Note that this is only for batch dexopt. Particularly, it doesn't have a field for the split
// name.
message DexoptParamsProto {
    // Required.
    optional int32 flags = 1;
    // Required.
    optional string compiler_filter = 2;
    // Required.
    optional int32 priority_class = 3;
    // Required.
    optional string reason = 4;
}
