diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 55bfef6cb0..7209d9dca9 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -408,6 +408,11 @@ public class Launcher extends BaseActivity if ((diff & (CONFIG_ORIENTATION | CONFIG_SCREEN_SIZE)) != 0) { mUserEventDispatcher = null; initDeviceProfile(mDeviceProfile.inv); + FileLog.d(TAG, "Config changed, my orientation=" + + getResources().getConfiguration().orientation + + ", new orientation=" + newConfig.orientation + + ", old orientation=" + mOldConfig.orientation + + ", isTransposed=" + mDeviceProfile.isVerticalBarLayout()); dispatchDeviceProfileChanged(); getRootView().dispatchInsets(); @@ -2752,18 +2757,20 @@ public class Launcher extends BaseActivity writer.println(prefix + " " + tag.toString()); } } - - try { - FileLog.flushAll(writer); - } catch (Exception e) { - // Ignore - } } writer.println(prefix + "Misc:"); writer.print(prefix + "\tmWorkspaceLoading=" + mWorkspaceLoading); writer.print(" mPendingRequestArgs=" + mPendingRequestArgs); writer.println(" mPendingActivityResult=" + mPendingActivityResult); + writer.println(" deviceProfile isTransposed=" + getDeviceProfile().isVerticalBarLayout()); + writer.println(" orientation=" + getResources().getConfiguration().orientation); + + try { + FileLog.flushAll(writer); + } catch (Exception e) { + // Ignore + } mModel.dumpState(prefix, fd, writer, args); diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java index 138ea0f650..053dc356eb 100644 --- a/src/com/android/launcher3/LauncherProvider.java +++ b/src/com/android/launcher3/LauncherProvider.java @@ -56,6 +56,7 @@ import com.android.launcher3.compat.UserManagerCompat; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.logging.FileLog; import com.android.launcher3.model.DbDowngradeHelper; +import com.android.launcher3.model.ModelWriter; import com.android.launcher3.provider.LauncherDbUtils; import com.android.launcher3.provider.LauncherDbUtils.SQLiteTransaction; import com.android.launcher3.provider.RestoreDbTask; @@ -320,6 +321,11 @@ public class LauncherProvider extends ContentProvider { @Override public int delete(Uri uri, String selection, String[] selectionArgs) { + if (ModelWriter.DEBUG_DELETE) { + String args = selectionArgs == null ? null : TextUtils.join(",", selectionArgs); + FileLog.d(TAG, "Delete uri=" + uri + ", selection=" + selection + + ", selectionArgs=" + args, new Exception()); + } createDbIfNotExists(); SqlArguments args = new SqlArguments(uri, selection, selectionArgs); diff --git a/src/com/android/launcher3/model/ModelWriter.java b/src/com/android/launcher3/model/ModelWriter.java index 032ed780d6..40e0f49a86 100644 --- a/src/com/android/launcher3/model/ModelWriter.java +++ b/src/com/android/launcher3/model/ModelWriter.java @@ -32,6 +32,7 @@ import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.LauncherSettings.Settings; import com.android.launcher3.ShortcutInfo; +import com.android.launcher3.logging.FileLog; import com.android.launcher3.util.ContentWriter; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.LooperExecutor; @@ -46,6 +47,7 @@ import java.util.concurrent.Executor; public class ModelWriter { private static final String TAG = "ModelWriter"; + public static final boolean DEBUG_DELETE = true; private final Context mContext; private final BgDataModel mBgDataModel; @@ -243,14 +245,21 @@ public class ModelWriter { * Removes the specified items from the database */ public void deleteItemsFromDatabase(final Iterable items) { - mWorkerExecutor.execute(new Runnable() { - public void run() { - for (ItemInfo item : items) { - final Uri uri = Favorites.getContentUri(item.id); - mContext.getContentResolver().delete(uri, null, null); + if (DEBUG_DELETE) { + // Log it on the colling thread to get the proper stack trace + FileLog.d(TAG, "Starting item deletion", new Exception()); + for (ItemInfo item : items) { + FileLog.d(TAG, "deleting item " + item); + } + FileLog.d(TAG, "Finished deleting items"); + } - mBgDataModel.removeItem(mContext, item); - } + mWorkerExecutor.execute(() -> { + for (ItemInfo item : items) { + final Uri uri = Favorites.getContentUri(item.id); + mContext.getContentResolver().delete(uri, null, null); + + mBgDataModel.removeItem(mContext, item); } }); } @@ -259,17 +268,20 @@ public class ModelWriter { * Remove the specified folder and all its contents from the database. */ public void deleteFolderAndContentsFromDatabase(final FolderInfo info) { - mWorkerExecutor.execute(new Runnable() { - public void run() { - ContentResolver cr = mContext.getContentResolver(); - cr.delete(LauncherSettings.Favorites.CONTENT_URI, - LauncherSettings.Favorites.CONTAINER + "=" + info.id, null); - mBgDataModel.removeItem(mContext, info.contents); - info.contents.clear(); + if (DEBUG_DELETE) { + // Log it on the colling thread to get the proper stack trace + FileLog.d(TAG, "Deleting folder " + info, new Exception()); + } - cr.delete(LauncherSettings.Favorites.getContentUri(info.id), null, null); - mBgDataModel.removeItem(mContext, info); - } + mWorkerExecutor.execute(() -> { + ContentResolver cr = mContext.getContentResolver(); + cr.delete(LauncherSettings.Favorites.CONTENT_URI, + LauncherSettings.Favorites.CONTAINER + "=" + info.id, null); + mBgDataModel.removeItem(mContext, info.contents); + info.contents.clear(); + + cr.delete(LauncherSettings.Favorites.getContentUri(info.id), null, null); + mBgDataModel.removeItem(mContext, info); }); }