Fixed app shortcut widget

- closes : #5101
- closes : #5056
- closes : #5055
This commit is contained in:
MrSluffy
2024-12-26 10:48:38 +08:00
parent eb6e45d7ca
commit c41eb8ac8f
7 changed files with 26 additions and 28 deletions

View File

@@ -1,5 +1,7 @@
package com.android.launcher3;
// TODO(b/303773055): Remove the annotation after access issue is resolved.
import androidx.core.os.BuildCompat;
import com.android.quickstep.util.DeviceConfigHelper;
import java.nio.file.Files;
@@ -109,7 +111,7 @@ public final class FeatureFlagsImpl implements FeatureFlags {
enableSmartspaceRemovalToggle =
properties.getBoolean(Flags.FLAG_ENABLE_SMARTSPACE_REMOVAL_TOGGLE, true);
enableSupportForArchiving =
properties.getBoolean(Flags.FLAG_ENABLE_SUPPORT_FOR_ARCHIVING, true);
properties.getBoolean(Flags.FLAG_ENABLE_SUPPORT_FOR_ARCHIVING, BuildCompat.isAtLeastU());
enableTabletTwoPanePickerV2 =
properties.getBoolean(Flags.FLAG_ENABLE_TABLET_TWO_PANE_PICKER_V2, false);
enableTaskbarCustomization =

View File

@@ -162,7 +162,7 @@ class LawnchairIconProvider @JvmOverloads constructor(
var defaultIcon =
super.getIconWithOverrides(packageName, component, user, iconDpi, fallback)
if ((context.shouldTintIconPackBackgrounds() && defaultIcon is AdaptiveIconDrawable) || (context.isThemedIconsEnabled() && defaultIcon is AdaptiveIconDrawable)) {
if ((context.shouldTintIconPackBackgrounds() && defaultIcon is AdaptiveIconDrawable)) {
if (Utilities.ATLEAST_T && defaultIcon.monochrome != null) {
defaultIcon = defaultIcon.monochrome
return if (td != null) {

View File

@@ -283,6 +283,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import app.lawnchair.LawnchairApp;
@@ -2326,7 +2327,7 @@ public class Launcher extends StatefulActivity<LauncherState>
@Override
public void bindItems(final List<ItemInfo> items, final boolean forceAnimateIcons) {
bindInflatedItems(items.stream().map(i -> Pair.create(
i, getItemInflater().inflateItem(i, getModelWriter()))).toList(),
i, getItemInflater().inflateItem(i, getModelWriter()))).collect(Collectors.toList()),
forceAnimateIcons ? new AnimatorSet() : null);
}

View File

@@ -137,6 +137,10 @@ public interface WorkspaceLayoutManager {
// Get the canonical child id to uniquely represent this view in this screen
ItemInfo info = (ItemInfo) child.getTag();
if (info == null) {
Log.e(TAG, "Attempted to add null item to workspace");
return;
}
int childId = info.getViewId();
boolean markCellsAsOccupied = !(child instanceof Folder);

View File

@@ -96,7 +96,7 @@ public class AddItemActivity extends BaseActivity
private static final int SHADOW_SIZE = 10;
private static final int REQUEST_BIND_APPWIDGET = 1;
private static final int REQUEST_BIND_APPWIDGET = 11;
private static final String STATE_EXTRA_WIDGET_ID = "state.widget.id";
private final PointF mLastTouchPos = new PointF();

View File

@@ -731,24 +731,20 @@ public class LoaderTask implements Runnable {
LauncherActivityInfo app = apps.get(i);
AppInfo appInfo = new AppInfo(app, mUserCache.getUserInfo(user),
ApiWrapper.INSTANCE.get(mApp.getContext()), mPmHelper, quietMode);
boolean isArchived;
try {
isArchived = app.getApplicationInfo().isArchived;
} catch (NoSuchFieldError e) {
isArchived = false;
}
if (Flags.enableSupportForArchiving() && isArchived) {
// For archived apps, include progress info in case there is a pending
// install session post restart of device.
String appPackageName = app.getApplicationInfo().packageName;
SessionInfo si = mInstallingPkgsCached != null ? mInstallingPkgsCached.get(
new PackageUserKey(appPackageName, user))
: mSessionHelper.getActiveSessionInfo(user,
appPackageName);
if (si != null) {
appInfo.runtimeStatusFlags |= FLAG_INSTALL_SESSION_ACTIVE;
appInfo.setProgressLevel((int) (si.getProgress() * 100),
PackageInstallInfo.STATUS_INSTALLING);
if (Flags.enableSupportForArchiving()) {
if (app.getApplicationInfo().isArchived) {
// For archived apps, include progress info in case there is a pending
// install session post restart of device.
String appPackageName = app.getApplicationInfo().packageName;
SessionInfo si = mInstallingPkgsCached != null ? mInstallingPkgsCached.get(
new PackageUserKey(appPackageName, user))
: mSessionHelper.getActiveSessionInfo(user,
appPackageName);
if (si != null) {
appInfo.runtimeStatusFlags |= FLAG_INSTALL_SESSION_ACTIVE;
appInfo.setProgressLevel((int) (si.getProgress() * 100),
PackageInstallInfo.STATUS_INSTALLING);
}
}
}

View File

@@ -340,16 +340,11 @@ class WorkspaceItemProcessor(
pmHelper
)
}
val isArchived = try {
activityInfo.applicationInfo.isArchived
} catch (_: NoSuchFieldError) {
false
}
if (
(c.restoreFlag != 0 ||
Flags.enableSupportForArchiving() &&
activityInfo != null &&
isArchived) && !TextUtils.isEmpty(targetPkg)
activityInfo.applicationInfo.isArchived) && !TextUtils.isEmpty(targetPkg)
) {
tempPackageKey.update(targetPkg, c.user)
val si = installingPkgs[tempPackageKey]