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

Commit 089c86f6 authored by Kazuki Takise's avatar Kazuki Takise
Browse files

Customize restart dialog icon for restart handle menu

The current icon for the restart dialog is intended only for size
compat mode, so we need to replace it with a normal "restart" icon
when the dialog is requested by the restart handle menu (as it's
available to non-SCM apps too).

This change simply replaces the src drawable of the ImageView when
isRestartMenuEnabledForDisplayMove() is true.

Flag: com.android.window.flags.enable_restart_menu_for_connected_displays
Bug: 406072124
Test: RestartDialogWindowManagerTest
Change-Id: I513ac27e6ee38af7c61dedf2a2706930b05ec46d
parent a1d6882a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@
                android:orientation="vertical">

                <ImageView
                    android:id="@+id/letterbox_restart_dialog_title_icon"
                    android:importantForAccessibility="no"
                    android:layout_width="@dimen/letterbox_restart_dialog_title_icon_width"
                    android:layout_height="@dimen/letterbox_restart_dialog_title_icon_height"
+10 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.widget.ImageView;

import com.android.internal.annotations.VisibleForTesting;
import com.android.wm.shell.R;
@@ -156,8 +157,16 @@ class RestartDialogWindowManager extends CompatUIWindowManagerAbstract {
    }

    private RestartDialogLayout inflateLayout() {
        return (RestartDialogLayout) LayoutInflater.from(mContext).inflate(
        final RestartDialogLayout layout =
                (RestartDialogLayout) LayoutInflater.from(mContext).inflate(
                R.layout.letterbox_restart_dialog_layout, null);
        if (getLastTaskInfo().appCompatTaskInfo.isRestartMenuEnabledForDisplayMove()) {
            ImageView imageView = layout.findViewById(R.id.letterbox_restart_dialog_title_icon);
            // Replace the "size compat" icon with something more general when requested from the
            // restart handle menu.
            imageView.setImageResource(R.drawable.desktop_mode_ic_handle_menu_restart);
        }
        return layout;
    }

    private void startEnterAnimation() {