blob: f2c85a19507038a19a214303fbe72dce1ea80f7f [file] [log] [blame]
The Android Open Source Project31dd5032009-03-03 19:32:27 -08001/*
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 Sandler325dc232013-06-05 22:57:57 -040017package com.android.launcher3;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080018
The Android Open Source Project31dd5032009-03-03 19:32:27 -080019import android.net.Uri;
Adam Cohendf2cc412011-04-27 16:56:57 -070020import android.provider.BaseColumns;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080021
Sunny Goyal18b640c2015-04-17 09:24:01 -070022import com.android.launcher3.config.ProviderConfig;
23
The Android Open Source Project31dd5032009-03-03 19:32:27 -080024/**
25 * Settings related utilities.
26 */
Hyunyoung Song3f471442015-04-08 19:01:34 -070027public class LauncherSettings {
Chris Wren1ada10d2013-09-13 18:01:38 -040028 /** Columns required on table staht will be subject to backup and restore. */
29 static interface ChangeLogColumns extends BaseColumns {
30 /**
31 * The time of the last update to this row.
32 * <P>Type: INTEGER</P>
33 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -070034 public static final String MODIFIED = "modified";
Chris Wren1ada10d2013-09-13 18:01:38 -040035 }
36
37 static interface BaseLauncherColumns extends ChangeLogColumns {
Romain Guy73b979d2009-06-09 12:57:21 -070038 /**
39 * Descriptive name of the gesture that can be displayed to the user.
40 * <P>Type: TEXT</P>
41 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -070042 public static final String TITLE = "title";
Romain Guy73b979d2009-06-09 12:57:21 -070043
44 /**
45 * The Intent URL of the gesture, describing what it points to. This
Romain Guy1ce1a242009-06-23 17:34:54 -070046 * value is given to {@link android.content.Intent#parseUri(String, int)} to create
Romain Guy73b979d2009-06-09 12:57:21 -070047 * an Intent that can be launched.
48 * <P>Type: TEXT</P>
49 */
Sunny Goyal18b640c2015-04-17 09:24:01 -070050 public static final String INTENT = "intent";
Romain Guy73b979d2009-06-09 12:57:21 -070051
52 /**
53 * The type of the gesture
54 *
55 * <P>Type: INTEGER</P>
56 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -070057 public static final String ITEM_TYPE = "itemType";
Romain Guy73b979d2009-06-09 12:57:21 -070058
59 /**
60 * The gesture is an application
61 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -070062 public static final int ITEM_TYPE_APPLICATION = 0;
Romain Guy73b979d2009-06-09 12:57:21 -070063
64 /**
65 * The gesture is an application created shortcut
66 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -070067 public static final int ITEM_TYPE_SHORTCUT = 1;
Romain Guy73b979d2009-06-09 12:57:21 -070068
69 /**
70 * The icon type.
71 * <P>Type: INTEGER</P>
72 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -070073 public static final String ICON_TYPE = "iconType";
Romain Guy73b979d2009-06-09 12:57:21 -070074
75 /**
76 * The icon is a resource identified by a package name and an integer id.
77 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -070078 public static final int ICON_TYPE_RESOURCE = 0;
Romain Guy73b979d2009-06-09 12:57:21 -070079
80 /**
81 * The icon is a bitmap.
82 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -070083 public static final int ICON_TYPE_BITMAP = 1;
Romain Guy73b979d2009-06-09 12:57:21 -070084
85 /**
86 * The icon package name, if icon type is ICON_TYPE_RESOURCE.
87 * <P>Type: TEXT</P>
88 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -070089 public static final String ICON_PACKAGE = "iconPackage";
Romain Guy73b979d2009-06-09 12:57:21 -070090
91 /**
92 * The icon resource id, if icon type is ICON_TYPE_RESOURCE.
93 * <P>Type: TEXT</P>
94 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -070095 public static final String ICON_RESOURCE = "iconResource";
Romain Guy73b979d2009-06-09 12:57:21 -070096
97 /**
98 * The custom icon bitmap, if icon type is ICON_TYPE_BITMAP.
99 * <P>Type: BLOB</P>
100 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -0700101 public static final String ICON = "icon";
Romain Guy73b979d2009-06-09 12:57:21 -0700102 }
103
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800104 /**
Adam Cohendcd297f2013-06-18 13:13:40 -0700105 * Workspace Screens.
106 *
107 * Tracks the order of workspace screens.
108 */
Sunny Goyal18b640c2015-04-17 09:24:01 -0700109 public static final class WorkspaceScreens implements ChangeLogColumns {
110
111 public static final String TABLE_NAME = "workspaceScreens";
112
Adam Cohendcd297f2013-06-18 13:13:40 -0700113 /**
114 * The content:// style URL for this table
115 */
116 static final Uri CONTENT_URI = Uri.parse("content://" +
Sunny Goyal18b640c2015-04-17 09:24:01 -0700117 ProviderConfig.AUTHORITY + "/" + TABLE_NAME);
Adam Cohendcd297f2013-06-18 13:13:40 -0700118
119 /**
120 * The rank of this screen -- ie. how it is ordered relative to the other screens.
121 * <P>Type: INTEGER</P>
122 */
Sunny Goyal18b640c2015-04-17 09:24:01 -0700123 public static final String SCREEN_RANK = "screenRank";
Adam Cohendcd297f2013-06-18 13:13:40 -0700124 }
125
126 /**
Bjorn Bringert93c45762009-12-16 13:19:47 +0000127 * Favorites.
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800128 */
Hyunyoung Song3f471442015-04-08 19:01:34 -0700129 public static final class Favorites implements BaseLauncherColumns {
Sunny Goyal18b640c2015-04-17 09:24:01 -0700130
131 public static final String TABLE_NAME = "favorites";
132
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800133 /**
134 * The content:// style URL for this table
135 */
Sunny Goyal18b640c2015-04-17 09:24:01 -0700136 public static final Uri CONTENT_URI = Uri.parse("content://" +
137 ProviderConfig.AUTHORITY + "/" + TABLE_NAME);
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800138
139 /**
140 * The content:// style URL for a given row, identified by its id.
141 *
142 * @param id The row id.
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800143 *
144 * @return The unique content URL for the specified row.
145 */
Sunny Goyal1d4a2df2015-03-30 11:11:46 -0700146 static Uri getContentUri(long id) {
Sunny Goyal18b640c2015-04-17 09:24:01 -0700147 return Uri.parse("content://" + ProviderConfig.AUTHORITY +
148 "/" + TABLE_NAME + "/" + id);
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800149 }
150
151 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800152 * The container holding the favorite
153 * <P>Type: INTEGER</P>
154 */
Sunny Goyal18b640c2015-04-17 09:24:01 -0700155 public static final String CONTAINER = "container";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800156
157 /**
158 * The icon is a resource identified by a package name and an integer id.
159 */
Sunny Goyal18b640c2015-04-17 09:24:01 -0700160 public static final int CONTAINER_DESKTOP = -100;
161 public static final int CONTAINER_HOTSEAT = -101;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800162
Dan Sandlerab5fa3a2014-03-06 23:48:04 -0500163 static final String containerToString(int container) {
164 switch (container) {
165 case CONTAINER_DESKTOP: return "desktop";
166 case CONTAINER_HOTSEAT: return "hotseat";
167 default: return String.valueOf(container);
168 }
169 }
170
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800171 /**
172 * The screen holding the favorite (if container is CONTAINER_DESKTOP)
173 * <P>Type: INTEGER</P>
174 */
Sunny Goyal18b640c2015-04-17 09:24:01 -0700175 public static final String SCREEN = "screen";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800176
177 /**
178 * The X coordinate of the cell holding the favorite
Adam Cohenc51934b2011-07-26 21:07:43 -0700179 * (if container is CONTAINER_HOTSEAT or CONTAINER_HOTSEAT)
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800180 * <P>Type: INTEGER</P>
181 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -0700182 public static final String CELLX = "cellX";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800183
184 /**
185 * The Y coordinate of the cell holding the favorite
186 * (if container is CONTAINER_DESKTOP)
187 * <P>Type: INTEGER</P>
188 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -0700189 public static final String CELLY = "cellY";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800190
191 /**
192 * The X span of the cell holding the favorite
193 * <P>Type: INTEGER</P>
194 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -0700195 public static final String SPANX = "spanX";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800196
197 /**
198 * The Y span of the cell holding the favorite
199 * <P>Type: INTEGER</P>
200 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -0700201 public static final String SPANY = "spanY";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800202
203 /**
Kenny Guyed131872014-04-30 03:02:21 +0100204 * The profile id of the item in the cell.
205 * <P>
206 * Type: INTEGER
207 * </P>
208 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -0700209 public static final String PROFILE_ID = "profileId";
Kenny Guyed131872014-04-30 03:02:21 +0100210
211 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800212 * The favorite is a user created folder
213 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -0700214 public static final int ITEM_TYPE_FOLDER = 2;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800215
216 /**
Adam Cohendf2cc412011-04-27 16:56:57 -0700217 * The favorite is a live folder
218 *
219 * Note: live folders can no longer be added to Launcher, and any live folders which
220 * exist within the launcher database will be ignored when loading. That said, these
221 * entries in the database may still exist, and are not automatically stripped.
222 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -0700223 @Deprecated
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800224 static final int ITEM_TYPE_LIVE_FOLDER = 3;
225
226 /**
The Android Open Source Project7376fae2009-03-11 12:11:58 -0700227 * The favorite is a widget
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800228 */
Hyunyoung Song3f471442015-04-08 19:01:34 -0700229 public static final int ITEM_TYPE_APPWIDGET = 4;
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800230
231 /**
Adam Cohen59400422014-03-05 18:07:04 -0800232 * The favorite is a custom widget provided by the launcher
233 */
Hyunyoung Song3f471442015-04-08 19:01:34 -0700234 public static final int ITEM_TYPE_CUSTOM_APPWIDGET = 5;
Adam Cohen59400422014-03-05 18:07:04 -0800235
236 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800237 * The favorite is a clock
238 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -0700239 @Deprecated
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800240 static final int ITEM_TYPE_WIDGET_CLOCK = 1000;
241
242 /**
243 * The favorite is a search widget
244 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -0700245 @Deprecated
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800246 static final int ITEM_TYPE_WIDGET_SEARCH = 1001;
247
248 /**
249 * The favorite is a photo frame
250 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -0700251 @Deprecated
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800252 static final int ITEM_TYPE_WIDGET_PHOTO_FRAME = 1002;
253
254 /**
The Android Open Source Project7376fae2009-03-11 12:11:58 -0700255 * The appWidgetId of the widget
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800256 *
257 * <P>Type: INTEGER</P>
258 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -0700259 public static final String APPWIDGET_ID = "appWidgetId";
Chris Wrend5e66bf2013-09-16 14:02:29 -0400260
261 /**
262 * The ComponentName of the widget provider
263 *
264 * <P>Type: STRING</P>
265 */
266 public static final String APPWIDGET_PROVIDER = "appWidgetProvider";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800267
268 /**
269 * Indicates whether this favorite is an application-created shortcut or not.
270 * If the value is 0, the favorite is not an application-created shortcut, if the
271 * value is 1, it is an application-created shortcut.
272 * <P>Type: INTEGER</P>
273 */
Romain Guy73b979d2009-06-09 12:57:21 -0700274 @Deprecated
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800275 static final String IS_SHORTCUT = "isShortcut";
276
277 /**
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800278 * The URI associated with the favorite. It is used, for instance, by
279 * live folders to find the content provider.
280 * <P>Type: TEXT</P>
281 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -0700282 @Deprecated
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800283 static final String URI = "uri";
284
285 /**
286 * The display mode if the item is a live folder.
287 * <P>Type: INTEGER</P>
288 *
289 * @see android.provider.LiveFolders#DISPLAY_MODE_GRID
290 * @see android.provider.LiveFolders#DISPLAY_MODE_LIST
291 */
Sunny Goyal08f72612015-01-05 13:41:43 -0800292 @Deprecated
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800293 static final String DISPLAY_MODE = "displayMode";
Chris Wrenf4d08112014-01-16 18:13:56 -0500294
295 /**
296 * Boolean indicating that his item was restored and not yet successfully bound.
297 * <P>Type: INTEGER</P>
298 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -0700299 public static final String RESTORED = "restored";
Sunny Goyal08f72612015-01-05 13:41:43 -0800300
301 /**
302 * Indicates the position of the item inside an auto-arranged view like folder or hotseat.
303 * <p>Type: INTEGER</p>
304 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -0700305 public static final String RANK = "rank";
Sunny Goyal5d85c442015-03-10 13:14:47 -0700306
307 /**
308 * Stores general flag based options for {@link ItemInfo}s.
309 * <p>Type: INTEGER</p>
310 */
Sunny Goyal2fb2f0b2015-06-22 13:57:26 -0700311 public static final String OPTIONS = "options";
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800312 }
Sunny Goyal7779d622015-06-11 16:18:39 -0700313
314 /**
315 * Launcher settings
316 */
317 public static final class Settings {
318
319 public static final Uri CONTENT_URI = Uri.parse("content://" +
320 ProviderConfig.AUTHORITY + "/settings");
321
322 public static final String METHOD_GET_BOOLEAN = "get_boolean_setting";
323 public static final String METHOD_SET_BOOLEAN = "set_boolean_setting";
324
325 public static final String EXTRA_VALUE = "value";
326 public static final String EXTRA_DEFAULT_VALUE = "default_value";
327 }
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800328}