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

Commit 56f9df06 authored by Gustav Sennton's avatar Gustav Sennton Committed by Android (Google) Code Review
Browse files

Merge "[Desktop Mode] Show indicators under Taskbar app icons for running apps" into main

parents 1b21277b 52a8b7e2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
    <color name="taskbar_nav_icon_dark_color_on_home">#99000000</color>
    <color name="taskbar_stashed_handle_light_color">#EBffffff</color>
    <color name="taskbar_stashed_handle_dark_color">#99000000</color>
    <color name="taskbar_running_app_indicator_color">#646464</color>

    <!-- Floating rotation button -->
    <color name="floating_rotation_button_light_color">#ffffff</color>
+3 −0
Original line number Diff line number Diff line
@@ -353,6 +353,9 @@
    <dimen name="taskbar_back_button_suw_start_margin">48dp</dimen>
    <dimen name="taskbar_back_button_suw_bottom_margin">1dp</dimen>
    <dimen name="taskbar_back_button_suw_height">72dp</dimen>
    <dimen name="taskbar_running_app_indicator_height">4dp</dimen>
    <dimen name="taskbar_running_app_indicator_width">14dp</dimen>
    <dimen name="taskbar_running_app_indicator_top_margin">2dp</dimen>

    <!-- Transient taskbar -->
    <dimen name="transient_taskbar_padding">12dp</dimen>
+7 −0
Original line number Diff line number Diff line
@@ -80,6 +80,13 @@ class DesktopTaskbarRunningAppsController(
        return newHotseatItemInfos.toTypedArray()
    }

    override fun getRunningApps(): Set<String> {
        if (!isInDesktopMode) {
            return emptySet()
        }
        return allRunningDesktopAppInfos?.mapNotNull { it.targetPackage }?.toSet() ?: emptySet()
    }

    @VisibleForTesting
    public override fun updateRunningApps(hotseatItems: SparseArray<ItemInfo>?) {
        if (!isInDesktopMode) {
+11 −2
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Predicate;

/**
@@ -233,13 +234,21 @@ public class TaskbarModelCallbacks implements
        }
        hotseatItemInfos = mControllers.taskbarRecentAppsController
                .updateHotseatItemInfos(hotseatItemInfos);
        Set<String> runningPackages = mControllers.taskbarRecentAppsController.getRunningApps();

        if (mDeferUpdatesForSUW) {
            ItemInfo[] finalHotseatItemInfos = hotseatItemInfos;
            mDeferredUpdates = () -> mContainer.updateHotseatItems(finalHotseatItemInfos);
            mDeferredUpdates = () ->
                    commitHotseatItemUpdates(finalHotseatItemInfos, runningPackages);
        } else {
            mContainer.updateHotseatItems(hotseatItemInfos);
            commitHotseatItemUpdates(hotseatItemInfos, runningPackages);
        }
    }

    private void commitHotseatItemUpdates(
            ItemInfo[] hotseatItemInfos, Set<String> runningPackages) {
        mContainer.updateHotseatItems(hotseatItemInfos);
        mControllers.taskbarViewController.updateIconViewsRunningStates(runningPackages);
    }

    /**
+13 −2
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package com.android.launcher3.taskbar;

import static java.util.Collections.emptySet;

import android.util.SparseArray;

import androidx.annotation.CallSuper;
@@ -22,6 +24,8 @@ import androidx.annotation.CallSuper;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;

import java.util.Set;

/**
 * Base class for providing recent apps functionality
 */
@@ -43,7 +47,8 @@ public class TaskbarRecentAppsController {
    }

    /** Stores the current {@link AppInfo} instances, no-op except in desktop environment. */
    protected void setApps(AppInfo[] apps) { }
    protected void setApps(AppInfo[] apps) {
    }

    /**
     * Indicates whether recent apps functionality is enabled, should return false except in
@@ -59,5 +64,11 @@ public class TaskbarRecentAppsController {
    }

    /** Called to update the list of currently running apps, no-op except in desktop environment. */
    protected void updateRunningApps(SparseArray<ItemInfo> hotseatItems) { }
    protected void updateRunningApps(SparseArray<ItemInfo> hotseatItems) {
    }

    /** Returns the currently running apps, or an empty Set if outside of Desktop environment. */
    public Set<String> getRunningApps() {
        return emptySet();
    }
}
Loading