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 was created from. 33 // ODP most likely for time being. Must be 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 // The package name and class name of the application this task belongs to. 41 // This is legacy field kept for migration purposes. 42 public static final String OWNER_ID = "owner_id"; 43 44 // The package name of the application this task belongs to. Must be non-empty. 45 public static final String OWNER_PACKAGE = "owner_package"; 46 47 // The class name of the application this task belongs to. Must be non-empty. 48 public static final String OWNER_CLASS = "owner_class"; 49 50 // The package cert digest of the application this task belongs to. Must be 51 // non-empty. 52 public static final String OWNER_ID_CERT_DIGEST = "owner_cert_digest"; 53 54 // An app-specified population name, to be provided to the federated learning 55 // server during check in. Must be non-empty. 56 public static final String POPULATION_NAME = "population_name"; 57 58 /** The remote federated compute server address that client provided. */ 59 public static final String SERVER_ADDRESS = "server_address"; 60 61 public static final String INTERVAL_OPTIONS = "interval_options"; 62 63 public static final String CONTEXT_DATA = "context_data"; 64 65 // The time the task was originally created. 66 public static final String CREATION_TIME = "creation_time"; 67 68 // The time the task was last scheduled. Must always be set to a valid value. 69 public static final String LAST_SCHEDULED_TIME = "last_scheduled_time"; 70 71 // The start time of the task's last run. This is population scoped and must 72 // be reset if population name changes. Must always be either unset, or set to 73 // a valid value. 74 public static final String LAST_RUN_START_TIME = "last_run_start_time"; 75 76 // The end time of the task's last run. This is population scoped and must 77 // be reset if population name changes. Must always be either unset, or set to 78 // a valid value. 79 public static final String LAST_RUN_END_TIME = "last_run_end_time"; 80 81 // The earliest time to run the task by. This is population scoped and must 82 // be reset if population name changes. Must always be set to a valid value. 83 public static final String EARLIEST_NEXT_RUN_TIME = "earliest_next_run_time"; 84 85 // The constraints that should apply to this task. 86 public static final String CONSTRAINTS = "constraints"; 87 88 public static final String SCHEDULING_REASON = "scheduling_reason"; 89 90 public static final String RESCHEDULE_COUNT = "reschedule_count"; 91 } 92 } 93