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

Commit d9900e0d authored by Pragya Bajoria's avatar Pragya Bajoria
Browse files

Remove obsolete desktop stashing logic from platform/packages/apps/Launcher3 [5/n]

Bug: 309481654
Change-Id: Id7b5db662d578eb625171055d30c37cd59e7d73c
Flag: EXEMPT refactor since it is removing obsolete code with no changes to current behavior.
parent de2e793f
Loading
Loading
Loading
Loading
+0 −56
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
     Copyright (C) 2023 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<com.android.quickstep.views.DesktopAppSelectView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:layout_width="wrap_content"
    android:layout_height="@dimen/desktop_mode_floating_app_select_height"
    android:layout_gravity="top|center_horizontal"
    android:background="@drawable/bg_floating_desktop_select"
    android:elevation="@dimen/desktop_mode_floating_app_select_elevation"
    android:gravity="center_vertical"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/desktop_app_select_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="@dimen/desktop_mode_floating_app_select_text_margin"
        android:layout_marginStart="@dimen/desktop_mode_floating_app_select_margin"
        android:drawablePadding="@dimen/desktop_mode_floating_app_select_text_margin"
        android:drawableStart="@drawable/ic_desktop"
        android:drawableTint="?androidprv:attr/materialColorOnPrimaryContainer"
        android:fontFamily="google-sans-medium"
        android:gravity="center_vertical"
        android:text="@string/desktop_select_app_toast"
        android:textColor="?androidprv:attr/materialColorOnPrimaryContainer"
        android:textSize="@dimen/desktop_mode_floating_app_select_text_size" />

    <Button
        android:id="@+id/close_button"
        style="@android:style/Widget.DeviceDefault.Button.Borderless"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="@dimen/desktop_mode_floating_app_select_margin"
        android:minWidth="0dp"
        android:fontFamily="google-sans-medium"
        android:text="@string/desktop_button_close_app_toast"
        android:textAllCaps="false"
        android:textColor="?androidprv:attr/materialColorPrimary"
        android:textSize="@dimen/desktop_mode_floating_app_select_text_size" />

</com.android.quickstep.views.DesktopAppSelectView>
+0 −7
Original line number Diff line number Diff line
@@ -484,11 +484,4 @@
    <dimen name="keyboard_quick_switch_no_recent_items_icon_size">24dp</dimen>
    <dimen name="keyboard_quick_switch_no_recent_items_icon_margin">8dp</dimen>

    <!-- Desktop mode -->
    <dimen name="desktop_mode_floating_app_select_height">56dp</dimen>
    <dimen name="desktop_mode_floating_app_select_elevation">4dp</dimen>
    <dimen name="desktop_mode_floating_app_select_margin">16dp</dimen>
    <dimen name="desktop_mode_floating_app_select_text_size">14sp</dimen>
    <dimen name="desktop_mode_floating_app_select_text_margin">8dp</dimen>

</resources>
+0 −6
Original line number Diff line number Diff line
@@ -332,10 +332,4 @@

    <!-- Accessibility label for quick switch tiles showing split tasks [CHAR LIMIT=NONE] -->
    <string name="quick_switch_split_task"><xliff:g id="app_name_1" example="Chrome">%1$s</xliff:g> and <xliff:g id="app_name_2" example="Gmail">%2$s</xliff:g></string>

    <!-- ******* Desktop ******* -->
    <!-- Text shown in popup to choose a desktop app. [CHAR LIMIT=60] -->
    <string name="desktop_select_app_toast">Adding app to Desktop</string>
    <!-- Text shown on a button that closes the popup for choosing a desktop app. [CHAR_LIMIT=40] -->
    <string name="desktop_button_close_app_toast">Cancel</string>
</resources>
+1 −52
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.util.DisplayController;
import com.android.quickstep.GestureState;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.views.DesktopAppSelectView;
import com.android.wm.shell.desktopmode.IDesktopTaskListener;

import java.util.HashSet;
@@ -49,8 +48,6 @@ public class DesktopVisibilityController {

    private static final String TAG = "DesktopVisController";
    private static final boolean DEBUG = false;
    private static final boolean IS_STASHING_ENABLED = SystemProperties.getBoolean(
            "persist.wm.debug.desktop_stashing", false);
    private final Launcher mLauncher;
    private final Set<DesktopVisibilityListener> mDesktopVisibilityListeners = new HashSet<>();

@@ -61,7 +58,6 @@ public class DesktopVisibilityController {

    @Nullable
    private IDesktopTaskListener mDesktopTaskListener;
    private DesktopAppSelectView mSelectAppToast;

    public DesktopVisibilityController(Launcher launcher) {
        mLauncher = launcher;
@@ -86,21 +82,7 @@ public class DesktopVisibilityController {

            @Override
            public void onStashedChanged(int displayId, boolean stashed) {
                if (!IS_STASHING_ENABLED) {
                    return;
                }
                MAIN_EXECUTOR.execute(() -> {
                    if (displayId == mLauncher.getDisplayId()) {
                        if (DEBUG) {
                            Log.d(TAG, "desktop stashed changed value=" + stashed);
                        }
                        if (stashed) {
                            showSelectAppToast();
                        } else {
                            hideSelectAppToast();
                        }
                    }
                });
              Log.w(TAG, "IDesktopTaskListener: onStashedChanged is deprecated");
            }
        };
        SystemUiProxy.INSTANCE.get(mLauncher).setDesktopTaskListener(mDesktopTaskListener);
@@ -302,15 +284,6 @@ public class DesktopVisibilityController {
        }
    }

    /**
     * Handle launcher moving to home due to home gesture or home button press.
     */
    public void onHomeActionTriggered() {
        if (IS_STASHING_ENABLED && areDesktopTasksVisible()) {
            SystemUiProxy.INSTANCE.get(mLauncher).stashDesktopApps(mLauncher.getDisplayId());
        }
    }

    /**
     * TODO: b/333533253 - Remove after flag rollout
     */
@@ -373,30 +346,6 @@ public class DesktopVisibilityController {
        }
    }

    private void showSelectAppToast() {
        if (mSelectAppToast != null) {
            return;
        }
        if (DEBUG) {
            Log.d(TAG, "show toast to select desktop apps");
        }
        Runnable onCloseCallback = () -> {
            SystemUiProxy.INSTANCE.get(mLauncher).hideStashedDesktopApps(mLauncher.getDisplayId());
        };
        mSelectAppToast = DesktopAppSelectView.show(mLauncher, onCloseCallback);
    }

    private void hideSelectAppToast() {
        if (mSelectAppToast == null) {
            return;
        }
        if (DEBUG) {
            Log.d(TAG, "hide toast to select desktop apps");
        }
        mSelectAppToast.hide();
        mSelectAppToast = null;
    }

    /** A listener for when the user enters/exits Desktop Mode. */
    public interface DesktopVisibilityListener {
        /**
+0 −9
Original line number Diff line number Diff line
@@ -44,10 +44,8 @@ import androidx.annotation.StringRes;

import com.android.launcher3.R;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.statehandlers.DesktopVisibilityController;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.quickstep.LauncherActivityInterface;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.TaskUtils;
import com.android.quickstep.util.AssistUtils;
@@ -284,13 +282,6 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa

    private void navigateHome() {
        TaskUtils.closeSystemWindowsAsync(CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY);

        DesktopVisibilityController desktopVisibilityController =
                LauncherActivityInterface.INSTANCE.getDesktopVisibilityController();
        if (desktopVisibilityController != null) {
            desktopVisibilityController.onHomeActionTriggered();
        }

        mCallbacks.onNavigateHome();
    }

Loading