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.server.healthconnect.migration; 18 19 import java.time.Duration; 20 import java.time.LocalDate; 21 22 /** 23 * Migration related constants. 24 * 25 * @hide 26 */ 27 public final class MigrationConstants { MigrationConstants()28 private MigrationConstants() {} 29 30 public static final String EXTRA_USER_ID = "userId"; 31 public static final String HC_PACKAGE_NAME_CONFIG_NAME = 32 "android:string/config_healthConnectMigratorPackageName"; 33 public static final String MIGRATION_COMPLETE_JOB_NAME = "migration_completion_job"; 34 public static final String MIGRATION_PAUSE_JOB_NAME = "migration_pause_job"; 35 static final int COUNT_DEFAULT = 0; 36 static final int INTERVAL_DEFAULT = 0; 37 static final String HC_RELEASE_CERT_CONFIG_NAME = 38 "android:array/config_healthConnectMigrationKnownSigners"; 39 static final String CURRENT_STATE_START_TIME_KEY = "current_state_start_time"; 40 static final String ALLOWED_STATE_START_TIME_KEY = "allowed_state_start_time"; 41 static final String MIGRATION_STATE_PREFERENCE_KEY = "migration_state"; 42 static final String MIN_DATA_MIGRATION_SDK_EXTENSION_VERSION_KEY = 43 "min_data_migration_sdk_extension_version"; 44 static final String MIGRATION_STARTS_COUNT_KEY = "migration_starts_count"; 45 static final String HAVE_RESET_MIGRATION_STATE_KEY = "have_reset_migration_state"; 46 static final String MIGRATION_STATE_CHANGE_NAMESPACE = MigrationStateChangeJob.class.toString(); 47 48 public static final String IN_PROGRESS_TIMEOUT_REACHED_KEY = "in_progress_timeout_reached_key"; 49 public static final String IDLE_TIMEOUT_REACHED_KEY = "idle_timeout_reached_key"; 50 51 static final LocalDate PREMATURE_MIGRATION_TIMEOUT_DATE = LocalDate.of(2023, 6, 15); 52 53 static final int MIGRATION_STATE_IN_PROGRESS_COUNT = 5; 54 static final int MIGRATION_STATE_ALLOWED_COUNT = 5; 55 static final int MAX_START_MIGRATION_CALLS = 6; 56 static final Duration IDLE_STATE_TIMEOUT_DAYS = Duration.ofDays(120); 57 static final Duration NON_IDLE_STATE_TIMEOUT_DAYS = Duration.ofDays(15); 58 static final Duration IN_PROGRESS_STATE_TIMEOUT_HOURS = Duration.ofHours(12); 59 static final Duration EXECUTION_TIME_BUFFER_MINUTES = Duration.ofMinutes(30); 60 static final Duration MIGRATION_COMPLETION_JOB_RUN_INTERVAL_DAYS = Duration.ofDays(1); 61 static final Duration MIGRATION_PAUSE_JOB_RUN_INTERVAL_HOURS = Duration.ofHours(4); 62 } 63