Hide some options when desktop mode is available
When desktop mode is available (flag enabled), hide some freeform specific buttons: - hide freeform from app menu in recents - hide maximize button from window captions Bug: 242906219 Test: test that buttons are not shown when desktop mode is enabled Change-Id: I4c3e3f5ce1221eef853d73e2b395b362037c9cca
This commit is contained in:
@@ -49,6 +49,7 @@ import com.android.wm.shell.common.TaskStackListenerImpl;
|
||||
import com.android.wm.shell.common.TransactionPool;
|
||||
import com.android.wm.shell.common.annotations.ShellBackgroundThread;
|
||||
import com.android.wm.shell.common.annotations.ShellMainThread;
|
||||
import com.android.wm.shell.desktopmode.DesktopModeConstants;
|
||||
import com.android.wm.shell.desktopmode.DesktopModeController;
|
||||
import com.android.wm.shell.draganddrop.DragAndDropController;
|
||||
import com.android.wm.shell.freeform.FreeformComponents;
|
||||
@@ -587,7 +588,7 @@ public abstract class WMShellModule {
|
||||
RootDisplayAreaOrganizer rootDisplayAreaOrganizer,
|
||||
@ShellMainThread Handler mainHandler
|
||||
) {
|
||||
if (DesktopModeController.IS_FEATURE_ENABLED) {
|
||||
if (DesktopModeConstants.IS_FEATURE_ENABLED) {
|
||||
return Optional.of(new DesktopModeController(context, shellInit, shellTaskOrganizer,
|
||||
rootDisplayAreaOrganizer,
|
||||
mainHandler));
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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.
|
||||
*/
|
||||
|
||||
package com.android.wm.shell.desktopmode;
|
||||
|
||||
import android.os.SystemProperties;
|
||||
|
||||
/**
|
||||
* Constants for desktop mode feature
|
||||
*/
|
||||
public class DesktopModeConstants {
|
||||
|
||||
/**
|
||||
* Flag to indicate whether desktop mode is available on the device
|
||||
*/
|
||||
public static final boolean IS_FEATURE_ENABLED = SystemProperties.getBoolean(
|
||||
"persist.wm.debug.desktop_mode", false);
|
||||
}
|
||||
@@ -25,7 +25,6 @@ import android.content.Context;
|
||||
import android.database.ContentObserver;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.window.WindowContainerTransaction;
|
||||
@@ -44,9 +43,6 @@ import com.android.wm.shell.sysui.ShellInit;
|
||||
*/
|
||||
public class DesktopModeController {
|
||||
|
||||
public static final boolean IS_FEATURE_ENABLED = SystemProperties.getBoolean(
|
||||
"persist.wm.debug.desktop_mode", false);
|
||||
|
||||
private final Context mContext;
|
||||
private final ShellTaskOrganizer mShellTaskOrganizer;
|
||||
private final RootDisplayAreaOrganizer mRootDisplayAreaOrganizer;
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.android.wm.shell.R;
|
||||
import com.android.wm.shell.ShellTaskOrganizer;
|
||||
import com.android.wm.shell.common.DisplayController;
|
||||
import com.android.wm.shell.common.SyncTransactionQueue;
|
||||
import com.android.wm.shell.desktopmode.DesktopModeConstants;
|
||||
|
||||
/**
|
||||
* Defines visuals and behaviors of a window decoration of a caption bar and shadows. It works with
|
||||
@@ -163,7 +164,13 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
|
||||
View caption = mResult.mRootView.findViewById(R.id.caption);
|
||||
caption.setOnTouchListener(mOnCaptionTouchListener);
|
||||
View maximize = caption.findViewById(R.id.maximize_window);
|
||||
maximize.setOnClickListener(mOnCaptionButtonClickListener);
|
||||
if (DesktopModeConstants.IS_FEATURE_ENABLED) {
|
||||
// Hide maximize button when desktop mode is available
|
||||
maximize.setVisibility(View.GONE);
|
||||
} else {
|
||||
maximize.setVisibility(View.VISIBLE);
|
||||
maximize.setOnClickListener(mOnCaptionButtonClickListener);
|
||||
}
|
||||
View close = caption.findViewById(R.id.close_window);
|
||||
close.setOnClickListener(mOnCaptionButtonClickListener);
|
||||
View minimize = caption.findViewById(R.id.minimize_window);
|
||||
|
||||
Reference in New Issue
Block a user