Merge "Removing support for menu button from NavBar" into qt-dev

This commit is contained in:
TreeHugger Robot
2019-05-02 18:35:40 +00:00
committed by Android (Google) Code Review
6 changed files with 4 additions and 113 deletions

View File

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="21dp"
android:height="21dp"
android:viewportWidth="28"
android:viewportHeight="28">
<path
android:fillColor="?attr/singleToneColor"
android:pathData="M14,9.5c1.24,0,2.25-1.01,2.25-2.25S15.24,5,14,5s-2.25,1.01-2.25,2.25S12.76,9.5,14,9.5z M14,11.75 c-1.24,0-2.25,1.01-2.25,2.25s1.01,2.25,2.25,2.25s2.25-1.01,2.25-2.25S15.24,11.75,14,11.75z M14,18.5 c-1.24,0-2.25,1.01-2.25,2.25S12.76,23,14,23s2.25-1.01,2.25-2.25S15.24,18.5,14,18.5z" />
</vector>

View File

@@ -78,7 +78,7 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController<
private static final int MSG_COLLAPSE_PANELS = 4 << MSG_SHIFT;
private static final int MSG_EXPAND_SETTINGS = 5 << MSG_SHIFT;
private static final int MSG_SET_SYSTEMUI_VISIBILITY = 6 << MSG_SHIFT;
private static final int MSG_TOP_APP_WINDOW_CHANGED = 7 << MSG_SHIFT;
private static final int MSG_DISPLAY_READY = 7 << MSG_SHIFT;
private static final int MSG_SHOW_IME_BUTTON = 8 << MSG_SHIFT;
private static final int MSG_TOGGLE_RECENT_APPS = 9 << MSG_SHIFT;
private static final int MSG_PRELOAD_RECENT_APPS = 10 << MSG_SHIFT;
@@ -115,7 +115,6 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController<
private static final int MSG_SHOW_CHARGING_ANIMATION = 44 << MSG_SHIFT;
private static final int MSG_SHOW_PINNING_TOAST_ENTER_EXIT = 45 << MSG_SHIFT;
private static final int MSG_SHOW_PINNING_TOAST_ESCAPE = 46 << MSG_SHIFT;
private static final int MSG_DISPLAY_READY = 47 << MSG_SHIFT;
public static final int FLAG_EXCLUDE_NONE = 0;
public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
@@ -182,15 +181,6 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController<
boolean navbarColorManagedByIme) {
}
/**
* Called to notify top app window changes.
* @see IStatusBar#topAppWindowChanged(int, boolean)
*
* @param displayId The id of the display to notify.
* @param visible {@code true} to show menu button.
*/
default void topAppWindowChanged(int displayId, boolean visible) { }
/**
* Called to notify IME window status changes.
*
@@ -480,13 +470,7 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController<
}
@Override
public void topAppWindowChanged(int displayId, boolean menuVisible) {
synchronized (mLock) {
mHandler.removeMessages(MSG_TOP_APP_WINDOW_CHANGED);
mHandler.obtainMessage(MSG_TOP_APP_WINDOW_CHANGED,
displayId, menuVisible ? 1 : 0, null).sendToTarget();
}
}
public void topAppWindowChanged(int displayId, boolean menuVisible) { }
@Override
public void setImeWindowStatus(int displayId, IBinder token, int vis, int backDisposition,
@@ -888,11 +872,6 @@ public class CommandQueue extends IStatusBar.Stub implements CallbackController<
}
args.recycle();
break;
case MSG_TOP_APP_WINDOW_CHANGED:
for (int i = 0; i < mCallbacks.size(); i++) {
mCallbacks.get(i).topAppWindowChanged(msg.arg1, msg.arg2 != 0);
}
break;
case MSG_SHOW_IME_BUTTON:
args = (SomeArgs) msg.obj;
handleShowImeButton(args.argi1 /* displayId */, (IBinder) args.arg1 /* token */,

View File

@@ -448,13 +448,6 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback
checkBarModes();
}
@Override
public void topAppWindowChanged(int displayId, boolean showMenu) {
if (displayId == mDisplayId && mNavigationBarView != null) {
mNavigationBarView.setMenuVisibility(showMenu);
}
}
@Override
public void setWindowState(
int displayId, @WindowType int window, @WindowVisibleState int state) {

View File

@@ -268,8 +268,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
// Set up the context group of buttons
mContextualButtonGroup = new ContextualButtonGroup(R.id.menu_container);
final ContextualButton menuButton = new ContextualButton(R.id.menu,
R.drawable.ic_sysbar_menu);
final ContextualButton imeSwitcherButton = new ContextualButton(R.id.ime_switcher,
R.drawable.ic_ime_switcher_default);
final RotationContextButton rotateSuggestionButton = new RotationContextButton(
@@ -278,7 +276,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
final ContextualButton accessibilityButton =
new ContextualButton(R.id.accessibility_button,
R.drawable.ic_sysbar_accessibility_button);
mContextualButtonGroup.addButton(menuButton);
mContextualButtonGroup.addButton(imeSwitcherButton);
if (!isGesturalMode) {
mContextualButtonGroup.addButton(rotateSuggestionButton);
@@ -306,7 +303,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
mButtonDispatchers.put(R.id.home, new ButtonDispatcher(R.id.home));
mButtonDispatchers.put(R.id.home_handle, new ButtonDispatcher(R.id.home_handle));
mButtonDispatchers.put(R.id.recent_apps, new ButtonDispatcher(R.id.recent_apps));
mButtonDispatchers.put(R.id.menu, menuButton);
mButtonDispatchers.put(R.id.ime_switcher, imeSwitcherButton);
mButtonDispatchers.put(R.id.accessibility_button, accessibilityButton);
mButtonDispatchers.put(R.id.rotate_suggestion, rotateSuggestionButton);
@@ -406,10 +402,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
return mButtonDispatchers.get(R.id.recent_apps);
}
public ButtonDispatcher getMenuButton() {
return mButtonDispatchers.get(R.id.menu);
}
public ButtonDispatcher getBackButton() {
return mButtonDispatchers.get(R.id.back);
}
@@ -795,10 +787,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
}
}
public void setMenuVisibility(final boolean show) {
mContextualButtonGroup.setButtonVisibility(R.id.menu, show);
}
public void setAccessibilityButtonState(final boolean visible, final boolean longClickable) {
mLongClickableAccessibilityButton = longClickable;
getAccessibilityButton().setLongClickable(longClickable);
@@ -1154,16 +1142,14 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
visibilityToString(getCurrentView().getVisibility()),
getCurrentView().getAlpha()));
pw.println(String.format(" disabled=0x%08x vertical=%s menu=%s darkIntensity=%.2f",
pw.println(String.format(" disabled=0x%08x vertical=%s darkIntensity=%.2f",
mDisabledFlags,
mIsVertical ? "true" : "false",
getMenuButton().isVisible() ? "true" : "false",
getLightTransitionsController().getCurrentDarkIntensity()));
dumpButton(pw, "back", getBackButton());
dumpButton(pw, "home", getHomeButton());
dumpButton(pw, "rcnt", getRecentsButton());
dumpButton(pw, "menu", getMenuButton());
dumpButton(pw, "rota", getRotateSuggestionButton());
dumpButton(pw, "a11y", getAccessibilityButton());

View File

@@ -713,7 +713,6 @@ public class StatusBar extends SystemUI implements DemoMode,
result.mFullscreenStackSysUiVisibility, result.mDockedStackSysUiVisibility,
0xffffffff, result.mFullscreenStackBounds, result.mDockedStackBounds,
result.mNavbarColorManagedByIme);
topAppWindowChanged(mDisplayId, result.mMenuVisible);
// StatusBarManagerService has a back up of IME token and it's restored here.
setImeWindowStatus(mDisplayId, result.mImeToken, result.mImeWindowVis,
result.mImeBackDisposition, result.mShowImeSwitcher);
@@ -727,11 +726,10 @@ public class StatusBar extends SystemUI implements DemoMode,
if (DEBUG) {
Log.d(TAG, String.format(
"init: icons=%d disabled=0x%08x lights=0x%08x menu=0x%08x imeButton=0x%08x",
"init: icons=%d disabled=0x%08x lights=0x%08x imeButton=0x%08x",
numIcons,
result.mDisabledFlags1,
result.mSystemUiVisibility,
result.mMenuVisible ? 1 : 0,
result.mImeWindowVis));
}
@@ -2235,31 +2233,6 @@ public class StatusBar extends SystemUI implements DemoMode,
return 0 == (mSystemUiVisibility & View.SYSTEM_UI_FLAG_LOW_PROFILE);
}
public void setLightsOn(boolean on) {
Log.v(TAG, "setLightsOn(" + on + ")");
if (on) {
setSystemUiVisibility(mDisplayId, 0, 0, 0, View.SYSTEM_UI_FLAG_LOW_PROFILE,
mLastFullscreenStackBounds, mLastDockedStackBounds,
false /* navbarColorManagedByIme */);
} else {
setSystemUiVisibility(mDisplayId, View.SYSTEM_UI_FLAG_LOW_PROFILE, 0, 0,
View.SYSTEM_UI_FLAG_LOW_PROFILE, mLastFullscreenStackBounds,
mLastDockedStackBounds, false /* navbarColorManagedByIme */);
}
}
@Override
public void topAppWindowChanged(int displayId, boolean showMenu) {
if (mDisplayId != displayId) return;
if (SPEW) {
Log.d(TAG, "display#" + displayId + ": "
+ (showMenu ? "showing" : "hiding") + " the MENU button");
}
// See above re: lights-out policy for legacy apps.
if (showMenu) setLightsOn(true);
}
public static String viewInfo(View v) {
return "[(" + v.getLeft() + "," + v.getTop() + ")(" + v.getRight() + "," + v.getBottom()
+ ") " + v.getWidth() + "x" + v.getHeight() + "]";

View File

@@ -127,20 +127,6 @@ public class CommandQueueTest extends SysuiTestCase {
eq(null), eq(r), eq(false));
}
@Test
public void testTopAppWindowChanged() {
mCommandQueue.topAppWindowChanged(DEFAULT_DISPLAY, true);
waitForIdleSync();
verify(mCallbacks).topAppWindowChanged(eq(DEFAULT_DISPLAY), eq(true));
}
@Test
public void testTopAppWindowChangedForSecondaryDisplay() {
mCommandQueue.topAppWindowChanged(SECONDARY_DISPLAY, true);
waitForIdleSync();
verify(mCallbacks).topAppWindowChanged(eq(SECONDARY_DISPLAY), eq(true));
}
@Test
public void testShowImeButton() {
mCommandQueue.setImeWindowStatus(DEFAULT_DISPLAY, null, 1, 2, true);