mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
Merge "Add Logs to track app uninstall and icon removal" into ub-launcher3-qt-future-dev
This commit is contained in:
@@ -39,6 +39,7 @@ import com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo;
|
||||
import com.android.launcher3.compat.UserManagerCompat;
|
||||
import com.android.launcher3.icons.IconCache;
|
||||
import com.android.launcher3.icons.LauncherIcons;
|
||||
import com.android.launcher3.logging.FileLog;
|
||||
import com.android.launcher3.model.AddWorkspaceItemsTask;
|
||||
import com.android.launcher3.model.AllAppsList;
|
||||
import com.android.launcher3.model.BaseModelUpdateTask;
|
||||
@@ -206,6 +207,7 @@ public class LauncherModel extends BroadcastReceiver
|
||||
|
||||
public void onPackagesRemoved(UserHandle user, String... packages) {
|
||||
int op = PackageUpdatedTask.OP_REMOVE;
|
||||
FileLog.d(TAG, "package removed received " + String.join("," + packages));
|
||||
enqueueModelUpdateTask(new PackageUpdatedTask(op, user, packages));
|
||||
}
|
||||
|
||||
@@ -261,7 +263,6 @@ public class LauncherModel extends BroadcastReceiver
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (DEBUG_RECEIVER) Log.d(TAG, "onReceive intent=" + intent);
|
||||
|
||||
final String action = intent.getAction();
|
||||
if (Intent.ACTION_LOCALE_CHANGED.equals(action)) {
|
||||
// If we have changed locale we need to clear out the labels in all apps/workspace.
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.android.launcher3;
|
||||
|
||||
import static android.appwidget.AppWidgetManager.INVALID_APPWIDGET_ID;
|
||||
import static android.appwidget.AppWidgetProviderInfo.WIDGET_FEATURE_RECONFIGURABLE;
|
||||
|
||||
import static com.android.launcher3.ItemInfoWithIcon.FLAG_SYSTEM_MASK;
|
||||
import static com.android.launcher3.ItemInfoWithIcon.FLAG_SYSTEM_NO;
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP;
|
||||
@@ -29,6 +30,7 @@ import android.widget.Toast;
|
||||
import com.android.launcher3.Launcher.OnResumeCallback;
|
||||
import com.android.launcher3.compat.LauncherAppsCompat;
|
||||
import com.android.launcher3.dragndrop.DragOptions;
|
||||
import com.android.launcher3.logging.FileLog;
|
||||
import com.android.launcher3.logging.LoggerUtils;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
||||
@@ -240,6 +242,7 @@ public class SecondaryDropTarget extends ButtonDropTarget implements OnAlarmList
|
||||
.setData(Uri.fromParts("package", cn.getPackageName(), cn.getClassName()))
|
||||
.putExtra(Intent.EXTRA_USER, info.user);
|
||||
mLauncher.startActivity(i);
|
||||
FileLog.d(TAG, "start uninstall activity " + cn.getPackageName());
|
||||
return cn;
|
||||
} catch (URISyntaxException e) {
|
||||
Log.e(TAG, "Failed to parse intent to start uninstall activity for item=" + info);
|
||||
|
||||
@@ -40,15 +40,18 @@ import com.android.launcher3.LauncherSettings.Settings;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.WorkspaceItemInfo;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.logging.FileLog;
|
||||
import com.android.launcher3.model.BgDataModel.Callbacks;
|
||||
import com.android.launcher3.util.ContentWriter;
|
||||
import com.android.launcher3.util.ItemInfoMatcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Class for handling model updates.
|
||||
@@ -262,9 +265,12 @@ public class ModelWriter {
|
||||
/**
|
||||
* Removes the specified items from the database
|
||||
*/
|
||||
public void deleteItemsFromDatabase(final Iterable<? extends ItemInfo> items) {
|
||||
public void deleteItemsFromDatabase(final Collection<? extends ItemInfo> items) {
|
||||
ModelVerifier verifier = new ModelVerifier();
|
||||
|
||||
FileLog.d(TAG, "removing items from db " + items.stream().map(
|
||||
(item) -> item.getTargetComponent() == null ? ""
|
||||
: item.getTargetComponent().getPackageName()).collect(
|
||||
Collectors.joining(",")), new Exception());
|
||||
enqueueDeleteRunnable(() -> {
|
||||
for (ItemInfo item : items) {
|
||||
final Uri uri = Favorites.getContentUri(item.id);
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.android.launcher3.model;
|
||||
|
||||
import static com.android.launcher3.WorkspaceItemInfo.FLAG_AUTOINSTALL_ICON;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -53,8 +55,6 @@ import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import static com.android.launcher3.WorkspaceItemInfo.FLAG_AUTOINSTALL_ICON;
|
||||
|
||||
/**
|
||||
* Handles updates due to changes in package manager (app installed/updated/removed)
|
||||
* or when a user availability changes.
|
||||
@@ -132,6 +132,7 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
|
||||
break;
|
||||
case OP_REMOVE: {
|
||||
for (int i = 0; i < N; i++) {
|
||||
FileLog.d(TAG, "Removing app icon" + packages[i]);
|
||||
iconCache.removeIconsForPkg(packages[i], mUser);
|
||||
}
|
||||
// Fall through
|
||||
|
||||
Reference in New Issue
Block a user