The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 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 | |
Daniel Sandler | 325dc23 | 2013-06-05 22:57:57 -0400 | [diff] [blame] | 17 | package com.android.launcher3; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 18 | |
Sunny Goyal | d249748 | 2015-09-22 18:24:19 -0700 | [diff] [blame] | 19 | import android.content.ContentResolver; |
Sunny Goyal | c190dbf | 2016-05-05 14:37:05 -0700 | [diff] [blame] | 20 | import android.database.sqlite.SQLiteDatabase; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 21 | import android.net.Uri; |
Sunny Goyal | d249748 | 2015-09-22 18:24:19 -0700 | [diff] [blame] | 22 | import android.os.Bundle; |
Adam Cohen | df2cc41 | 2011-04-27 16:56:57 -0700 | [diff] [blame] | 23 | import android.provider.BaseColumns; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 24 | |
Sunny Goyal | e396abf | 2020-04-06 15:11:17 -0700 | [diff] [blame] | 25 | import com.android.launcher3.model.data.ItemInfo; |
| 26 | |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 27 | /** |
| 28 | * Settings related utilities. |
| 29 | */ |
Hyunyoung Song | 3f47144 | 2015-04-08 19:01:34 -0700 | [diff] [blame] | 30 | public class LauncherSettings { |
Sunny Goyal | c593939 | 2018-12-07 11:43:47 -0800 | [diff] [blame] | 31 | |
| 32 | /** |
Luca Zuccarini | 2098381 | 2023-01-03 14:19:48 +0000 | [diff] [blame] | 33 | * Types of animations. |
| 34 | */ |
| 35 | public static final class Animation { |
| 36 | /** |
| 37 | * The default animation for a given view/item info type. |
| 38 | */ |
| 39 | public static final int DEFAULT = 0; |
| 40 | /** |
| 41 | * An animation using the view's background. |
| 42 | */ |
| 43 | public static final int VIEW_BACKGROUND = 1; |
Hyunyoung Song | a38aab9 | 2023-03-14 07:56:59 +0000 | [diff] [blame] | 44 | /** |
| 45 | * The default animation for a given view/item info type, but without the splash icon. |
| 46 | */ |
| 47 | public static final int DEFAULT_NO_ICON = 2; |
Luca Zuccarini | 2098381 | 2023-01-03 14:19:48 +0000 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | /** |
Sunny Goyal | c593939 | 2018-12-07 11:43:47 -0800 | [diff] [blame] | 51 | * Favorites. |
| 52 | */ |
| 53 | public static final class Favorites implements BaseColumns { |
Chris Wren | 1ada10d | 2013-09-13 18:01:38 -0400 | [diff] [blame] | 54 | /** |
| 55 | * The time of the last update to this row. |
| 56 | * <P>Type: INTEGER</P> |
| 57 | */ |
Sunny Goyal | 2fb2f0b | 2015-06-22 13:57:26 -0700 | [diff] [blame] | 58 | public static final String MODIFIED = "modified"; |
Chris Wren | 1ada10d | 2013-09-13 18:01:38 -0400 | [diff] [blame] | 59 | |
Romain Guy | 73b979d | 2009-06-09 12:57:21 -0700 | [diff] [blame] | 60 | /** |
| 61 | * Descriptive name of the gesture that can be displayed to the user. |
| 62 | * <P>Type: TEXT</P> |
| 63 | */ |
Sunny Goyal | 2fb2f0b | 2015-06-22 13:57:26 -0700 | [diff] [blame] | 64 | public static final String TITLE = "title"; |
Romain Guy | 73b979d | 2009-06-09 12:57:21 -0700 | [diff] [blame] | 65 | |
| 66 | /** |
| 67 | * The Intent URL of the gesture, describing what it points to. This |
Romain Guy | 1ce1a24 | 2009-06-23 17:34:54 -0700 | [diff] [blame] | 68 | * value is given to {@link android.content.Intent#parseUri(String, int)} to create |
Romain Guy | 73b979d | 2009-06-09 12:57:21 -0700 | [diff] [blame] | 69 | * an Intent that can be launched. |
| 70 | * <P>Type: TEXT</P> |
| 71 | */ |
Sunny Goyal | 18b640c | 2015-04-17 09:24:01 -0700 | [diff] [blame] | 72 | public static final String INTENT = "intent"; |
Romain Guy | 73b979d | 2009-06-09 12:57:21 -0700 | [diff] [blame] | 73 | |
| 74 | /** |
| 75 | * The type of the gesture |
| 76 | * |
| 77 | * <P>Type: INTEGER</P> |
| 78 | */ |
Sunny Goyal | 2fb2f0b | 2015-06-22 13:57:26 -0700 | [diff] [blame] | 79 | public static final String ITEM_TYPE = "itemType"; |
Romain Guy | 73b979d | 2009-06-09 12:57:21 -0700 | [diff] [blame] | 80 | |
| 81 | /** |
Samuel Fufa | d3720c2 | 2019-09-06 11:25:08 -0700 | [diff] [blame] | 82 | * The gesture is a package |
| 83 | */ |
| 84 | public static final int ITEM_TYPE_NON_ACTIONABLE = -1; |
| 85 | /** |
Romain Guy | 73b979d | 2009-06-09 12:57:21 -0700 | [diff] [blame] | 86 | * The gesture is an application |
| 87 | */ |
Sunny Goyal | 2fb2f0b | 2015-06-22 13:57:26 -0700 | [diff] [blame] | 88 | public static final int ITEM_TYPE_APPLICATION = 0; |
Romain Guy | 73b979d | 2009-06-09 12:57:21 -0700 | [diff] [blame] | 89 | |
| 90 | /** |
| 91 | * The gesture is an application created shortcut |
| 92 | */ |
Sunny Goyal | 2fb2f0b | 2015-06-22 13:57:26 -0700 | [diff] [blame] | 93 | public static final int ITEM_TYPE_SHORTCUT = 1; |
Romain Guy | 73b979d | 2009-06-09 12:57:21 -0700 | [diff] [blame] | 94 | |
| 95 | /** |
Andy Wickham | 19ab177 | 2021-02-10 21:36:51 -0800 | [diff] [blame] | 96 | * The favorite is a user created folder |
| 97 | */ |
| 98 | public static final int ITEM_TYPE_FOLDER = 2; |
| 99 | |
| 100 | /** |
| 101 | * The favorite is a widget |
| 102 | */ |
| 103 | public static final int ITEM_TYPE_APPWIDGET = 4; |
| 104 | |
| 105 | /** |
| 106 | * The favorite is a custom widget provided by the launcher |
| 107 | */ |
| 108 | public static final int ITEM_TYPE_CUSTOM_APPWIDGET = 5; |
| 109 | |
| 110 | /** |
| 111 | * The gesture is an application created deep shortcut |
| 112 | */ |
| 113 | public static final int ITEM_TYPE_DEEP_SHORTCUT = 6; |
| 114 | |
sfufa@google.com | ca76de0 | 2021-09-24 08:55:48 -0700 | [diff] [blame] | 115 | |
Andy Wickham | 9345681 | 2022-10-05 17:58:45 -0700 | [diff] [blame] | 116 | // *** Below enum values are used for metrics purpose but not used in Favorites DB *** |
sfufa@google.com | ca76de0 | 2021-09-24 08:55:48 -0700 | [diff] [blame] | 117 | |
| 118 | /** |
Andy Wickham | 19ab177 | 2021-02-10 21:36:51 -0800 | [diff] [blame] | 119 | * Type of the item is recents task. |
Andy Wickham | 19ab177 | 2021-02-10 21:36:51 -0800 | [diff] [blame] | 120 | */ |
| 121 | public static final int ITEM_TYPE_TASK = 7; |
| 122 | |
| 123 | /** |
| 124 | * The item is QSB |
| 125 | */ |
| 126 | public static final int ITEM_TYPE_QSB = 8; |
| 127 | |
| 128 | /** |
Andy Wickham | 9345681 | 2022-10-05 17:58:45 -0700 | [diff] [blame] | 129 | * The favorite is a search action |
| 130 | */ |
| 131 | public static final int ITEM_TYPE_SEARCH_ACTION = 9; |
| 132 | |
| 133 | /** |
Sunny Goyal | eb4b799 | 2016-04-21 14:30:18 -0700 | [diff] [blame] | 134 | * The custom icon bitmap. |
Romain Guy | 73b979d | 2009-06-09 12:57:21 -0700 | [diff] [blame] | 135 | * <P>Type: BLOB</P> |
| 136 | */ |
Sunny Goyal | 2fb2f0b | 2015-06-22 13:57:26 -0700 | [diff] [blame] | 137 | public static final String ICON = "icon"; |
Sunny Goyal | 18b640c | 2015-04-17 09:24:01 -0700 | [diff] [blame] | 138 | |
| 139 | public static final String TABLE_NAME = "favorites"; |
| 140 | |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 141 | /** |
Tracy Zhou | be13d10 | 2020-01-12 01:07:59 -0800 | [diff] [blame] | 142 | * Backup table created when the favorites table is modified during grid migration |
Sunny Goyal | 161a214 | 2018-10-29 14:02:20 -0700 | [diff] [blame] | 143 | */ |
| 144 | public static final String BACKUP_TABLE_NAME = "favorites_bakup"; |
| 145 | |
| 146 | /** |
Samuel Fufa | f667a13 | 2020-05-29 14:47:42 -0700 | [diff] [blame] | 147 | * Backup table created when user hotseat is moved to workspace for hybrid hotseat |
| 148 | */ |
| 149 | public static final String HYBRID_HOTSEAT_BACKUP_TABLE = "hotseat_restore_backup"; |
| 150 | |
| 151 | /** |
Tracy Zhou | be13d10 | 2020-01-12 01:07:59 -0800 | [diff] [blame] | 152 | * Temporary table used specifically for grid migrations during wallpaper preview |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 153 | */ |
Tracy Zhou | be13d10 | 2020-01-12 01:07:59 -0800 | [diff] [blame] | 154 | public static final String PREVIEW_TABLE_NAME = "favorites_preview"; |
| 155 | |
| 156 | /** |
Tracy Zhou | f601872 | 2020-02-06 16:37:16 -0800 | [diff] [blame] | 157 | * Temporary table used specifically for multi-db grid migrations |
| 158 | */ |
| 159 | public static final String TMP_TABLE = "favorites_tmp"; |
| 160 | |
| 161 | /** |
Tracy Zhou | be13d10 | 2020-01-12 01:07:59 -0800 | [diff] [blame] | 162 | * The content:// style URL for "favorites" table |
| 163 | */ |
| 164 | public static final Uri CONTENT_URI = Uri.parse("content://" |
| 165 | + LauncherProvider.AUTHORITY + "/" + TABLE_NAME); |
| 166 | |
| 167 | /** |
Pinyao Ting | f39f351 | 2020-10-28 16:30:42 -0700 | [diff] [blame] | 168 | * The content:// style URL for "favorites_bakup" table |
| 169 | */ |
| 170 | public static final Uri BACKUP_CONTENT_URI = Uri.parse("content://" |
| 171 | + LauncherProvider.AUTHORITY + "/" + BACKUP_TABLE_NAME); |
| 172 | |
| 173 | /** |
Tracy Zhou | be13d10 | 2020-01-12 01:07:59 -0800 | [diff] [blame] | 174 | * The content:// style URL for "favorites_preview" table |
| 175 | */ |
| 176 | public static final Uri PREVIEW_CONTENT_URI = Uri.parse("content://" |
| 177 | + LauncherProvider.AUTHORITY + "/" + PREVIEW_TABLE_NAME); |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 178 | |
| 179 | /** |
Tracy Zhou | f601872 | 2020-02-06 16:37:16 -0800 | [diff] [blame] | 180 | * The content:// style URL for "favorites_tmp" table |
| 181 | */ |
| 182 | public static final Uri TMP_CONTENT_URI = Uri.parse("content://" |
| 183 | + LauncherProvider.AUTHORITY + "/" + TMP_TABLE); |
| 184 | |
| 185 | /** |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 186 | * The content:// style URL for a given row, identified by its id. |
| 187 | * |
| 188 | * @param id The row id. |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 189 | * |
| 190 | * @return The unique content URL for the specified row. |
| 191 | */ |
Sunny Goyal | efb7e84 | 2018-10-04 15:11:00 -0700 | [diff] [blame] | 192 | public static Uri getContentUri(int id) { |
Tracy Zhou | be13d10 | 2020-01-12 01:07:59 -0800 | [diff] [blame] | 193 | return Uri.parse("content://" + LauncherProvider.AUTHORITY |
| 194 | + "/" + TABLE_NAME + "/" + id); |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 195 | } |
| 196 | |
| 197 | /** |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 198 | * The container holding the favorite |
| 199 | * <P>Type: INTEGER</P> |
| 200 | */ |
Sunny Goyal | 18b640c | 2015-04-17 09:24:01 -0700 | [diff] [blame] | 201 | public static final String CONTAINER = "container"; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 202 | |
| 203 | /** |
| 204 | * The icon is a resource identified by a package name and an integer id. |
| 205 | */ |
Sunny Goyal | 18b640c | 2015-04-17 09:24:01 -0700 | [diff] [blame] | 206 | public static final int CONTAINER_DESKTOP = -100; |
| 207 | public static final int CONTAINER_HOTSEAT = -101; |
Samuel Fufa | 866ff00 | 2019-08-09 16:16:06 -0700 | [diff] [blame] | 208 | public static final int CONTAINER_PREDICTION = -102; |
Steven Ng | 3a83532 | 2021-03-02 21:26:00 +0000 | [diff] [blame] | 209 | public static final int CONTAINER_WIDGETS_PREDICTION = -111; |
Samuel Fufa | 225ac27 | 2019-10-21 02:02:40 -0700 | [diff] [blame] | 210 | public static final int CONTAINER_HOTSEAT_PREDICTION = -103; |
thiruram | 261c3a6 | 2020-04-29 16:23:15 -0700 | [diff] [blame] | 211 | public static final int CONTAINER_ALL_APPS = -104; |
thiruram | 6bf6848 | 2020-05-06 22:19:43 -0700 | [diff] [blame] | 212 | public static final int CONTAINER_WIDGETS_TRAY = -105; |
Yogisha Dixit | 658c5da | 2021-05-24 23:23:15 +0100 | [diff] [blame] | 213 | public static final int CONTAINER_BOTTOM_WIDGETS_TRAY = -112; |
| 214 | public static final int CONTAINER_PIN_WIDGETS = -113; |
Brian Isganitis | f0ca4ae | 2021-09-02 16:08:29 -0400 | [diff] [blame] | 215 | public static final int CONTAINER_WALLPAPERS = -114; |
thiruram | 63bf8ee | 2020-06-01 12:03:19 -0700 | [diff] [blame] | 216 | public static final int CONTAINER_SHORTCUTS = -107; |
Hyunyoung Song | f26c793 | 2020-06-06 14:44:27 -0700 | [diff] [blame] | 217 | public static final int CONTAINER_SETTINGS = -108; |
Hyunyoung Song | 13c2bc7 | 2020-06-10 00:35:35 -0700 | [diff] [blame] | 218 | public static final int CONTAINER_TASKSWITCHER = -109; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 219 | |
thiruram | 73821a9 | 2021-02-05 17:50:37 -0800 | [diff] [blame] | 220 | // Represents any of the extended containers implemented in non-AOSP variants. |
| 221 | public static final int EXTENDED_CONTAINERS = -200; |
| 222 | |
Yogisha Dixit | 658c5da | 2021-05-24 23:23:15 +0100 | [diff] [blame] | 223 | public static final int CONTAINER_UNKNOWN = -1; |
| 224 | |
Sunny Goyal | e396abf | 2020-04-06 15:11:17 -0700 | [diff] [blame] | 225 | public static final String containerToString(int container) { |
Dan Sandler | ab5fa3a | 2014-03-06 23:48:04 -0500 | [diff] [blame] | 226 | switch (container) { |
| 227 | case CONTAINER_DESKTOP: return "desktop"; |
| 228 | case CONTAINER_HOTSEAT: return "hotseat"; |
Samuel Fufa | 866ff00 | 2019-08-09 16:16:06 -0700 | [diff] [blame] | 229 | case CONTAINER_PREDICTION: return "prediction"; |
thiruram | 6bf6848 | 2020-05-06 22:19:43 -0700 | [diff] [blame] | 230 | case CONTAINER_ALL_APPS: return "all_apps"; |
| 231 | case CONTAINER_WIDGETS_TRAY: return "widgets_tray"; |
thiruram | 63bf8ee | 2020-06-01 12:03:19 -0700 | [diff] [blame] | 232 | case CONTAINER_SHORTCUTS: return "shortcuts"; |
Dan Sandler | ab5fa3a | 2014-03-06 23:48:04 -0500 | [diff] [blame] | 233 | default: return String.valueOf(container); |
| 234 | } |
| 235 | } |
| 236 | |
Sunny Goyal | e396abf | 2020-04-06 15:11:17 -0700 | [diff] [blame] | 237 | public static final String itemTypeToString(int type) { |
Hyunyoung Song | 86160f5 | 2017-02-06 10:46:24 -0800 | [diff] [blame] | 238 | switch(type) { |
| 239 | case ITEM_TYPE_APPLICATION: return "APP"; |
| 240 | case ITEM_TYPE_SHORTCUT: return "SHORTCUT"; |
| 241 | case ITEM_TYPE_FOLDER: return "FOLDER"; |
| 242 | case ITEM_TYPE_APPWIDGET: return "WIDGET"; |
| 243 | case ITEM_TYPE_CUSTOM_APPWIDGET: return "CUSTOMWIDGET"; |
| 244 | case ITEM_TYPE_DEEP_SHORTCUT: return "DEEPSHORTCUT"; |
Andy Wickham | 19ab177 | 2021-02-10 21:36:51 -0800 | [diff] [blame] | 245 | case ITEM_TYPE_TASK: return "TASK"; |
| 246 | case ITEM_TYPE_QSB: return "QSB"; |
Hyunyoung Song | 86160f5 | 2017-02-06 10:46:24 -0800 | [diff] [blame] | 247 | default: return String.valueOf(type); |
| 248 | } |
| 249 | } |
| 250 | |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 251 | /** |
| 252 | * The screen holding the favorite (if container is CONTAINER_DESKTOP) |
| 253 | * <P>Type: INTEGER</P> |
| 254 | */ |
Sunny Goyal | 18b640c | 2015-04-17 09:24:01 -0700 | [diff] [blame] | 255 | public static final String SCREEN = "screen"; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 256 | |
| 257 | /** |
| 258 | * The X coordinate of the cell holding the favorite |
Adam Cohen | c51934b | 2011-07-26 21:07:43 -0700 | [diff] [blame] | 259 | * (if container is CONTAINER_HOTSEAT or CONTAINER_HOTSEAT) |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 260 | * <P>Type: INTEGER</P> |
| 261 | */ |
Sunny Goyal | 2fb2f0b | 2015-06-22 13:57:26 -0700 | [diff] [blame] | 262 | public static final String CELLX = "cellX"; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 263 | |
| 264 | /** |
| 265 | * The Y coordinate of the cell holding the favorite |
| 266 | * (if container is CONTAINER_DESKTOP) |
| 267 | * <P>Type: INTEGER</P> |
| 268 | */ |
Sunny Goyal | 2fb2f0b | 2015-06-22 13:57:26 -0700 | [diff] [blame] | 269 | public static final String CELLY = "cellY"; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 270 | |
| 271 | /** |
| 272 | * The X span of the cell holding the favorite |
| 273 | * <P>Type: INTEGER</P> |
| 274 | */ |
Sunny Goyal | 2fb2f0b | 2015-06-22 13:57:26 -0700 | [diff] [blame] | 275 | public static final String SPANX = "spanX"; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 276 | |
| 277 | /** |
| 278 | * The Y span of the cell holding the favorite |
| 279 | * <P>Type: INTEGER</P> |
| 280 | */ |
Sunny Goyal | 2fb2f0b | 2015-06-22 13:57:26 -0700 | [diff] [blame] | 281 | public static final String SPANY = "spanY"; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 282 | |
| 283 | /** |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 284 | * The profile id of the item in the cell. |
| 285 | * <P> |
| 286 | * Type: INTEGER |
| 287 | * </P> |
| 288 | */ |
Sunny Goyal | 2fb2f0b | 2015-06-22 13:57:26 -0700 | [diff] [blame] | 289 | public static final String PROFILE_ID = "profileId"; |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 290 | |
| 291 | /** |
The Android Open Source Project | 7376fae | 2009-03-11 12:11:58 -0700 | [diff] [blame] | 292 | * The appWidgetId of the widget |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 293 | * |
| 294 | * <P>Type: INTEGER</P> |
| 295 | */ |
Sunny Goyal | 2fb2f0b | 2015-06-22 13:57:26 -0700 | [diff] [blame] | 296 | public static final String APPWIDGET_ID = "appWidgetId"; |
Chris Wren | d5e66bf | 2013-09-16 14:02:29 -0400 | [diff] [blame] | 297 | |
| 298 | /** |
| 299 | * The ComponentName of the widget provider |
| 300 | * |
| 301 | * <P>Type: STRING</P> |
| 302 | */ |
| 303 | public static final String APPWIDGET_PROVIDER = "appWidgetProvider"; |
Chris Wren | f4d0811 | 2014-01-16 18:13:56 -0500 | [diff] [blame] | 304 | |
| 305 | /** |
| 306 | * Boolean indicating that his item was restored and not yet successfully bound. |
| 307 | * <P>Type: INTEGER</P> |
| 308 | */ |
Sunny Goyal | 2fb2f0b | 2015-06-22 13:57:26 -0700 | [diff] [blame] | 309 | public static final String RESTORED = "restored"; |
Sunny Goyal | 08f7261 | 2015-01-05 13:41:43 -0800 | [diff] [blame] | 310 | |
| 311 | /** |
| 312 | * Indicates the position of the item inside an auto-arranged view like folder or hotseat. |
| 313 | * <p>Type: INTEGER</p> |
| 314 | */ |
Sunny Goyal | 2fb2f0b | 2015-06-22 13:57:26 -0700 | [diff] [blame] | 315 | public static final String RANK = "rank"; |
Sunny Goyal | 5d85c44 | 2015-03-10 13:14:47 -0700 | [diff] [blame] | 316 | |
| 317 | /** |
| 318 | * Stores general flag based options for {@link ItemInfo}s. |
| 319 | * <p>Type: INTEGER</p> |
| 320 | */ |
Sunny Goyal | 2fb2f0b | 2015-06-22 13:57:26 -0700 | [diff] [blame] | 321 | public static final String OPTIONS = "options"; |
Sunny Goyal | c190dbf | 2016-05-05 14:37:05 -0700 | [diff] [blame] | 322 | |
Yogisha Dixit | 658c5da | 2021-05-24 23:23:15 +0100 | [diff] [blame] | 323 | /** |
| 324 | * Stores the source container that the widget was added from. |
| 325 | * <p>Type: INTEGER</p> |
| 326 | */ |
| 327 | public static final String APPWIDGET_SOURCE = "appWidgetSource"; |
| 328 | |
Sunny Goyal | c190dbf | 2016-05-05 14:37:05 -0700 | [diff] [blame] | 329 | public static void addTableToDb(SQLiteDatabase db, long myProfileId, boolean optional) { |
Sunny Goyal | 161a214 | 2018-10-29 14:02:20 -0700 | [diff] [blame] | 330 | addTableToDb(db, myProfileId, optional, TABLE_NAME); |
| 331 | } |
| 332 | |
| 333 | public static void addTableToDb(SQLiteDatabase db, long myProfileId, boolean optional, |
| 334 | String tableName) { |
Sunny Goyal | c190dbf | 2016-05-05 14:37:05 -0700 | [diff] [blame] | 335 | String ifNotExists = optional ? " IF NOT EXISTS " : ""; |
Sunny Goyal | 161a214 | 2018-10-29 14:02:20 -0700 | [diff] [blame] | 336 | db.execSQL("CREATE TABLE " + ifNotExists + tableName + " (" + |
Sunny Goyal | c190dbf | 2016-05-05 14:37:05 -0700 | [diff] [blame] | 337 | "_id INTEGER PRIMARY KEY," + |
| 338 | "title TEXT," + |
| 339 | "intent TEXT," + |
| 340 | "container INTEGER," + |
| 341 | "screen INTEGER," + |
| 342 | "cellX INTEGER," + |
| 343 | "cellY INTEGER," + |
| 344 | "spanX INTEGER," + |
| 345 | "spanY INTEGER," + |
| 346 | "itemType INTEGER," + |
| 347 | "appWidgetId INTEGER NOT NULL DEFAULT -1," + |
Sunny Goyal | c190dbf | 2016-05-05 14:37:05 -0700 | [diff] [blame] | 348 | "icon BLOB," + |
| 349 | "appWidgetProvider TEXT," + |
| 350 | "modified INTEGER NOT NULL DEFAULT 0," + |
| 351 | "restored INTEGER NOT NULL DEFAULT 0," + |
| 352 | "profileId INTEGER DEFAULT " + myProfileId + "," + |
| 353 | "rank INTEGER NOT NULL DEFAULT 0," + |
Yogisha Dixit | 658c5da | 2021-05-24 23:23:15 +0100 | [diff] [blame] | 354 | "options INTEGER NOT NULL DEFAULT 0," + |
| 355 | APPWIDGET_SOURCE + " INTEGER NOT NULL DEFAULT " + CONTAINER_UNKNOWN + |
Sunny Goyal | c190dbf | 2016-05-05 14:37:05 -0700 | [diff] [blame] | 356 | ");"); |
| 357 | } |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 358 | } |
Sunny Goyal | 7779d62 | 2015-06-11 16:18:39 -0700 | [diff] [blame] | 359 | |
| 360 | /** |
| 361 | * Launcher settings |
| 362 | */ |
| 363 | public static final class Settings { |
| 364 | |
| 365 | public static final Uri CONTENT_URI = Uri.parse("content://" + |
Sunny Goyal | 3d706ad | 2017-03-06 16:56:39 -0800 | [diff] [blame] | 366 | LauncherProvider.AUTHORITY + "/settings"); |
Sunny Goyal | 7779d62 | 2015-06-11 16:18:39 -0700 | [diff] [blame] | 367 | |
Sunny Goyal | d249748 | 2015-09-22 18:24:19 -0700 | [diff] [blame] | 368 | public static final String METHOD_CLEAR_EMPTY_DB_FLAG = "clear_empty_db_flag"; |
| 369 | |
| 370 | public static final String METHOD_DELETE_EMPTY_FOLDERS = "delete_empty_folders"; |
Sunny Goyal | d249748 | 2015-09-22 18:24:19 -0700 | [diff] [blame] | 371 | |
| 372 | public static final String METHOD_NEW_ITEM_ID = "generate_new_item_id"; |
| 373 | public static final String METHOD_NEW_SCREEN_ID = "generate_new_screen_id"; |
| 374 | |
| 375 | public static final String METHOD_CREATE_EMPTY_DB = "create_empty_db"; |
Sunny Goyal | d249748 | 2015-09-22 18:24:19 -0700 | [diff] [blame] | 376 | |
| 377 | public static final String METHOD_LOAD_DEFAULT_FAVORITES = "load_default_favorites"; |
Sunny Goyal | 7779d62 | 2015-06-11 16:18:39 -0700 | [diff] [blame] | 378 | |
Sunny Goyal | 55fddc8 | 2017-04-06 15:02:52 -0700 | [diff] [blame] | 379 | public static final String METHOD_REMOVE_GHOST_WIDGETS = "remove_ghost_widgets"; |
| 380 | |
Sunny Goyal | 161a214 | 2018-10-29 14:02:20 -0700 | [diff] [blame] | 381 | public static final String METHOD_NEW_TRANSACTION = "new_db_transaction"; |
| 382 | |
Samuel Fufa | f667a13 | 2020-05-29 14:47:42 -0700 | [diff] [blame] | 383 | public static final String METHOD_REFRESH_HOTSEAT_RESTORE_TABLE = "restore_hotseat_table"; |
| 384 | |
Tracy Zhou | 7df93d2 | 2020-01-27 13:44:06 -0800 | [diff] [blame] | 385 | public static final String METHOD_UPDATE_CURRENT_OPEN_HELPER = "update_current_open_helper"; |
| 386 | |
Tracy Zhou | c000045 | 2020-03-17 18:28:38 -0700 | [diff] [blame] | 387 | public static final String METHOD_PREP_FOR_PREVIEW = "prep_for_preview"; |
| 388 | |
Sunny Goyal | 7779d62 | 2015-06-11 16:18:39 -0700 | [diff] [blame] | 389 | public static final String EXTRA_VALUE = "value"; |
Sunny Goyal | d249748 | 2015-09-22 18:24:19 -0700 | [diff] [blame] | 390 | |
Pinyao Ting | 702ed27 | 2020-10-14 11:17:04 -0700 | [diff] [blame] | 391 | public static final String EXTRA_DB_NAME = "db_name"; |
| 392 | |
Sunny Goyal | ab2f808 | 2023-04-11 11:35:43 -0700 | [diff] [blame^] | 393 | public static final String LAYOUT_DIGEST_KEY = "launcher3.layout.provider.blob"; |
| 394 | public static final String LAYOUT_DIGEST_LABEL = "launcher-layout"; |
| 395 | public static final String LAYOUT_DIGEST_TAG = "ignore"; |
| 396 | |
Sunny Goyal | d249748 | 2015-09-22 18:24:19 -0700 | [diff] [blame] | 397 | public static Bundle call(ContentResolver cr, String method) { |
Pinyao Ting | 96186af | 2020-07-20 11:03:39 -0700 | [diff] [blame] | 398 | return call(cr, method, null /* arg */); |
Tracy Zhou | c000045 | 2020-03-17 18:28:38 -0700 | [diff] [blame] | 399 | } |
| 400 | |
| 401 | public static Bundle call(ContentResolver cr, String method, String arg) { |
Pinyao Ting | 96186af | 2020-07-20 11:03:39 -0700 | [diff] [blame] | 402 | return call(cr, method, arg, null /* extras */); |
| 403 | } |
| 404 | |
| 405 | public static Bundle call(ContentResolver cr, String method, String arg, Bundle extras) { |
| 406 | return cr.call(CONTENT_URI, method, arg, extras); |
Sunny Goyal | d249748 | 2015-09-22 18:24:19 -0700 | [diff] [blame] | 407 | } |
Sunny Goyal | 7779d62 | 2015-06-11 16:18:39 -0700 | [diff] [blame] | 408 | } |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 409 | } |