Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08680da4 authored by Mario Bertschler's avatar Mario Bertschler Committed by Android (Google) Code Review
Browse files

Merge "Integrating suggested app by handling new status flags for shortcut...

Merge "Integrating suggested app by handling new status flags for shortcut items." into ub-launcher3-dorval-polish2
parents 1affe9ef 8ff9e1d6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver {
    public void applyFromShortcutInfo(ShortcutInfo info, boolean promiseStateChanged) {
        applyIconAndLabel(info.iconBitmap, info);
        setTag(info);
        if (promiseStateChanged || info.isPromise()) {
        if (promiseStateChanged || (info.hasPromiseIconUi())) {
            applyPromiseState(promiseStateChanged);
        }

@@ -481,7 +481,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver {
    public void applyPromiseState(boolean promiseStateChanged) {
        if (getTag() instanceof ShortcutInfo) {
            ShortcutInfo info = (ShortcutInfo) getTag();
            final boolean isPromise = info.isPromise();
            final boolean isPromise = info.hasPromiseIconUi();
            final int progressLevel = isPromise ?
                    ((info.hasStatusFlag(ShortcutInfo.FLAG_INSTALL_SESSION_ACTIVE) ?
                            info.getInstallProgress() : 0)) : 100;
+6 −0
Original line number Diff line number Diff line
@@ -478,6 +478,12 @@ public class IconCache {
    }

    private void applyCacheEntry(CacheEntry entry, ItemInfoWithIcon info) {
        if (info instanceof ShortcutInfo
                && ((ShortcutInfo) info).hasStatusFlag(ShortcutInfo.FLAG_SUPPORTS_WEB_UI)
                && (entry.icon == null || isDefaultIcon(entry.icon, info.user))) {
            // skip updating shortcut info if no icon and supports web ui
            return;
        }
        info.title = Utilities.trim(entry.title);
        info.contentDescription = entry.contentDescription;
        info.iconBitmap = entry.icon == null ? getDefaultIcon(info.user) : entry.icon;
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ public class InfoDropTarget extends UninstallDropTarget {
        if (info instanceof AppInfo) {
            componentName = ((AppInfo) info).componentName;
        } else if (info instanceof ShortcutInfo) {
            componentName = ((ShortcutInfo) info).intent.getComponent();
            componentName = info.getTargetComponent();
        } else if (info instanceof PendingAddItemInfo) {
            componentName = ((PendingAddItemInfo) info).componentName;
        } else if (info instanceof LauncherAppWidgetInfo) {
+3 −9
Original line number Diff line number Diff line
@@ -138,17 +138,11 @@ public class ItemInfo {

    public ComponentName getTargetComponent() {
        Intent intent = getIntent();
        if (intent == null) {
        if (intent != null) {
            return intent.getComponent();
        } else {
            return null;
        }
        ComponentName cn = intent.getComponent();
        if (itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT && cn == null) {
            // Legacy shortcuts may not have a componentName but just a packageName. In that case
            // create a dummy componentName instead of adding additional check everywhere.
            String pkg = intent.getPackage();
            return pkg == null ? null : new ComponentName(pkg, IconCache.EMPTY_CLASS_NAME);
        }
        return cn;
    }

    public void writeToValues(ContentWriter writer) {
+3 −3
Original line number Diff line number Diff line
@@ -113,7 +113,6 @@ import com.android.launcher3.pageindicators.PageIndicator;
import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.popup.PopupDataProvider;
import com.android.launcher3.shortcuts.DeepShortcutManager;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
@@ -121,6 +120,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
import com.android.launcher3.util.ActivityResultInfo;
import com.android.launcher3.util.RunnableWithId;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.ComponentKeyMapper;
import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.util.MultiHashMap;
import com.android.launcher3.util.PackageManagerHelper;
@@ -2424,7 +2424,7 @@ public class Launcher extends BaseActivity
        }

        // Check for abandoned promise
        if ((v instanceof BubbleTextView) && shortcut.isPromise()) {
        if ((v instanceof BubbleTextView) && shortcut.hasPromiseIconUi()) {
            String packageName = shortcut.intent.getComponent() != null ?
                    shortcut.intent.getComponent().getPackageName() : shortcut.intent.getPackage();
            if (!TextUtils.isEmpty(packageName)) {
@@ -3068,7 +3068,7 @@ public class Launcher extends BaseActivity
     */
    public void tryAndUpdatePredictedApps() {
        if (mLauncherCallbacks != null) {
            List<ComponentKey> apps = mLauncherCallbacks.getPredictedApps();
            List<ComponentKeyMapper<AppInfo>> apps = mLauncherCallbacks.getPredictedApps();
            if (apps != null) {
                mAppsView.setPredictedApps(apps);
            }
Loading