Adding temporary logs to capture configuration changes and item deletions
Bug: 72481685
Bug: 73814840
Change-Id: I1e30632647ad08a08d84c49875bc7b6cac3be1fb
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 55bfef6..7209d9d 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -408,6 +408,11 @@
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 @@
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 138ea0f..053dc35 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -56,6 +56,7 @@
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 @@
@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 032ed78..40e0f49 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.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 @@
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 @@
* Removes the specified items from the database
*/
public void deleteItemsFromDatabase(final Iterable<? extends ItemInfo> 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 @@
* 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);
});
}