1 /* 2 * Copyright (C) 2024 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.settingslib.datastore 18 19 import androidx.annotation.IntDef 20 21 /** The reason of data change. */ 22 @IntDef( 23 DataChangeReason.UNKNOWN, 24 DataChangeReason.UPDATE, 25 DataChangeReason.DELETE, 26 DataChangeReason.RESTORE, 27 DataChangeReason.SYNC_ACROSS_PROFILES, 28 ) 29 @Retention(AnnotationRetention.SOURCE) 30 annotation class DataChangeReason { 31 companion object { 32 /** Unknown reason of the change. */ 33 const val UNKNOWN = 0 34 /** Data is updated. */ 35 const val UPDATE = 1 36 /** Data is deleted. */ 37 const val DELETE = 2 38 /** Data is restored from backup/restore framework. */ 39 const val RESTORE = 3 40 /** Data is synced from another profile (e.g. personal profile to work profile). */ 41 const val SYNC_ACROSS_PROFILES = 4 42 isDataChangenull43 fun isDataChange(reason: Int): Boolean = reason in UNKNOWN..SYNC_ACROSS_PROFILES 44 } 45 } 46