summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2018-02-08 12:10:54 -0800
committerTony Wickham <twickham@google.com>2018-02-15 12:20:16 -0800
commit663759e444b9aebf4beb2c737df8f58ffc21a49b (patch)
tree0dcb8d86126242279e422c66d48c14577cb9f4af
parent4c021ee1bca85957cb63bff8d948ff9de7adc8a4 (diff)
downloadandroid_packages_apps_Trebuchet-663759e444b9aebf4beb2c737df8f58ffc21a49b.tar.gz
android_packages_apps_Trebuchet-663759e444b9aebf4beb2c737df8f58ffc21a49b.tar.bz2
android_packages_apps_Trebuchet-663759e444b9aebf4beb2c737df8f58ffc21a49b.zip
Remove back button when on home screen
Add OverviewInteractionState to handle setting OverviewInteractionFlags. Hide back button when in NORMAL state and launcher's window is focused. Show it when in other states or when launcher's window loses focus. Change-Id: I35919561b9972789e995f1cc434c23e2afe9e77c
-rw-r--r--quickstep/libs/sysui_shared.jarbin113625 -> 114397 bytes
-rw-r--r--quickstep/src/com/android/launcher3/uioverrides/UiFactory.java11
-rw-r--r--quickstep/src/com/android/quickstep/OverviewInteractionState.java64
-rw-r--r--src/com/android/launcher3/Launcher.java6
-rw-r--r--src/com/android/launcher3/LauncherStateManager.java6
-rw-r--r--src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java3
6 files changed, 87 insertions, 3 deletions
diff --git a/quickstep/libs/sysui_shared.jar b/quickstep/libs/sysui_shared.jar
index f508eab3d..d1ac93645 100644
--- a/quickstep/libs/sysui_shared.jar
+++ b/quickstep/libs/sysui_shared.jar
Binary files differ
diff --git a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
index b4f40c215..92b38fe01 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
@@ -16,12 +16,11 @@
package com.android.launcher3.uioverrides;
-import android.content.pm.PackageManager;
+import static com.android.launcher3.LauncherState.NORMAL;
+
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.PointF;
-import android.os.Bundle;
-import android.view.View;
import android.view.View.AccessibilityDelegate;
import com.android.launcher3.Launcher;
@@ -29,6 +28,7 @@ import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.graphics.BitmapRenderer;
import com.android.launcher3.util.TouchController;
+import com.android.quickstep.OverviewInteractionState;
import com.android.quickstep.RecentsView;
import com.android.systemui.shared.recents.view.RecentsTransition;
@@ -68,6 +68,11 @@ public class UiFactory {
OptionsPopupView.show(launcher, touchPoint.x, touchPoint.y);
}
+ public static void onLauncherStateOrFocusChanged(Launcher launcher) {
+ OverviewInteractionState.setBackButtonVisible(launcher, !launcher.isInState(NORMAL)
+ || !launcher.hasWindowFocus());
+ }
+
public static Bitmap createFromRenderer(int width, int height, boolean forceSoftwareRenderer,
BitmapRenderer renderer) {
if (USE_HARDWARE_BITMAP && !forceSoftwareRenderer) {
diff --git a/quickstep/src/com/android/quickstep/OverviewInteractionState.java b/quickstep/src/com/android/quickstep/OverviewInteractionState.java
new file mode 100644
index 000000000..9be12bdb9
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/OverviewInteractionState.java
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+package com.android.quickstep;
+
+import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_HIDE_BACK_BUTTON;
+
+import android.content.Context;
+import android.os.RemoteException;
+import android.util.Log;
+
+import com.android.systemui.shared.recents.ISystemUiProxy;
+
+/**
+ * Sets overview interaction flags, such as:
+ *
+ * - FLAG_DISABLE_QUICK_SCRUB
+ * - FLAG_DISABLE_SWIPE_UP
+ * - FLAG_HIDE_BACK_BUTTON
+ * - FLAG_SHOW_OVERVIEW_BUTTON
+ *
+ * @see com.android.systemui.shared.system.NavigationBarCompat.InteractionType and associated flags.
+ */
+public class OverviewInteractionState {
+
+ private static final String TAG = "OverviewFlags";
+
+ private static int sFlags;
+
+ public static void setBackButtonVisible(Context context, boolean visible) {
+ updateOverviewInteractionFlag(context, FLAG_HIDE_BACK_BUTTON, !visible);
+ }
+
+ private static void updateOverviewInteractionFlag(Context context, int flag, boolean enabled) {
+ if (enabled) {
+ sFlags |= flag;
+ } else {
+ sFlags &= ~flag;
+ }
+
+ ISystemUiProxy systemUiProxy = RecentsModel.getInstance(context).getSystemUiProxy();
+ if (systemUiProxy == null) {
+ Log.w(TAG, "Unable to update overview interaction flags; not bound to service");
+ return;
+ }
+ try {
+ systemUiProxy.setInteractionState(sFlags);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Unable to update overview interaction flags", e);
+ }
+ }
+}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index f6abae8ab..2e0483754 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -855,6 +855,12 @@ public class Launcher extends BaseActivity
}
}
+ @Override
+ public void onWindowFocusChanged(boolean hasFocus) {
+ super.onWindowFocusChanged(hasFocus);
+ mStateManager.onWindowFocusChanged();
+ }
+
public interface LauncherOverlay {
/**
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java
index 6050d15da..e0b84bf46 100644
--- a/src/com/android/launcher3/LauncherStateManager.java
+++ b/src/com/android/launcher3/LauncherStateManager.java
@@ -303,6 +303,12 @@ public class LauncherStateManager {
if (state == NORMAL) {
setRestState(null);
}
+
+ UiFactory.onLauncherStateOrFocusChanged(mLauncher);
+ }
+
+ public void onWindowFocusChanged() {
+ UiFactory.onLauncherStateOrFocusChanged(mLauncher);
}
public LauncherState getLastState() {
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
index 744125e15..64a29ea3e 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
@@ -16,6 +16,7 @@
package com.android.launcher3.uioverrides;
+import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import android.graphics.Bitmap;
@@ -61,4 +62,6 @@ public class UiFactory {
}
public static void resetOverview(Launcher launcher) { }
+
+ public static void onLauncherStateOrFocusChanged(Launcher launcher) { }
}