mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
[DO NOT MERGE] resolve merge conflicts of cfdeb06205 to ub-launcher3-qt-future-dev
Bug: None Test: I solemnly swear I tested this conflict resolution. Change-Id: Id60ae2c08ec7aca6780fec1f873920f3857d598e
This commit is contained in:
@@ -22,6 +22,7 @@ import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
@@ -52,6 +53,10 @@ import com.android.launcher3.model.PackageUpdatedTask;
|
||||
import com.android.launcher3.model.ShortcutsChangedTask;
|
||||
import com.android.launcher3.model.UserLockStateChangedTask;
|
||||
import com.android.launcher3.shortcuts.DeepShortcutManager;
|
||||
import com.android.launcher3.util.ComponentKey;
|
||||
import com.android.launcher3.util.IntArray;
|
||||
import com.android.launcher3.util.IntSparseArrayMap;
|
||||
import com.android.launcher3.util.ItemInfoMatcher;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
import com.android.launcher3.util.Preconditions;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
@@ -170,6 +175,30 @@ public class LauncherModel extends BroadcastReceiver
|
||||
enqueueModelUpdateTask(new PackageUpdatedTask(op, user, packageName));
|
||||
}
|
||||
|
||||
public void onSessionFailure(String packageName, UserHandle user) {
|
||||
enqueueModelUpdateTask(new BaseModelUpdateTask() {
|
||||
@Override
|
||||
public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) {
|
||||
final IntSparseArrayMap<Boolean> removedIds = new IntSparseArrayMap<>();
|
||||
synchronized (dataModel) {
|
||||
for (ItemInfo info : dataModel.itemsIdMap) {
|
||||
if (info instanceof WorkspaceItemInfo
|
||||
&& ((WorkspaceItemInfo) info).hasPromiseIconUi()
|
||||
&& user.equals(info.user)
|
||||
&& info.getIntent() != null
|
||||
&& TextUtils.equals(packageName, info.getIntent().getPackage())) {
|
||||
removedIds.put(info.id, false /* unused value */);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!removedIds.isEmpty()) {
|
||||
deleteAndBindComponentsRemoved(ItemInfoMatcher.ofItemIds(removedIds, false));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPackageRemoved(String packageName, UserHandle user) {
|
||||
onPackagesRemoved(user, packageName);
|
||||
|
||||
@@ -140,6 +140,8 @@ public class PackageInstallerCompatVL extends PackageInstallerCompat {
|
||||
* - The settings for it are enabled
|
||||
* - The user installed the app
|
||||
* - There is an app icon and label (For apps with no launching activity, no icon is provided).
|
||||
* - The app is not already installed
|
||||
* - A promise icon for the session has not already been created
|
||||
*/
|
||||
private void tryQueuePromiseAppIcon(SessionInfo sessionInfo) {
|
||||
if (Utilities.ATLEAST_OREO && FeatureFlags.PROMISE_APPS_NEW_INSTALLS.get()
|
||||
@@ -148,7 +150,9 @@ public class PackageInstallerCompatVL extends PackageInstallerCompat {
|
||||
&& sessionInfo.getInstallReason() == PackageManager.INSTALL_REASON_USER
|
||||
&& sessionInfo.getAppIcon() != null
|
||||
&& !TextUtils.isEmpty(sessionInfo.getAppLabel())
|
||||
&& !mPromiseIconIds.contains(sessionInfo.getSessionId())) {
|
||||
&& !mPromiseIconIds.contains(sessionInfo.getSessionId())
|
||||
&& mLauncherApps.getApplicationInfo(sessionInfo.getAppPackageName(), 0,
|
||||
getUserHandle(sessionInfo)) == null) {
|
||||
SessionCommitReceiver.queuePromiseAppIconAddition(mAppContext, sessionInfo);
|
||||
mPromiseIconIds.add(sessionInfo.getSessionId());
|
||||
updatePromiseIconPrefs();
|
||||
@@ -183,12 +187,14 @@ public class PackageInstallerCompatVL extends PackageInstallerCompat {
|
||||
sendUpdate(PackageInstallInfo.fromState(success ? STATUS_INSTALLED : STATUS_FAILED,
|
||||
packageName, key.mUser));
|
||||
|
||||
if (!success && FeatureFlags.PROMISE_APPS_NEW_INSTALLS.get()) {
|
||||
if (!success && FeatureFlags.PROMISE_APPS_NEW_INSTALLS.get()
|
||||
&& mPromiseIconIds.contains(sessionId)) {
|
||||
LauncherAppState appState = LauncherAppState.getInstanceNoCreate();
|
||||
if (appState != null) {
|
||||
LauncherModel model = appState.getModel();
|
||||
model.onPackageRemoved(packageName, key.mUser);
|
||||
appState.getModel().onSessionFailure(packageName, key.mUser);
|
||||
}
|
||||
// If it is successful, the id is removed in the the package added flow.
|
||||
removePromiseIconId(sessionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user