2009-03-03 19:32:27 -08:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2008 The Android Open Source Project
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
2013-06-05 22:57:57 -04:00
|
|
|
package com.android.launcher3;
|
2009-03-03 19:32:27 -08:00
|
|
|
|
2015-09-22 18:24:19 -07:00
|
|
|
import android.content.ContentResolver;
|
2016-05-05 14:37:05 -07:00
|
|
|
import android.database.sqlite.SQLiteDatabase;
|
2009-03-03 19:32:27 -08:00
|
|
|
import android.net.Uri;
|
2015-09-22 18:24:19 -07:00
|
|
|
import android.os.Bundle;
|
2011-04-27 16:56:57 -07:00
|
|
|
import android.provider.BaseColumns;
|
2009-03-03 19:32:27 -08:00
|
|
|
|
2020-04-06 15:11:17 -07:00
|
|
|
import com.android.launcher3.model.data.ItemInfo;
|
|
|
|
|
|
2009-03-03 19:32:27 -08:00
|
|
|
/**
|
|
|
|
|
* Settings related utilities.
|
|
|
|
|
*/
|
2015-04-08 19:01:34 -07:00
|
|
|
public class LauncherSettings {
|
2018-12-07 11:43:47 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Favorites.
|
|
|
|
|
*/
|
|
|
|
|
public static final class Favorites implements BaseColumns {
|
2013-09-13 18:01:38 -04:00
|
|
|
/**
|
|
|
|
|
* The time of the last update to this row.
|
|
|
|
|
* <P>Type: INTEGER</P>
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final String MODIFIED = "modified";
|
2013-09-13 18:01:38 -04:00
|
|
|
|
2009-06-09 12:57:21 -07:00
|
|
|
/**
|
|
|
|
|
* Descriptive name of the gesture that can be displayed to the user.
|
|
|
|
|
* <P>Type: TEXT</P>
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final String TITLE = "title";
|
2009-06-09 12:57:21 -07:00
|
|
|
|
2009-03-03 19:32:27 -08:00
|
|
|
/**
|
2009-06-09 12:57:21 -07:00
|
|
|
* The Intent URL of the gesture, describing what it points to. This
|
2009-06-23 17:34:54 -07:00
|
|
|
* value is given to {@link android.content.Intent#parseUri(String, int)} to create
|
2009-06-09 12:57:21 -07:00
|
|
|
* an Intent that can be launched.
|
|
|
|
|
* <P>Type: TEXT</P>
|
|
|
|
|
*/
|
2015-04-17 09:24:01 -07:00
|
|
|
public static final String INTENT = "intent";
|
2009-06-09 12:57:21 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The type of the gesture
|
|
|
|
|
*
|
|
|
|
|
* <P>Type: INTEGER</P>
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final String ITEM_TYPE = "itemType";
|
2009-06-09 12:57:21 -07:00
|
|
|
|
2019-09-06 11:25:08 -07:00
|
|
|
/**
|
|
|
|
|
* The gesture is a package
|
|
|
|
|
*/
|
|
|
|
|
public static final int ITEM_TYPE_NON_ACTIONABLE = -1;
|
2009-06-09 12:57:21 -07:00
|
|
|
/**
|
|
|
|
|
* The gesture is an application
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final int ITEM_TYPE_APPLICATION = 0;
|
2009-06-09 12:57:21 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The gesture is an application created shortcut
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final int ITEM_TYPE_SHORTCUT = 1;
|
2009-06-09 12:57:21 -07:00
|
|
|
|
2021-02-10 21:36:51 -08:00
|
|
|
/**
|
|
|
|
|
* The favorite is a user created folder
|
|
|
|
|
*/
|
|
|
|
|
public static final int ITEM_TYPE_FOLDER = 2;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The favorite is a widget
|
|
|
|
|
*/
|
|
|
|
|
public static final int ITEM_TYPE_APPWIDGET = 4;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The favorite is a custom widget provided by the launcher
|
|
|
|
|
*/
|
|
|
|
|
public static final int ITEM_TYPE_CUSTOM_APPWIDGET = 5;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The gesture is an application created deep shortcut
|
|
|
|
|
*/
|
|
|
|
|
public static final int ITEM_TYPE_DEEP_SHORTCUT = 6;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Type of the item is recents task.
|
|
|
|
|
* TODO(hyunyoungs): move constants not related to Favorites DB to a better location.
|
|
|
|
|
*/
|
|
|
|
|
public static final int ITEM_TYPE_TASK = 7;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The item is QSB
|
|
|
|
|
*/
|
|
|
|
|
public static final int ITEM_TYPE_QSB = 8;
|
|
|
|
|
|
2009-06-09 12:57:21 -07:00
|
|
|
/**
|
2016-04-21 14:30:18 -07:00
|
|
|
* The icon package name in Intent.ShortcutIconResource
|
2009-06-09 12:57:21 -07:00
|
|
|
* <P>Type: TEXT</P>
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final String ICON_PACKAGE = "iconPackage";
|
2009-06-09 12:57:21 -07:00
|
|
|
|
|
|
|
|
/**
|
2016-04-21 14:30:18 -07:00
|
|
|
* The icon resource name in Intent.ShortcutIconResource
|
2009-06-09 12:57:21 -07:00
|
|
|
* <P>Type: TEXT</P>
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final String ICON_RESOURCE = "iconResource";
|
2009-06-09 12:57:21 -07:00
|
|
|
|
|
|
|
|
/**
|
2016-04-21 14:30:18 -07:00
|
|
|
* The custom icon bitmap.
|
2009-06-09 12:57:21 -07:00
|
|
|
* <P>Type: BLOB</P>
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final String ICON = "icon";
|
2015-04-17 09:24:01 -07:00
|
|
|
|
|
|
|
|
public static final String TABLE_NAME = "favorites";
|
|
|
|
|
|
2018-10-29 14:02:20 -07:00
|
|
|
/**
|
Render user's actual workspace in ThemePicker preview (Part 3)
go/grid-migration-preview
With this change, we can see actual grid migration in wallpaper preview.
The approach here: we use a tmp table (favorites_preview) here specifically for this preview (to write off the migration results), and load from this tmp table workspace items if migration is necessary and successful. Otherwise, we load from the current workspace.
UPDATED: this change should be completely compatible with the new multi-db grid migration algorithm. Here is why
1. In LauncherPreviewRender#renderScreenShot, I added a check to decide which grid migration preview method we should call. Once v2 preview method is implemented, it should be integrated with other parts of this change perfectly (the reason will be mentioned below).
2. While we have multiple DBs, mOpenHelper in LauncherProvider always points to the current db we are using. Queries using CONTENT_URI is routed to whatever DB mOpenHelper points to, so it works perfectly to directly operate on CONTENT_URI even when we use multi-db underneath the hood.
3. With 1 and 2 mentioned, I believe in order for this preview change to support multi-db, we only need to implement the V2 grid migration algorithm. Because most of what we are doing in this change is wrapped in GridSizeMigrationTask, it's perfectly safeguarded.
Bug: 144052839
Change-Id: Ie6d6048d77326f96546c8a180a7cd8f15b47e4c4
2020-01-12 01:07:59 -08:00
|
|
|
* Backup table created when the favorites table is modified during grid migration
|
2018-10-29 14:02:20 -07:00
|
|
|
*/
|
|
|
|
|
public static final String BACKUP_TABLE_NAME = "favorites_bakup";
|
|
|
|
|
|
2020-05-29 14:47:42 -07:00
|
|
|
/**
|
|
|
|
|
* Backup table created when user hotseat is moved to workspace for hybrid hotseat
|
|
|
|
|
*/
|
|
|
|
|
public static final String HYBRID_HOTSEAT_BACKUP_TABLE = "hotseat_restore_backup";
|
|
|
|
|
|
2009-03-03 19:32:27 -08:00
|
|
|
/**
|
Render user's actual workspace in ThemePicker preview (Part 3)
go/grid-migration-preview
With this change, we can see actual grid migration in wallpaper preview.
The approach here: we use a tmp table (favorites_preview) here specifically for this preview (to write off the migration results), and load from this tmp table workspace items if migration is necessary and successful. Otherwise, we load from the current workspace.
UPDATED: this change should be completely compatible with the new multi-db grid migration algorithm. Here is why
1. In LauncherPreviewRender#renderScreenShot, I added a check to decide which grid migration preview method we should call. Once v2 preview method is implemented, it should be integrated with other parts of this change perfectly (the reason will be mentioned below).
2. While we have multiple DBs, mOpenHelper in LauncherProvider always points to the current db we are using. Queries using CONTENT_URI is routed to whatever DB mOpenHelper points to, so it works perfectly to directly operate on CONTENT_URI even when we use multi-db underneath the hood.
3. With 1 and 2 mentioned, I believe in order for this preview change to support multi-db, we only need to implement the V2 grid migration algorithm. Because most of what we are doing in this change is wrapped in GridSizeMigrationTask, it's perfectly safeguarded.
Bug: 144052839
Change-Id: Ie6d6048d77326f96546c8a180a7cd8f15b47e4c4
2020-01-12 01:07:59 -08:00
|
|
|
* Temporary table used specifically for grid migrations during wallpaper preview
|
2009-03-03 19:32:27 -08:00
|
|
|
*/
|
Render user's actual workspace in ThemePicker preview (Part 3)
go/grid-migration-preview
With this change, we can see actual grid migration in wallpaper preview.
The approach here: we use a tmp table (favorites_preview) here specifically for this preview (to write off the migration results), and load from this tmp table workspace items if migration is necessary and successful. Otherwise, we load from the current workspace.
UPDATED: this change should be completely compatible with the new multi-db grid migration algorithm. Here is why
1. In LauncherPreviewRender#renderScreenShot, I added a check to decide which grid migration preview method we should call. Once v2 preview method is implemented, it should be integrated with other parts of this change perfectly (the reason will be mentioned below).
2. While we have multiple DBs, mOpenHelper in LauncherProvider always points to the current db we are using. Queries using CONTENT_URI is routed to whatever DB mOpenHelper points to, so it works perfectly to directly operate on CONTENT_URI even when we use multi-db underneath the hood.
3. With 1 and 2 mentioned, I believe in order for this preview change to support multi-db, we only need to implement the V2 grid migration algorithm. Because most of what we are doing in this change is wrapped in GridSizeMigrationTask, it's perfectly safeguarded.
Bug: 144052839
Change-Id: Ie6d6048d77326f96546c8a180a7cd8f15b47e4c4
2020-01-12 01:07:59 -08:00
|
|
|
public static final String PREVIEW_TABLE_NAME = "favorites_preview";
|
|
|
|
|
|
2020-02-06 16:37:16 -08:00
|
|
|
/**
|
|
|
|
|
* Temporary table used specifically for multi-db grid migrations
|
|
|
|
|
*/
|
|
|
|
|
public static final String TMP_TABLE = "favorites_tmp";
|
|
|
|
|
|
Render user's actual workspace in ThemePicker preview (Part 3)
go/grid-migration-preview
With this change, we can see actual grid migration in wallpaper preview.
The approach here: we use a tmp table (favorites_preview) here specifically for this preview (to write off the migration results), and load from this tmp table workspace items if migration is necessary and successful. Otherwise, we load from the current workspace.
UPDATED: this change should be completely compatible with the new multi-db grid migration algorithm. Here is why
1. In LauncherPreviewRender#renderScreenShot, I added a check to decide which grid migration preview method we should call. Once v2 preview method is implemented, it should be integrated with other parts of this change perfectly (the reason will be mentioned below).
2. While we have multiple DBs, mOpenHelper in LauncherProvider always points to the current db we are using. Queries using CONTENT_URI is routed to whatever DB mOpenHelper points to, so it works perfectly to directly operate on CONTENT_URI even when we use multi-db underneath the hood.
3. With 1 and 2 mentioned, I believe in order for this preview change to support multi-db, we only need to implement the V2 grid migration algorithm. Because most of what we are doing in this change is wrapped in GridSizeMigrationTask, it's perfectly safeguarded.
Bug: 144052839
Change-Id: Ie6d6048d77326f96546c8a180a7cd8f15b47e4c4
2020-01-12 01:07:59 -08:00
|
|
|
/**
|
|
|
|
|
* The content:// style URL for "favorites" table
|
|
|
|
|
*/
|
|
|
|
|
public static final Uri CONTENT_URI = Uri.parse("content://"
|
|
|
|
|
+ LauncherProvider.AUTHORITY + "/" + TABLE_NAME);
|
|
|
|
|
|
2020-10-28 16:30:42 -07:00
|
|
|
/**
|
|
|
|
|
* The content:// style URL for "favorites_bakup" table
|
|
|
|
|
*/
|
|
|
|
|
public static final Uri BACKUP_CONTENT_URI = Uri.parse("content://"
|
|
|
|
|
+ LauncherProvider.AUTHORITY + "/" + BACKUP_TABLE_NAME);
|
|
|
|
|
|
Render user's actual workspace in ThemePicker preview (Part 3)
go/grid-migration-preview
With this change, we can see actual grid migration in wallpaper preview.
The approach here: we use a tmp table (favorites_preview) here specifically for this preview (to write off the migration results), and load from this tmp table workspace items if migration is necessary and successful. Otherwise, we load from the current workspace.
UPDATED: this change should be completely compatible with the new multi-db grid migration algorithm. Here is why
1. In LauncherPreviewRender#renderScreenShot, I added a check to decide which grid migration preview method we should call. Once v2 preview method is implemented, it should be integrated with other parts of this change perfectly (the reason will be mentioned below).
2. While we have multiple DBs, mOpenHelper in LauncherProvider always points to the current db we are using. Queries using CONTENT_URI is routed to whatever DB mOpenHelper points to, so it works perfectly to directly operate on CONTENT_URI even when we use multi-db underneath the hood.
3. With 1 and 2 mentioned, I believe in order for this preview change to support multi-db, we only need to implement the V2 grid migration algorithm. Because most of what we are doing in this change is wrapped in GridSizeMigrationTask, it's perfectly safeguarded.
Bug: 144052839
Change-Id: Ie6d6048d77326f96546c8a180a7cd8f15b47e4c4
2020-01-12 01:07:59 -08:00
|
|
|
/**
|
|
|
|
|
* The content:// style URL for "favorites_preview" table
|
|
|
|
|
*/
|
|
|
|
|
public static final Uri PREVIEW_CONTENT_URI = Uri.parse("content://"
|
|
|
|
|
+ LauncherProvider.AUTHORITY + "/" + PREVIEW_TABLE_NAME);
|
2009-03-03 19:32:27 -08:00
|
|
|
|
2020-02-06 16:37:16 -08:00
|
|
|
/**
|
|
|
|
|
* The content:// style URL for "favorites_tmp" table
|
|
|
|
|
*/
|
|
|
|
|
public static final Uri TMP_CONTENT_URI = Uri.parse("content://"
|
|
|
|
|
+ LauncherProvider.AUTHORITY + "/" + TMP_TABLE);
|
|
|
|
|
|
2009-03-03 19:32:27 -08:00
|
|
|
/**
|
2009-06-09 12:57:21 -07:00
|
|
|
* The content:// style URL for a given row, identified by its id.
|
|
|
|
|
*
|
|
|
|
|
* @param id The row id.
|
|
|
|
|
*
|
|
|
|
|
* @return The unique content URL for the specified row.
|
2009-03-03 19:32:27 -08:00
|
|
|
*/
|
2018-10-04 15:11:00 -07:00
|
|
|
public static Uri getContentUri(int id) {
|
Render user's actual workspace in ThemePicker preview (Part 3)
go/grid-migration-preview
With this change, we can see actual grid migration in wallpaper preview.
The approach here: we use a tmp table (favorites_preview) here specifically for this preview (to write off the migration results), and load from this tmp table workspace items if migration is necessary and successful. Otherwise, we load from the current workspace.
UPDATED: this change should be completely compatible with the new multi-db grid migration algorithm. Here is why
1. In LauncherPreviewRender#renderScreenShot, I added a check to decide which grid migration preview method we should call. Once v2 preview method is implemented, it should be integrated with other parts of this change perfectly (the reason will be mentioned below).
2. While we have multiple DBs, mOpenHelper in LauncherProvider always points to the current db we are using. Queries using CONTENT_URI is routed to whatever DB mOpenHelper points to, so it works perfectly to directly operate on CONTENT_URI even when we use multi-db underneath the hood.
3. With 1 and 2 mentioned, I believe in order for this preview change to support multi-db, we only need to implement the V2 grid migration algorithm. Because most of what we are doing in this change is wrapped in GridSizeMigrationTask, it's perfectly safeguarded.
Bug: 144052839
Change-Id: Ie6d6048d77326f96546c8a180a7cd8f15b47e4c4
2020-01-12 01:07:59 -08:00
|
|
|
return Uri.parse("content://" + LauncherProvider.AUTHORITY
|
|
|
|
|
+ "/" + TABLE_NAME + "/" + id);
|
2009-06-09 12:57:21 -07:00
|
|
|
}
|
2009-03-03 19:32:27 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The container holding the favorite
|
|
|
|
|
* <P>Type: INTEGER</P>
|
|
|
|
|
*/
|
2015-04-17 09:24:01 -07:00
|
|
|
public static final String CONTAINER = "container";
|
2009-03-03 19:32:27 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The icon is a resource identified by a package name and an integer id.
|
|
|
|
|
*/
|
2015-04-17 09:24:01 -07:00
|
|
|
public static final int CONTAINER_DESKTOP = -100;
|
|
|
|
|
public static final int CONTAINER_HOTSEAT = -101;
|
2019-08-09 16:16:06 -07:00
|
|
|
public static final int CONTAINER_PREDICTION = -102;
|
2021-03-02 21:26:00 +00:00
|
|
|
public static final int CONTAINER_WIDGETS_PREDICTION = -111;
|
2019-10-21 02:02:40 -07:00
|
|
|
public static final int CONTAINER_HOTSEAT_PREDICTION = -103;
|
2020-04-29 16:23:15 -07:00
|
|
|
public static final int CONTAINER_ALL_APPS = -104;
|
2020-05-06 22:19:43 -07:00
|
|
|
public static final int CONTAINER_WIDGETS_TRAY = -105;
|
2020-05-19 09:31:38 -07:00
|
|
|
// Represents search results view.
|
|
|
|
|
public static final int CONTAINER_SEARCH_RESULTS = -106;
|
2020-06-01 12:03:19 -07:00
|
|
|
public static final int CONTAINER_SHORTCUTS = -107;
|
2020-06-06 14:44:27 -07:00
|
|
|
public static final int CONTAINER_SETTINGS = -108;
|
2020-06-10 00:35:35 -07:00
|
|
|
public static final int CONTAINER_TASKSWITCHER = -109;
|
2021-02-10 21:36:51 -08:00
|
|
|
public static final int CONTAINER_QSB = -110;
|
2009-03-03 19:32:27 -08:00
|
|
|
|
2021-02-05 17:50:37 -08:00
|
|
|
// Represents any of the extended containers implemented in non-AOSP variants.
|
|
|
|
|
public static final int EXTENDED_CONTAINERS = -200;
|
|
|
|
|
|
2020-04-06 15:11:17 -07:00
|
|
|
public static final String containerToString(int container) {
|
2014-03-06 23:48:04 -05:00
|
|
|
switch (container) {
|
|
|
|
|
case CONTAINER_DESKTOP: return "desktop";
|
|
|
|
|
case CONTAINER_HOTSEAT: return "hotseat";
|
2019-08-09 16:16:06 -07:00
|
|
|
case CONTAINER_PREDICTION: return "prediction";
|
2020-05-06 22:19:43 -07:00
|
|
|
case CONTAINER_ALL_APPS: return "all_apps";
|
|
|
|
|
case CONTAINER_WIDGETS_TRAY: return "widgets_tray";
|
2020-05-19 09:31:38 -07:00
|
|
|
case CONTAINER_SEARCH_RESULTS: return "search_result";
|
2020-06-01 12:03:19 -07:00
|
|
|
case CONTAINER_SHORTCUTS: return "shortcuts";
|
2014-03-06 23:48:04 -05:00
|
|
|
default: return String.valueOf(container);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-06 15:11:17 -07:00
|
|
|
public static final String itemTypeToString(int type) {
|
2017-02-06 10:46:24 -08:00
|
|
|
switch(type) {
|
|
|
|
|
case ITEM_TYPE_APPLICATION: return "APP";
|
|
|
|
|
case ITEM_TYPE_SHORTCUT: return "SHORTCUT";
|
|
|
|
|
case ITEM_TYPE_FOLDER: return "FOLDER";
|
|
|
|
|
case ITEM_TYPE_APPWIDGET: return "WIDGET";
|
|
|
|
|
case ITEM_TYPE_CUSTOM_APPWIDGET: return "CUSTOMWIDGET";
|
|
|
|
|
case ITEM_TYPE_DEEP_SHORTCUT: return "DEEPSHORTCUT";
|
2021-02-10 21:36:51 -08:00
|
|
|
case ITEM_TYPE_TASK: return "TASK";
|
|
|
|
|
case ITEM_TYPE_QSB: return "QSB";
|
2017-02-06 10:46:24 -08:00
|
|
|
default: return String.valueOf(type);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-03 19:32:27 -08:00
|
|
|
/**
|
|
|
|
|
* The screen holding the favorite (if container is CONTAINER_DESKTOP)
|
|
|
|
|
* <P>Type: INTEGER</P>
|
|
|
|
|
*/
|
2015-04-17 09:24:01 -07:00
|
|
|
public static final String SCREEN = "screen";
|
2009-03-03 19:32:27 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The X coordinate of the cell holding the favorite
|
2011-07-26 21:07:43 -07:00
|
|
|
* (if container is CONTAINER_HOTSEAT or CONTAINER_HOTSEAT)
|
2009-03-03 19:32:27 -08:00
|
|
|
* <P>Type: INTEGER</P>
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final String CELLX = "cellX";
|
2009-03-03 19:32:27 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The Y coordinate of the cell holding the favorite
|
|
|
|
|
* (if container is CONTAINER_DESKTOP)
|
|
|
|
|
* <P>Type: INTEGER</P>
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final String CELLY = "cellY";
|
2009-03-03 19:32:27 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The X span of the cell holding the favorite
|
|
|
|
|
* <P>Type: INTEGER</P>
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final String SPANX = "spanX";
|
2009-03-03 19:32:27 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The Y span of the cell holding the favorite
|
|
|
|
|
* <P>Type: INTEGER</P>
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final String SPANY = "spanY";
|
2009-03-03 19:32:27 -08:00
|
|
|
|
2014-04-30 03:02:21 +01:00
|
|
|
/**
|
|
|
|
|
* The profile id of the item in the cell.
|
|
|
|
|
* <P>
|
|
|
|
|
* Type: INTEGER
|
|
|
|
|
* </P>
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final String PROFILE_ID = "profileId";
|
2014-04-30 03:02:21 +01:00
|
|
|
|
2009-03-03 19:32:27 -08:00
|
|
|
/**
|
2009-03-11 12:11:58 -07:00
|
|
|
* The appWidgetId of the widget
|
2009-03-03 19:32:27 -08:00
|
|
|
*
|
|
|
|
|
* <P>Type: INTEGER</P>
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final String APPWIDGET_ID = "appWidgetId";
|
2013-09-16 14:02:29 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The ComponentName of the widget provider
|
|
|
|
|
*
|
|
|
|
|
* <P>Type: STRING</P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String APPWIDGET_PROVIDER = "appWidgetProvider";
|
2014-01-16 18:13:56 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Boolean indicating that his item was restored and not yet successfully bound.
|
|
|
|
|
* <P>Type: INTEGER</P>
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final String RESTORED = "restored";
|
2015-01-05 13:41:43 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates the position of the item inside an auto-arranged view like folder or hotseat.
|
|
|
|
|
* <p>Type: INTEGER</p>
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final String RANK = "rank";
|
2015-03-10 13:14:47 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Stores general flag based options for {@link ItemInfo}s.
|
|
|
|
|
* <p>Type: INTEGER</p>
|
|
|
|
|
*/
|
2015-06-22 13:57:26 -07:00
|
|
|
public static final String OPTIONS = "options";
|
2016-05-05 14:37:05 -07:00
|
|
|
|
|
|
|
|
public static void addTableToDb(SQLiteDatabase db, long myProfileId, boolean optional) {
|
2018-10-29 14:02:20 -07:00
|
|
|
addTableToDb(db, myProfileId, optional, TABLE_NAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void addTableToDb(SQLiteDatabase db, long myProfileId, boolean optional,
|
|
|
|
|
String tableName) {
|
2016-05-05 14:37:05 -07:00
|
|
|
String ifNotExists = optional ? " IF NOT EXISTS " : "";
|
2018-10-29 14:02:20 -07:00
|
|
|
db.execSQL("CREATE TABLE " + ifNotExists + tableName + " (" +
|
2016-05-05 14:37:05 -07:00
|
|
|
"_id INTEGER PRIMARY KEY," +
|
|
|
|
|
"title TEXT," +
|
|
|
|
|
"intent TEXT," +
|
|
|
|
|
"container INTEGER," +
|
|
|
|
|
"screen INTEGER," +
|
|
|
|
|
"cellX INTEGER," +
|
|
|
|
|
"cellY INTEGER," +
|
|
|
|
|
"spanX INTEGER," +
|
|
|
|
|
"spanY INTEGER," +
|
|
|
|
|
"itemType INTEGER," +
|
|
|
|
|
"appWidgetId INTEGER NOT NULL DEFAULT -1," +
|
|
|
|
|
"iconPackage TEXT," +
|
|
|
|
|
"iconResource TEXT," +
|
|
|
|
|
"icon BLOB," +
|
|
|
|
|
"appWidgetProvider TEXT," +
|
|
|
|
|
"modified INTEGER NOT NULL DEFAULT 0," +
|
|
|
|
|
"restored INTEGER NOT NULL DEFAULT 0," +
|
|
|
|
|
"profileId INTEGER DEFAULT " + myProfileId + "," +
|
|
|
|
|
"rank INTEGER NOT NULL DEFAULT 0," +
|
|
|
|
|
"options INTEGER NOT NULL DEFAULT 0" +
|
|
|
|
|
");");
|
|
|
|
|
}
|
2009-03-03 19:32:27 -08:00
|
|
|
}
|
2015-06-11 16:18:39 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Launcher settings
|
|
|
|
|
*/
|
|
|
|
|
public static final class Settings {
|
|
|
|
|
|
|
|
|
|
public static final Uri CONTENT_URI = Uri.parse("content://" +
|
2017-03-06 16:56:39 -08:00
|
|
|
LauncherProvider.AUTHORITY + "/settings");
|
2015-06-11 16:18:39 -07:00
|
|
|
|
2015-09-22 18:24:19 -07:00
|
|
|
public static final String METHOD_CLEAR_EMPTY_DB_FLAG = "clear_empty_db_flag";
|
2016-07-08 08:32:44 -07:00
|
|
|
public static final String METHOD_WAS_EMPTY_DB_CREATED = "get_empty_db_flag";
|
2015-09-22 18:24:19 -07:00
|
|
|
|
|
|
|
|
public static final String METHOD_DELETE_EMPTY_FOLDERS = "delete_empty_folders";
|
|
|
|
|
|
|
|
|
|
public static final String METHOD_NEW_ITEM_ID = "generate_new_item_id";
|
|
|
|
|
public static final String METHOD_NEW_SCREEN_ID = "generate_new_screen_id";
|
|
|
|
|
|
|
|
|
|
public static final String METHOD_CREATE_EMPTY_DB = "create_empty_db";
|
|
|
|
|
|
|
|
|
|
public static final String METHOD_LOAD_DEFAULT_FAVORITES = "load_default_favorites";
|
2015-06-11 16:18:39 -07:00
|
|
|
|
2017-04-06 15:02:52 -07:00
|
|
|
public static final String METHOD_REMOVE_GHOST_WIDGETS = "remove_ghost_widgets";
|
|
|
|
|
|
2018-10-29 14:02:20 -07:00
|
|
|
public static final String METHOD_NEW_TRANSACTION = "new_db_transaction";
|
|
|
|
|
|
|
|
|
|
public static final String METHOD_REFRESH_BACKUP_TABLE = "refresh_backup_table";
|
|
|
|
|
|
2020-05-29 14:47:42 -07:00
|
|
|
public static final String METHOD_REFRESH_HOTSEAT_RESTORE_TABLE = "restore_hotseat_table";
|
|
|
|
|
|
2019-09-24 14:25:46 -07:00
|
|
|
public static final String METHOD_RESTORE_BACKUP_TABLE = "restore_backup_table";
|
|
|
|
|
|
2020-01-27 13:44:06 -08:00
|
|
|
public static final String METHOD_UPDATE_CURRENT_OPEN_HELPER = "update_current_open_helper";
|
|
|
|
|
|
2020-03-17 18:28:38 -07:00
|
|
|
public static final String METHOD_PREP_FOR_PREVIEW = "prep_for_preview";
|
|
|
|
|
|
2020-07-20 11:03:39 -07:00
|
|
|
public static final String METHOD_SWITCH_DATABASE = "switch_database";
|
|
|
|
|
|
2015-06-11 16:18:39 -07:00
|
|
|
public static final String EXTRA_VALUE = "value";
|
2015-09-22 18:24:19 -07:00
|
|
|
|
2020-10-14 11:17:04 -07:00
|
|
|
public static final String EXTRA_DB_NAME = "db_name";
|
|
|
|
|
|
2015-09-22 18:24:19 -07:00
|
|
|
public static Bundle call(ContentResolver cr, String method) {
|
2020-07-20 11:03:39 -07:00
|
|
|
return call(cr, method, null /* arg */);
|
2020-03-17 18:28:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Bundle call(ContentResolver cr, String method, String arg) {
|
2020-07-20 11:03:39 -07:00
|
|
|
return call(cr, method, arg, null /* extras */);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Bundle call(ContentResolver cr, String method, String arg, Bundle extras) {
|
|
|
|
|
return cr.call(CONTENT_URI, method, arg, extras);
|
2015-09-22 18:24:19 -07:00
|
|
|
}
|
2015-06-11 16:18:39 -07:00
|
|
|
}
|
2009-03-03 19:32:27 -08:00
|
|
|
}
|