1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.federatedcompute.services.data; 18 19 import android.provider.BaseColumns; 20 21 /** The contract class for training tasks. */ 22 public final class FederatedTraningTaskContract { 23 public static final String FEDERATED_TRAINING_TASKS_TABLE = "federated_training_tasks"; 24 FederatedTraningTaskContract()25 private FederatedTraningTaskContract() {} 26 27 /** Column name for the federated training task table. */ 28 public static final class FederatedTrainingTaskColumns implements BaseColumns { 29 FederatedTrainingTaskColumns()30 private FederatedTrainingTaskColumns() {} 31 32 // The package name of the application this task belongs to. Must be 33 // non-empty. 34 public static final String APP_PACKAGE_NAME = "app_package_name"; 35 36 // A unique, app-specified JobScheduler job ID for this task. Must be 37 // non-zero. 38 public static final String JOB_SCHEDULER_JOB_ID = "jobscheduler_job_id"; 39 40 // An app-specified population name, to be provided to the federated learning 41 // server during check in. Must be non-empty. 42 public static final String POPULATION_NAME = "population_name"; 43 44 public static final String INTERVAL_OPTIONS = "interval_options"; 45 46 // The time the task was originally created. 47 public static final String CREATION_TIME = "creation_time"; 48 49 // The time the task was last scheduled. Must always be set to a valid value. 50 public static final String LAST_SCHEDULED_TIME = "last_scheduled_time"; 51 52 // The start time of the task's last run. This is population scoped and must 53 // be reset if population name changes. Must always be either unset, or set to 54 // a valid value. 55 public static final String LAST_RUN_START_TIME = "last_run_start_time"; 56 57 // The end time of the task's last run. This is population scoped and must 58 // be reset if population name changes. Must always be either unset, or set to 59 // a valid value. 60 public static final String LAST_RUN_END_TIME = "last_run_end_time"; 61 62 // The earliest time to run the task by. This is population scoped and must 63 // be reset if population name changes. Must always be set to a valid value. 64 public static final String EARLIEST_NEXT_RUN_TIME = "earliest_next_run_time"; 65 66 // The constraints that should apply to this task. 67 public static final String CONSTRAINTS = "constraints"; 68 69 public static final String SCHEDULING_REASON = "scheduling_reason"; 70 } 71 } 72