Merge "Stash taskbar when software keyboard is docked" into main
This commit is contained in:
commit
96fd73ed84
11 files changed
+81
-7
No files matched your search
@@ -401,6 +401,9 @@
|
||||
<dimen name="taskbar_pinning_popup_menu_width">300dp</dimen>
|
||||
<dimen name="taskbar_pinning_popup_menu_vertical_margin">16dp</dimen>
|
||||
|
||||
<!--- Floating Ime Inset height-->
|
||||
<dimen name="floating_ime_inset_height">60dp</dimen>
|
||||
|
||||
<!-- Recents overview -->
|
||||
<dimen name="recents_filter_icon_size">30dp</dimen>
|
||||
|
||||
|
||||
@@ -72,6 +72,8 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.BubbleTextView;
|
||||
@@ -417,6 +419,28 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return isPhoneMode() && !isThreeButtonNav();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if software keyboard is docked or input toolbar is placed at the taskbar area
|
||||
*/
|
||||
public boolean isImeDocked() {
|
||||
View dragLayer = getDragLayer();
|
||||
WindowInsets insets = dragLayer.getRootWindowInsets();
|
||||
if (insets == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
WindowInsetsCompat insetsCompat =
|
||||
WindowInsetsCompat.toWindowInsetsCompat(insets, dragLayer.getRootView());
|
||||
|
||||
if (insetsCompat.isVisible(WindowInsetsCompat.Type.ime())) {
|
||||
Insets imeInsets = insetsCompat.getInsets(WindowInsetsCompat.Type.ime());
|
||||
return imeInsets.bottom >= getResources().getDimensionPixelSize(
|
||||
R.dimen.floating_ime_inset_height);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show Taskbar upon receiving broadcast
|
||||
*/
|
||||
|
||||
@@ -30,9 +30,12 @@ import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowInsets;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.android.app.viewcapture.SettingsAwareViewCapture;
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
@@ -110,6 +113,18 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
|
||||
recreateControllers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
|
||||
if (insets != null) {
|
||||
WindowInsetsCompat insetsCompat = WindowInsetsCompat.toWindowInsetsCompat(insets, this);
|
||||
Insets imeInsets = insetsCompat.getInsets(WindowInsetsCompat.Type.ime());
|
||||
if (imeInsets != null) {
|
||||
mControllerCallbacks.onImeInsetChanged();
|
||||
}
|
||||
}
|
||||
return insets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recreateControllers() {
|
||||
mControllers = mControllerCallbacks.getTouchControllers();
|
||||
|
||||
@@ -275,6 +275,13 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa
|
||||
mControllers.taskbarInsetsController.updateInsetsTouchability(insetsInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when an IME inset is changed.
|
||||
*/
|
||||
public void onImeInsetChanged() {
|
||||
mControllers.taskbarStashController.onImeInsetChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a child is removed from TaskbarDragLayer.
|
||||
*/
|
||||
|
||||
@@ -893,6 +893,10 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
}
|
||||
|
||||
// Only update the following flags when system gesture is not in progress.
|
||||
setStashedImeState();
|
||||
}
|
||||
|
||||
private void setStashedImeState() {
|
||||
boolean shouldStashForIme = shouldStashForIme();
|
||||
updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, false);
|
||||
if (hasAnyFlag(FLAG_STASHED_IN_APP_IME) != shouldStashForIme) {
|
||||
@@ -903,6 +907,13 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be called when Ime inset is changed to determine if taskbar should be stashed
|
||||
*/
|
||||
public void onImeInsetChanged() {
|
||||
setStashedImeState();
|
||||
}
|
||||
|
||||
/**
|
||||
* When hiding the IME, delay the unstash animation to align with the end of the transition.
|
||||
*/
|
||||
@@ -952,7 +963,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
*
|
||||
* <p>Do not stash if in small screen, with 3 button nav, and in landscape (or seascape).
|
||||
* <p>Do not stash if taskbar is transient.
|
||||
* <p>Do not stash if hardware keyboard is attached and taskbar is pinned.
|
||||
* <p>Do not stash if hardware keyboard is attached and taskbar is pinned and IME is docked
|
||||
*/
|
||||
private boolean shouldStashForIme() {
|
||||
if (DisplayController.isTransientTaskbar(mActivity)) {
|
||||
@@ -963,8 +974,10 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
&& mActivity.getDeviceProfile().isLandscape) {
|
||||
return false;
|
||||
}
|
||||
// Do not stash if pinned taskbar and hardware keyboard is attached.
|
||||
if (mActivity.isHardwareKeyboard() && DisplayController.isPinnedTaskbar(mActivity)) {
|
||||
|
||||
// Do not stash if pinned taskbar, hardware keyboard is attached and no IME is docked
|
||||
if (mActivity.isHardwareKeyboard() && DisplayController.isPinnedTaskbar(mActivity)
|
||||
&& !mActivity.isImeDocked()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,10 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
|
||||
// Allow null-pointer to catch illegal states.
|
||||
runOnTISBinder(tisBinder -> tisBinder.getTaskbarManager().recreateTaskbar());
|
||||
return response;
|
||||
|
||||
case TestProtocol.REQUEST_TASKBAR_IME_DOCKED:
|
||||
return getTISBinderUIProperty(Bundle::putBoolean, tisBinder ->
|
||||
tisBinder.getTaskbarManager()
|
||||
.getCurrentActivityContext().isImeDocked());
|
||||
case TestProtocol.REQUEST_UNSTASH_BUBBLE_BAR_IF_STASHED:
|
||||
runOnTISBinder(tisBinder -> {
|
||||
// Allow null-pointer to catch illegal states.
|
||||
|
||||
@@ -373,7 +373,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
|
||||
boolean isTransientTaskbar = mLauncher.isTransientTaskbar();
|
||||
// Expect task bar invisible when the launched app was the IME activity.
|
||||
LaunchedAppState launchedAppState = getAndAssertLaunchedApp();
|
||||
if (!isTransientTaskbar && isHardwareKeyboard()) {
|
||||
if (!isTransientTaskbar && isHardwareKeyboard() && !mLauncher.isImeDocked()) {
|
||||
launchedAppState.assertTaskbarVisible();
|
||||
} else {
|
||||
launchedAppState.assertTaskbarHidden();
|
||||
|
||||
@@ -400,6 +400,9 @@
|
||||
<dimen name="taskbar_button_margin_split">0dp</dimen>
|
||||
<dimen name="taskbar_button_margin_6_5">0dp</dimen>
|
||||
|
||||
<!--- Floating Ime Inset height-->
|
||||
<dimen name="floating_ime_inset_height">0dp</dimen>
|
||||
|
||||
<!-- Bubble bar (placeholders to compile in Launcher3 without Quickstep) -->
|
||||
<dimen name="bubblebar_hotseat_adjustment_threshold">0dp</dimen>
|
||||
|
||||
|
||||
@@ -322,8 +322,8 @@ public interface ActivityContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the software keyboard is hidden. Hardware keyboards do not display on screen by
|
||||
* default.
|
||||
* Returns if the software keyboard (including input toolbar) is hidden. Hardware
|
||||
* keyboards do not display on screen by default.
|
||||
*/
|
||||
default boolean isSoftwareKeyboardHidden() {
|
||||
if (isHardwareKeyboard()) {
|
||||
|
||||
@@ -101,6 +101,7 @@ public final class TestProtocol {
|
||||
public static final String REQUEST_TASKBAR_FROM_NAV_THRESHOLD = "taskbar-from-nav-threshold";
|
||||
public static final String REQUEST_STASHED_TASKBAR_SCALE = "taskbar-stash-handle-scale";
|
||||
public static final String REQUEST_RECREATE_TASKBAR = "recreate-taskbar";
|
||||
public static final String REQUEST_TASKBAR_IME_DOCKED = "taskbar-ime-docked";
|
||||
public static final String REQUEST_APP_LIST_FREEZE_FLAGS = "app-list-freeze-flags";
|
||||
public static final String REQUEST_APPS_LIST_SCROLL_Y = "apps-list-scroll-y";
|
||||
public static final String REQUEST_TASKBAR_APPS_LIST_SCROLL_Y = "taskbar-apps-list-scroll-y";
|
||||
|
||||
@@ -2232,6 +2232,11 @@ public final class LauncherInstrumentation {
|
||||
.getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
|
||||
}
|
||||
|
||||
public boolean isImeDocked() {
|
||||
return getTestInfo(TestProtocol.REQUEST_TASKBAR_IME_DOCKED).getBoolean(
|
||||
TestProtocol.TEST_INFO_RESPONSE_FIELD);
|
||||
}
|
||||
|
||||
/** Enables transient taskbar for testing purposes only. */
|
||||
public void enableTransientTaskbar(boolean enable) {
|
||||
getTestInfo(enable
|
||||
|
||||
Reference in new issue
Block a user