mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 00:36:49 +00:00
Removing static instance of LauncherAppsCompat and unnecessary wrapper classes
Bug: 141376165 Change-Id: I8c1f1ab7d83ec50fe9c7bf39960ef9c360025ec7
This commit is contained in:
@@ -16,10 +16,12 @@
|
||||
package com.android.launcher3.model;
|
||||
|
||||
import static com.android.launcher3.WorkspaceItemInfo.FLAG_AUTOINSTALL_ICON;
|
||||
import static com.android.launcher3.WorkspaceItemInfo.FLAG_RESTORED_ICON;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
@@ -33,7 +35,6 @@ import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.SessionCommitReceiver;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.WorkspaceItemInfo;
|
||||
import com.android.launcher3.compat.LauncherAppsCompat;
|
||||
import com.android.launcher3.compat.UserManagerCompat;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.icons.BitmapInfo;
|
||||
@@ -55,9 +56,6 @@ import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import static com.android.launcher3.WorkspaceItemInfo.FLAG_AUTOINSTALL_ICON;
|
||||
import static com.android.launcher3.WorkspaceItemInfo.FLAG_RESTORED_ICON;
|
||||
|
||||
/**
|
||||
* Handles updates due to changes in package manager (app installed/updated/removed)
|
||||
* or when a user availability changes.
|
||||
@@ -221,8 +219,8 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
|
||||
infoUpdated = true;
|
||||
}
|
||||
} else if (!cn.getClassName().equals(IconCache.EMPTY_CLASS_NAME)) {
|
||||
isTargetValid = LauncherAppsCompat.getInstance(context)
|
||||
.isActivityEnabledForProfile(cn, mUser);
|
||||
isTargetValid = context.getSystemService(LauncherApps.class)
|
||||
.isActivityEnabled(cn, mUser);
|
||||
}
|
||||
if (si.hasStatusFlag(FLAG_RESTORED_ICON | FLAG_AUTOINSTALL_ICON)) {
|
||||
if (updateWorkspaceItemIntent(context, si, packageName)) {
|
||||
@@ -305,9 +303,9 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
|
||||
// removedPackages is a super-set of removedComponents
|
||||
} else if (mOp == OP_UPDATE) {
|
||||
// Mark disabled packages in the broadcast to be removed
|
||||
final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(context);
|
||||
final LauncherApps launcherApps = context.getSystemService(LauncherApps.class);
|
||||
for (int i=0; i<N; i++) {
|
||||
if (!launcherApps.isPackageEnabledForProfile(packages[i], mUser)) {
|
||||
if (!launcherApps.isPackageEnabled(packages[i], mUser)) {
|
||||
removedPackages.add(packages[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user