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 | |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 19 | import android.net.Uri; |
Adam Cohen | df2cc41 | 2011-04-27 16:56:57 -0700 | [diff] [blame] | 20 | import android.provider.BaseColumns; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * Settings related utilities. |
| 24 | */ |
| 25 | class LauncherSettings { |
Chris Wren | 1ada10d | 2013-09-13 18:01:38 -0400 | [diff] [blame] | 26 | /** Columns required on table staht will be subject to backup and restore. */ |
| 27 | static interface ChangeLogColumns extends BaseColumns { |
| 28 | /** |
| 29 | * The time of the last update to this row. |
| 30 | * <P>Type: INTEGER</P> |
| 31 | */ |
| 32 | static final String MODIFIED = "modified"; |
| 33 | } |
| 34 | |
| 35 | static interface BaseLauncherColumns extends ChangeLogColumns { |
Romain Guy | 73b979d | 2009-06-09 12:57:21 -0700 | [diff] [blame] | 36 | /** |
| 37 | * Descriptive name of the gesture that can be displayed to the user. |
| 38 | * <P>Type: TEXT</P> |
| 39 | */ |
| 40 | static final String TITLE = "title"; |
| 41 | |
| 42 | /** |
| 43 | * The Intent URL of the gesture, describing what it points to. This |
Romain Guy | 1ce1a24 | 2009-06-23 17:34:54 -0700 | [diff] [blame] | 44 | * 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] | 45 | * an Intent that can be launched. |
| 46 | * <P>Type: TEXT</P> |
| 47 | */ |
| 48 | static final String INTENT = "intent"; |
| 49 | |
| 50 | /** |
| 51 | * The type of the gesture |
| 52 | * |
| 53 | * <P>Type: INTEGER</P> |
| 54 | */ |
| 55 | static final String ITEM_TYPE = "itemType"; |
| 56 | |
| 57 | /** |
| 58 | * The gesture is an application |
| 59 | */ |
| 60 | static final int ITEM_TYPE_APPLICATION = 0; |
| 61 | |
| 62 | /** |
| 63 | * The gesture is an application created shortcut |
| 64 | */ |
| 65 | static final int ITEM_TYPE_SHORTCUT = 1; |
| 66 | |
| 67 | /** |
| 68 | * The icon type. |
| 69 | * <P>Type: INTEGER</P> |
| 70 | */ |
| 71 | static final String ICON_TYPE = "iconType"; |
| 72 | |
| 73 | /** |
| 74 | * The icon is a resource identified by a package name and an integer id. |
| 75 | */ |
| 76 | static final int ICON_TYPE_RESOURCE = 0; |
| 77 | |
| 78 | /** |
| 79 | * The icon is a bitmap. |
| 80 | */ |
| 81 | static final int ICON_TYPE_BITMAP = 1; |
| 82 | |
| 83 | /** |
| 84 | * The icon package name, if icon type is ICON_TYPE_RESOURCE. |
| 85 | * <P>Type: TEXT</P> |
| 86 | */ |
| 87 | static final String ICON_PACKAGE = "iconPackage"; |
| 88 | |
| 89 | /** |
| 90 | * The icon resource id, if icon type is ICON_TYPE_RESOURCE. |
| 91 | * <P>Type: TEXT</P> |
| 92 | */ |
| 93 | static final String ICON_RESOURCE = "iconResource"; |
| 94 | |
| 95 | /** |
| 96 | * The custom icon bitmap, if icon type is ICON_TYPE_BITMAP. |
| 97 | * <P>Type: BLOB</P> |
| 98 | */ |
| 99 | static final String ICON = "icon"; |
| 100 | } |
| 101 | |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 102 | /** |
Adam Cohen | dcd297f | 2013-06-18 13:13:40 -0700 | [diff] [blame] | 103 | * Workspace Screens. |
| 104 | * |
| 105 | * Tracks the order of workspace screens. |
| 106 | */ |
Chris Wren | 1ada10d | 2013-09-13 18:01:38 -0400 | [diff] [blame] | 107 | static final class WorkspaceScreens implements ChangeLogColumns { |
Adam Cohen | dcd297f | 2013-06-18 13:13:40 -0700 | [diff] [blame] | 108 | /** |
| 109 | * The content:// style URL for this table |
| 110 | */ |
| 111 | static final Uri CONTENT_URI = Uri.parse("content://" + |
| 112 | LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_WORKSPACE_SCREENS + |
| 113 | "?" + LauncherProvider.PARAMETER_NOTIFY + "=true"); |
| 114 | |
| 115 | /** |
| 116 | * The rank of this screen -- ie. how it is ordered relative to the other screens. |
| 117 | * <P>Type: INTEGER</P> |
| 118 | */ |
| 119 | static final String SCREEN_RANK = "screenRank"; |
| 120 | } |
| 121 | |
| 122 | /** |
Bjorn Bringert | 93c4576 | 2009-12-16 13:19:47 +0000 | [diff] [blame] | 123 | * Favorites. |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 124 | */ |
Romain Guy | 73b979d | 2009-06-09 12:57:21 -0700 | [diff] [blame] | 125 | static final class Favorites implements BaseLauncherColumns { |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 126 | /** |
| 127 | * The content:// style URL for this table |
| 128 | */ |
| 129 | static final Uri CONTENT_URI = Uri.parse("content://" + |
| 130 | LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES + |
| 131 | "?" + LauncherProvider.PARAMETER_NOTIFY + "=true"); |
| 132 | |
| 133 | /** |
Adam Cohen | e25af79 | 2013-06-06 23:08:25 -0700 | [diff] [blame] | 134 | * The content:// style URL for this table |
| 135 | */ |
| 136 | static final Uri OLD_CONTENT_URI = Uri.parse("content://" + |
| 137 | LauncherProvider.OLD_AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES + |
| 138 | "?" + LauncherProvider.PARAMETER_NOTIFY + "=true"); |
| 139 | |
| 140 | /** |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 141 | * The content:// style URL for this table. When this Uri is used, no notification is |
| 142 | * sent if the content changes. |
| 143 | */ |
| 144 | static final Uri CONTENT_URI_NO_NOTIFICATION = Uri.parse("content://" + |
| 145 | LauncherProvider.AUTHORITY + "/" + LauncherProvider.TABLE_FAVORITES + |
| 146 | "?" + LauncherProvider.PARAMETER_NOTIFY + "=false"); |
| 147 | |
| 148 | /** |
| 149 | * The content:// style URL for a given row, identified by its id. |
| 150 | * |
| 151 | * @param id The row id. |
| 152 | * @param notify True to send a notification is the content changes. |
| 153 | * |
| 154 | * @return The unique content URL for the specified row. |
| 155 | */ |
| 156 | static Uri getContentUri(long id, boolean notify) { |
| 157 | return Uri.parse("content://" + LauncherProvider.AUTHORITY + |
| 158 | "/" + LauncherProvider.TABLE_FAVORITES + "/" + id + "?" + |
| 159 | LauncherProvider.PARAMETER_NOTIFY + "=" + notify); |
| 160 | } |
| 161 | |
| 162 | /** |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 163 | * The container holding the favorite |
| 164 | * <P>Type: INTEGER</P> |
| 165 | */ |
| 166 | static final String CONTAINER = "container"; |
| 167 | |
| 168 | /** |
| 169 | * The icon is a resource identified by a package name and an integer id. |
| 170 | */ |
| 171 | static final int CONTAINER_DESKTOP = -100; |
Winson Chung | 3d503fb | 2011-07-13 17:25:49 -0700 | [diff] [blame] | 172 | static final int CONTAINER_HOTSEAT = -101; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 173 | |
Dan Sandler | ab5fa3a | 2014-03-06 23:48:04 -0500 | [diff] [blame] | 174 | static final String containerToString(int container) { |
| 175 | switch (container) { |
| 176 | case CONTAINER_DESKTOP: return "desktop"; |
| 177 | case CONTAINER_HOTSEAT: return "hotseat"; |
| 178 | default: return String.valueOf(container); |
| 179 | } |
| 180 | } |
| 181 | |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 182 | /** |
| 183 | * The screen holding the favorite (if container is CONTAINER_DESKTOP) |
| 184 | * <P>Type: INTEGER</P> |
| 185 | */ |
| 186 | static final String SCREEN = "screen"; |
| 187 | |
| 188 | /** |
| 189 | * The X coordinate of the cell holding the favorite |
Adam Cohen | c51934b | 2011-07-26 21:07:43 -0700 | [diff] [blame] | 190 | * (if container is CONTAINER_HOTSEAT or CONTAINER_HOTSEAT) |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 191 | * <P>Type: INTEGER</P> |
| 192 | */ |
| 193 | static final String CELLX = "cellX"; |
| 194 | |
| 195 | /** |
| 196 | * The Y coordinate of the cell holding the favorite |
| 197 | * (if container is CONTAINER_DESKTOP) |
| 198 | * <P>Type: INTEGER</P> |
| 199 | */ |
| 200 | static final String CELLY = "cellY"; |
| 201 | |
| 202 | /** |
| 203 | * The X span of the cell holding the favorite |
| 204 | * <P>Type: INTEGER</P> |
| 205 | */ |
| 206 | static final String SPANX = "spanX"; |
| 207 | |
| 208 | /** |
| 209 | * The Y span of the cell holding the favorite |
| 210 | * <P>Type: INTEGER</P> |
| 211 | */ |
| 212 | static final String SPANY = "spanY"; |
| 213 | |
| 214 | /** |
Kenny Guy | ed13187 | 2014-04-30 03:02:21 +0100 | [diff] [blame] | 215 | * The profile id of the item in the cell. |
| 216 | * <P> |
| 217 | * Type: INTEGER |
| 218 | * </P> |
| 219 | */ |
| 220 | static final String PROFILE_ID = "profileId"; |
| 221 | |
| 222 | /** |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 223 | * The favorite is a user created folder |
| 224 | */ |
Adam Cohen | df2cc41 | 2011-04-27 16:56:57 -0700 | [diff] [blame] | 225 | static final int ITEM_TYPE_FOLDER = 2; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 226 | |
| 227 | /** |
Adam Cohen | df2cc41 | 2011-04-27 16:56:57 -0700 | [diff] [blame] | 228 | * The favorite is a live folder |
| 229 | * |
| 230 | * Note: live folders can no longer be added to Launcher, and any live folders which |
| 231 | * exist within the launcher database will be ignored when loading. That said, these |
| 232 | * entries in the database may still exist, and are not automatically stripped. |
| 233 | */ |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 234 | static final int ITEM_TYPE_LIVE_FOLDER = 3; |
| 235 | |
| 236 | /** |
The Android Open Source Project | 7376fae | 2009-03-11 12:11:58 -0700 | [diff] [blame] | 237 | * The favorite is a widget |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 238 | */ |
The Android Open Source Project | 7376fae | 2009-03-11 12:11:58 -0700 | [diff] [blame] | 239 | static final int ITEM_TYPE_APPWIDGET = 4; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 240 | |
| 241 | /** |
Adam Cohen | 5940042 | 2014-03-05 18:07:04 -0800 | [diff] [blame] | 242 | * The favorite is a custom widget provided by the launcher |
| 243 | */ |
| 244 | static final int ITEM_TYPE_CUSTOM_APPWIDGET = 5; |
| 245 | |
| 246 | /** |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 247 | * The favorite is a clock |
| 248 | */ |
| 249 | static final int ITEM_TYPE_WIDGET_CLOCK = 1000; |
| 250 | |
| 251 | /** |
| 252 | * The favorite is a search widget |
| 253 | */ |
| 254 | static final int ITEM_TYPE_WIDGET_SEARCH = 1001; |
| 255 | |
| 256 | /** |
| 257 | * The favorite is a photo frame |
| 258 | */ |
| 259 | static final int ITEM_TYPE_WIDGET_PHOTO_FRAME = 1002; |
| 260 | |
| 261 | /** |
The Android Open Source Project | 7376fae | 2009-03-11 12:11:58 -0700 | [diff] [blame] | 262 | * The appWidgetId of the widget |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 263 | * |
| 264 | * <P>Type: INTEGER</P> |
| 265 | */ |
The Android Open Source Project | ca9475f | 2009-03-13 13:04:24 -0700 | [diff] [blame] | 266 | static final String APPWIDGET_ID = "appWidgetId"; |
Chris Wren | d5e66bf | 2013-09-16 14:02:29 -0400 | [diff] [blame] | 267 | |
| 268 | /** |
| 269 | * The ComponentName of the widget provider |
| 270 | * |
| 271 | * <P>Type: STRING</P> |
| 272 | */ |
| 273 | public static final String APPWIDGET_PROVIDER = "appWidgetProvider"; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 274 | |
| 275 | /** |
| 276 | * Indicates whether this favorite is an application-created shortcut or not. |
| 277 | * If the value is 0, the favorite is not an application-created shortcut, if the |
| 278 | * value is 1, it is an application-created shortcut. |
| 279 | * <P>Type: INTEGER</P> |
| 280 | */ |
Romain Guy | 73b979d | 2009-06-09 12:57:21 -0700 | [diff] [blame] | 281 | @Deprecated |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 282 | static final String IS_SHORTCUT = "isShortcut"; |
| 283 | |
| 284 | /** |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 285 | * The URI associated with the favorite. It is used, for instance, by |
| 286 | * live folders to find the content provider. |
| 287 | * <P>Type: TEXT</P> |
| 288 | */ |
| 289 | static final String URI = "uri"; |
| 290 | |
| 291 | /** |
| 292 | * The display mode if the item is a live folder. |
| 293 | * <P>Type: INTEGER</P> |
| 294 | * |
| 295 | * @see android.provider.LiveFolders#DISPLAY_MODE_GRID |
| 296 | * @see android.provider.LiveFolders#DISPLAY_MODE_LIST |
| 297 | */ |
Sunny Goyal | 08f7261 | 2015-01-05 13:41:43 -0800 | [diff] [blame] | 298 | @Deprecated |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 299 | static final String DISPLAY_MODE = "displayMode"; |
Chris Wren | f4d0811 | 2014-01-16 18:13:56 -0500 | [diff] [blame] | 300 | |
| 301 | /** |
| 302 | * Boolean indicating that his item was restored and not yet successfully bound. |
| 303 | * <P>Type: INTEGER</P> |
| 304 | */ |
| 305 | static final String RESTORED = "restored"; |
Sunny Goyal | 08f7261 | 2015-01-05 13:41:43 -0800 | [diff] [blame] | 306 | |
| 307 | /** |
| 308 | * Indicates the position of the item inside an auto-arranged view like folder or hotseat. |
| 309 | * <p>Type: INTEGER</p> |
| 310 | */ |
| 311 | static final String RANK = "rank"; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 312 | } |
| 313 | } |