Sanity check screenId before persisting ItemInfo.
Bug: 13447571 Change-Id: I014dcf1eb313c2312953716fb53e542caaeb285b
This commit is contained in:
@@ -132,7 +132,7 @@ public class ItemInfo {
|
||||
*
|
||||
* @param values
|
||||
*/
|
||||
void onAddToDatabase(ContentValues values) {
|
||||
void onAddToDatabase(ContentValues values) {
|
||||
values.put(LauncherSettings.BaseLauncherColumns.ITEM_TYPE, itemType);
|
||||
values.put(LauncherSettings.Favorites.CONTAINER, container);
|
||||
values.put(LauncherSettings.Favorites.SCREEN, screenId);
|
||||
@@ -140,6 +140,11 @@ public class ItemInfo {
|
||||
values.put(LauncherSettings.Favorites.CELLY, cellY);
|
||||
values.put(LauncherSettings.Favorites.SPANX, spanX);
|
||||
values.put(LauncherSettings.Favorites.SPANY, spanY);
|
||||
|
||||
if (screenId == Workspace.EXTRA_EMPTY_SCREEN_ID) {
|
||||
// We should never persist an item on the extra empty screen.
|
||||
throw new RuntimeException("Screen id should not be EXTRA_EMPTY_SCREEN_ID");
|
||||
}
|
||||
}
|
||||
|
||||
void updateValuesWithCoordinates(ContentValues values, int cellX, int cellY) {
|
||||
|
||||
@@ -126,7 +126,7 @@ public class Workspace extends SmoothPagedView
|
||||
private static boolean sAccessibilityEnabled;
|
||||
|
||||
// The screen id used for the empty screen always present to the right.
|
||||
private final static long EXTRA_EMPTY_SCREEN_ID = -201;
|
||||
final static long EXTRA_EMPTY_SCREEN_ID = -201;
|
||||
private final static long CUSTOM_CONTENT_SCREEN_ID = -301;
|
||||
|
||||
private HashMap<Long, CellLayout> mWorkspaceScreens = new HashMap<Long, CellLayout>();
|
||||
|
||||
Reference in New Issue
Block a user