1 /* 2 * Copyright (C) 2022 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 18 package com.android.systemui.shared.customization.data.content 19 20 import android.content.ContentResolver 21 import android.net.Uri 22 23 /** Contract definitions for querying content about keyguard quick affordances. */ 24 object CustomizationProviderContract { 25 26 const val AUTHORITY = "com.android.systemui.customization" 27 const val PERMISSION = "android.permission.CUSTOMIZE_SYSTEM_UI" 28 29 private val BASE_URI: Uri = 30 Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(AUTHORITY).build() 31 32 /** Namespace for lock screen shortcut (quick affordance) tables. */ 33 object LockScreenQuickAffordances { 34 35 const val NAMESPACE = "lockscreen_quickaffordance" 36 37 private val LOCK_SCREEN_QUICK_AFFORDANCE_BASE_URI: Uri = 38 BASE_URI.buildUpon().path(NAMESPACE).build() 39 qualifiedTablePathnull40 fun qualifiedTablePath(tableName: String): String { 41 return "$NAMESPACE/$tableName" 42 } 43 44 /** 45 * Table for slots. 46 * 47 * Slots are positions where affordances can be placed on the lock screen. Affordances that 48 * are placed on slots are said to be "selected". The system supports the idea of multiple 49 * affordances per slot, though the implementation may limit the number of affordances on 50 * each slot. 51 * 52 * Supported operations: 53 * - Query - to know which slots are available, query the [SlotTable.URI] [Uri]. The result 54 * set will contain rows with the [SlotTable.Columns] columns. 55 */ 56 object SlotTable { 57 const val TABLE_NAME = "slots" 58 val URI: Uri = 59 LOCK_SCREEN_QUICK_AFFORDANCE_BASE_URI.buildUpon().appendPath(TABLE_NAME).build() 60 61 object Columns { 62 /** String. Unique ID for this slot. */ 63 const val ID = "id" 64 /** Integer. The maximum number of affordances that can be placed in the slot. */ 65 const val CAPACITY = "capacity" 66 } 67 } 68 69 /** 70 * Table for affordances. 71 * 72 * Affordances are actions/buttons that the user can execute. They are placed on slots on 73 * the lock screen. 74 * 75 * Supported operations: 76 * - Query - to know about all the affordances that are available on the device, regardless 77 * of which ones are currently selected, query the [AffordanceTable.URI] [Uri]. The result 78 * set will contain rows, each with the columns specified in [AffordanceTable.Columns]. 79 */ 80 object AffordanceTable { 81 const val TABLE_NAME = "affordances" 82 val URI: Uri = 83 LOCK_SCREEN_QUICK_AFFORDANCE_BASE_URI.buildUpon().appendPath(TABLE_NAME).build() 84 85 object Columns { 86 /** String. Unique ID for this affordance. */ 87 const val ID = "id" 88 /** String. User-visible name for this affordance. */ 89 const val NAME = "name" 90 /** 91 * Integer. Resource ID for the drawable to load for this affordance. This is a 92 * resource ID from the system UI package. 93 */ 94 const val ICON = "icon" 95 /** Integer. `1` if the affordance is enabled or `0` if it disabled. */ 96 const val IS_ENABLED = "is_enabled" 97 /** 98 * String. Text to be shown to the user if the affordance is disabled and the user 99 * selects the affordance. 100 */ 101 const val ENABLEMENT_EXPLANATION = "enablement_explanation" 102 /** 103 * String. Optional label for a button that, when clicked, opens a destination 104 * activity where the user can re-enable the disabled affordance. 105 */ 106 const val ENABLEMENT_ACTION_TEXT = "enablement_action_text" 107 /** 108 * String. Optional URI-formatted `Intent` (formatted using 109 * `Intent#toUri(Intent.URI_INTENT_SCHEME)` used to start an activity that opens a 110 * destination where the user can re-enable the disabled affordance. 111 */ 112 const val ENABLEMENT_ACTION_INTENT = "enablement_action_intent" 113 /** 114 * Byte array. Optional parcelled `Intent` to use to start an activity that can be 115 * used to configure the affordance. 116 */ 117 const val CONFIGURE_INTENT = "configure_intent" 118 } 119 } 120 121 /** 122 * Table for selections. 123 * 124 * Selections are pairs of slot and affordance IDs. 125 * 126 * Supported operations: 127 * - Insert - to insert an affordance and place it in a slot, insert values for the columns 128 * into the [SelectionTable.URI] [Uri]. The maximum capacity rule is enforced by the 129 * system. Selecting a new affordance for a slot that is already full will automatically 130 * remove the oldest affordance from the slot. 131 * - Query - to know which affordances are set on which slots, query the 132 * [SelectionTable.URI] [Uri]. The result set will contain rows, each of which with the 133 * columns from [SelectionTable.Columns]. 134 * - Delete - to unselect an affordance, removing it from a slot, delete from the 135 * [SelectionTable.URI] [Uri], passing in values for each column. 136 */ 137 object SelectionTable { 138 const val TABLE_NAME = "selections" 139 val URI: Uri = 140 LOCK_SCREEN_QUICK_AFFORDANCE_BASE_URI.buildUpon().appendPath(TABLE_NAME).build() 141 142 object Columns { 143 /** String. Unique ID for the slot. */ 144 const val SLOT_ID = "slot_id" 145 /** String. Unique ID for the selected affordance. */ 146 const val AFFORDANCE_ID = "affordance_id" 147 /** String. Human-readable name for the affordance. */ 148 const val AFFORDANCE_NAME = "affordance_name" 149 } 150 } 151 } 152 153 /** 154 * Table for flags. 155 * 156 * Flags are key-value pairs. 157 * 158 * Supported operations: 159 * - Query - to know the values of flags, query the [FlagsTable.URI] [Uri]. The result set will 160 * contain rows, each of which with the columns from [FlagsTable.Columns]. 161 */ 162 object FlagsTable { 163 const val TABLE_NAME = "flags" 164 val URI: Uri = BASE_URI.buildUpon().path(TABLE_NAME).build() 165 166 /** 167 * Flag denoting whether the customizable lock screen quick affordances feature is enabled. 168 */ 169 const val FLAG_NAME_CUSTOM_LOCK_SCREEN_QUICK_AFFORDANCES_ENABLED = 170 "is_custom_lock_screen_quick_affordances_feature_enabled" 171 172 /** Flag denoting whether the customizable clocks feature is enabled. */ 173 const val FLAG_NAME_CUSTOM_CLOCKS_ENABLED = "is_custom_clocks_feature_enabled" 174 175 /** Flag denoting whether the Wallpaper preview should use the full screen UI. */ 176 const val FLAG_NAME_WALLPAPER_FULLSCREEN_PREVIEW = "wallpaper_fullscreen_preview" 177 178 /** Flag denoting whether the Monochromatic Theme is enabled. */ 179 const val FLAG_NAME_MONOCHROMATIC_THEME = "is_monochromatic_theme_enabled" 180 181 /** Flag denoting AI Wallpapers are enabled in wallpaper picker. */ 182 const val FLAG_NAME_WALLPAPER_PICKER_UI_FOR_AIWP = "wallpaper_picker_ui_for_aiwp" 183 184 /** Flag denoting transit clock are enabled in wallpaper picker. */ 185 const val FLAG_NAME_TRANSIT_CLOCK = "lockscreen_custom_transit_clock" 186 187 /** Flag denoting transit clock are enabled in wallpaper picker. */ 188 const val FLAG_NAME_PAGE_TRANSITIONS = "wallpaper_picker_page_transitions" 189 190 /** Flag denoting adding apply button to wallpaper picker's grid preview page. */ 191 const val FLAG_NAME_GRID_APPLY_BUTTON = "wallpaper_picker_grid_apply_button" 192 193 /** Flag denoting whether preview loading animation is enabled. */ 194 const val FLAG_NAME_WALLPAPER_PICKER_PREVIEW_ANIMATION = 195 "wallpaper_picker_preview_animation" 196 197 object Columns { 198 /** String. Unique ID for the flag. */ 199 const val NAME = "name" 200 /** Int. Value of the flag. `1` means `true` and `0` means `false`. */ 201 const val VALUE = "value" 202 } 203 } 204 } 205