Snap for 7037824 from a15b5a6760 to sc-release
Change-Id: I63a1a89f20c84782a272f29a83b760751384ef1b
This commit is contained in:
commit
c98f40ae2e
6 files changed
+45
-24
No files matched your search
@@ -52,8 +52,7 @@ public class HotseatPredictionModel {
|
||||
public static Bundle convertDataModelToAppTargetBundle(Context context, BgDataModel dataModel) {
|
||||
Bundle bundle = new Bundle();
|
||||
ArrayList<AppTargetEvent> events = new ArrayList<>();
|
||||
ArrayList<ItemInfo> workspaceItems = new ArrayList<>(dataModel.workspaceItems);
|
||||
workspaceItems.addAll(dataModel.appWidgets);
|
||||
ArrayList<ItemInfo> workspaceItems = dataModel.getAllWorkspaceItems();
|
||||
for (ItemInfo item : workspaceItems) {
|
||||
AppTarget target = getAppTargetFromInfo(context, item);
|
||||
if (target != null && !isTrackedForPrediction(item)) continue;
|
||||
|
||||
@@ -294,8 +294,12 @@ public class FallbackSwipeHandler extends
|
||||
if (mSurfaceControl != null) {
|
||||
currentRect.roundOut(mTempRect);
|
||||
Transaction t = new Transaction();
|
||||
t.setGeometry(mSurfaceControl, null, mTempRect, Surface.ROTATION_0);
|
||||
t.apply();
|
||||
try {
|
||||
t.setGeometry(mSurfaceControl, null, mTempRect, Surface.ROTATION_0);
|
||||
t.apply();
|
||||
} catch (RuntimeException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1099,11 +1099,20 @@ public class LauncherProvider extends ContentProvider {
|
||||
* @return the max _id in the provided table.
|
||||
*/
|
||||
@Thunk static int getMaxId(SQLiteDatabase db, String query, Object... args) {
|
||||
int max = (int) DatabaseUtils.longForQuery(db,
|
||||
String.format(Locale.ENGLISH, query, args),
|
||||
null);
|
||||
if (max < 0) {
|
||||
throw new RuntimeException("Error: could not query max id");
|
||||
int max = 0;
|
||||
try (SQLiteStatement prog = db.compileStatement(
|
||||
String.format(Locale.ENGLISH, query, args))) {
|
||||
max = (int) DatabaseUtils.longForQuery(prog, null);
|
||||
if (max < 0) {
|
||||
throw new RuntimeException("Error: could not query max id");
|
||||
}
|
||||
} catch (IllegalArgumentException exception) {
|
||||
String message = exception.getMessage();
|
||||
if (message.contains("re-open") && message.contains("already-closed")) {
|
||||
// Don't crash trying to end a transaction an an already closed DB. See b/173162852.
|
||||
} else {
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
@@ -629,11 +629,13 @@ public class LauncherPreviewRenderer extends ContextThemeWrapper
|
||||
private WorkspaceResult(BgDataModel dataModel,
|
||||
WidgetsModel widgetsModel,
|
||||
Map<ComponentKey, AppWidgetProviderInfo> widgetProviderInfoMap) {
|
||||
mWorkspaceItems = dataModel.workspaceItems;
|
||||
mAppWidgets = dataModel.appWidgets;
|
||||
mHotseatPredictions = dataModel.extraItems.get(CONTAINER_HOTSEAT_PREDICTION);
|
||||
mWidgetsModel = widgetsModel;
|
||||
mWidgetProvidersMap = widgetProviderInfoMap;
|
||||
synchronized (dataModel) {
|
||||
mWorkspaceItems = dataModel.workspaceItems;
|
||||
mAppWidgets = dataModel.appWidgets;
|
||||
mHotseatPredictions = dataModel.extraItems.get(CONTAINER_HOTSEAT_PREDICTION);
|
||||
mWidgetsModel = widgetsModel;
|
||||
mWidgetProvidersMap = widgetProviderInfoMap;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -375,6 +375,16 @@ public class BgDataModel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list containing all workspace items including widgets.
|
||||
*/
|
||||
public synchronized ArrayList<ItemInfo> getAllWorkspaceItems() {
|
||||
ArrayList<ItemInfo> items = new ArrayList<>(workspaceItems.size() + appWidgets.size());
|
||||
items.addAll(workspaceItems);
|
||||
items.addAll(appWidgets);
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the provided {@code op} for all workspaceItems in the in-memory model (both persisted
|
||||
* items and dynamic/predicted items for the provided {@code userHandle}.
|
||||
|
||||
@@ -166,12 +166,7 @@ public class LoaderTask implements Runnable {
|
||||
|
||||
private void sendFirstScreenActiveInstallsBroadcast() {
|
||||
ArrayList<ItemInfo> firstScreenItems = new ArrayList<>();
|
||||
|
||||
ArrayList<ItemInfo> allItems = new ArrayList<>();
|
||||
synchronized (mBgDataModel) {
|
||||
allItems.addAll(mBgDataModel.workspaceItems);
|
||||
allItems.addAll(mBgDataModel.appWidgets);
|
||||
}
|
||||
ArrayList<ItemInfo> allItems = mBgDataModel.getAllWorkspaceItems();
|
||||
// Screen set is never empty
|
||||
final int firstScreen = mBgDataModel.collectWorkspaceScreens().get(0);
|
||||
|
||||
@@ -858,10 +853,12 @@ public class LoaderTask implements Runnable {
|
||||
.call(contentResolver,
|
||||
LauncherSettings.Settings.METHOD_DELETE_EMPTY_FOLDERS)
|
||||
.getIntArray(LauncherSettings.Settings.EXTRA_VALUE);
|
||||
for (int folderId : deletedFolderIds) {
|
||||
mBgDataModel.workspaceItems.remove(mBgDataModel.folders.get(folderId));
|
||||
mBgDataModel.folders.remove(folderId);
|
||||
mBgDataModel.itemsIdMap.remove(folderId);
|
||||
synchronized (mBgDataModel) {
|
||||
for (int folderId : deletedFolderIds) {
|
||||
mBgDataModel.workspaceItems.remove(mBgDataModel.folders.get(folderId));
|
||||
mBgDataModel.folders.remove(folderId);
|
||||
mBgDataModel.itemsIdMap.remove(folderId);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any ghost widgets
|
||||
|
||||
Reference in new issue
Block a user