Add tuner params to change the initial stack state and navbar gesture.
Change-Id: I114b8342f5293589eb96a1fd3a14da1757e75a95
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index d6a361c..002b9f5 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1171,13 +1171,23 @@
<!-- Toggles fullscreen screenshots. DO NOT TRANSLATE -->
<string name="overview_fullscreen_thumbnails">Enable fullscreen screenshots</string>
<!-- Description for the toggle for fullscreen screenshots. DO NOT TRANSLATE -->
- <string name="overview_fullscreen_thumbnails_desc">Enable fullscreen screenshots in Overview</string>
+ <string name="overview_fullscreen_thumbnails_desc">Enable fullscreen screenshots in Overview. Restart required.</string>
+
+ <!-- Toggle to enable the Overview nav bar gesture. DO NOT TRANSLATE -->
+ <string name="overview_nav_bar_gesture">Enable navigation bar gesture</string>
+ <!-- Description for the toggle to enable the Overview nav bar gesture. DO NOT TRANSLATE -->
+ <string name="overview_nav_bar_gesture_desc">Enables the gesture to enter Overview by swiping up on the Nav bar</string>
<!-- Toggle to show the history view in Overview. DO NOT TRANSLATE -->
<string name="overview_show_history">Show History</string>
<!-- Description for the toggle to show the history view in Overview. DO NOT TRANSLATE -->
<string name="overview_show_history_desc">Enables the history view to see more recent tasks</string>
+ <!-- Toggle to set the initial scroll state to be paging or stack. DO NOT TRANSLATE -->
+ <string name="overview_initial_state_paging">Initialize to paging</string>
+ <!-- Description for the toggle to set the initial scroll state to be paging or stack. DO NOT TRANSLATE -->
+ <string name="overview_initial_state_paging_desc">Determines whether Overview will initially be in a stacked or paged state</string>
+
<!-- Category in the System UI Tuner settings, where new/experimental
settings are -->
<string name="experimental">Experimental</string>
diff --git a/packages/SystemUI/res/xml/tuner_prefs.xml b/packages/SystemUI/res/xml/tuner_prefs.xml
index f398af3..8dcf8a7 100644
--- a/packages/SystemUI/res/xml/tuner_prefs.xml
+++ b/packages/SystemUI/res/xml/tuner_prefs.xml
@@ -93,11 +93,21 @@
android:summary="@string/overview_page_on_toggle_desc" />
<com.android.systemui.tuner.TunerSwitch
+ android:key="overview_initial_state_paging"
+ android:title="@string/overview_initial_state_paging"
+ android:summary="@string/overview_initial_state_paging_desc" />
+
+ <com.android.systemui.tuner.TunerSwitch
android:key="overview_fast_toggle"
android:title="@string/overview_fast_toggle_via_button"
android:summary="@string/overview_fast_toggle_via_button_desc" />
<com.android.systemui.tuner.TunerSwitch
+ android:key="overview_nav_bar_gesture"
+ android:title="@string/overview_nav_bar_gesture"
+ android:summary="@string/overview_nav_bar_gesture_desc" />
+
+ <com.android.systemui.tuner.TunerSwitch
android:key="overview_fullscreen_thumbnails"
android:title="@string/overview_fullscreen_thumbnails"
android:summary="@string/overview_fullscreen_thumbnails_desc" />
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java
index e8b8816..d778886 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java
@@ -30,6 +30,7 @@
private static final String KEY_PAGE_ON_TOGGLE = "overview_page_on_toggle";
private static final String KEY_FULLSCREEN_THUMBNAILS = "overview_fullscreen_thumbnails";
private static final String KEY_SHOW_HISTORY = "overview_show_history";
+ private static final String KEY_INITIAL_STATE_PAGING = "overview_initial_state_paging";
public static class Static {
// Enables debug drawing for the transition thumbnail
@@ -54,6 +55,7 @@
private boolean mPageOnToggle;
private boolean mUseFullscreenThumbnails;
private boolean mShowHistory;
+ private boolean mInitialStatePaging;
/**
* We read the prefs once when we start the activity, then update them as the tuner changes
@@ -63,7 +65,7 @@
// Register all our flags, this will also call onTuningChanged() for each key, which will
// initialize the current state of each flag
TunerService.get(context).addTunable(this, KEY_FAST_TOGGLE, KEY_PAGE_ON_TOGGLE,
- KEY_FULLSCREEN_THUMBNAILS, KEY_SHOW_HISTORY);
+ KEY_FULLSCREEN_THUMBNAILS, KEY_SHOW_HISTORY, KEY_INITIAL_STATE_PAGING);
}
/**
@@ -94,6 +96,13 @@
return mShowHistory;
}
+ /**
+ * @return whether the initial stack state is paging.
+ */
+ public boolean isInitialStatePaging() {
+ return mInitialStatePaging;
+ }
+
@Override
public void onTuningChanged(String key, String newValue) {
switch (key) {
@@ -113,6 +122,10 @@
mShowHistory = (newValue != null) &&
(Integer.parseInt(newValue) != 0);
break;
+ case KEY_INITIAL_STATE_PAGING:
+ mInitialStatePaging = (newValue != null) &&
+ (Integer.parseInt(newValue) != 0);
+ break;
}
EventBus.getDefault().send(new DebugFlagsChangedEvent());
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
index d630032..ebb819c 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
@@ -498,7 +498,8 @@
public float getDefaultFocusState() {
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
RecentsDebugFlags debugFlags = Recents.getDebugFlags();
- if (debugFlags.isPageOnToggleEnabled() || launchState.launchedWithAltTab) {
+ if (launchState.launchedWithAltTab ||
+ (debugFlags.isPageOnToggleEnabled() && debugFlags.isInitialStatePaging())) {
return 1f;
}
return 0f;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java
index b4e0692..a2616fe 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java
@@ -18,29 +18,27 @@
import android.app.ActivityManager;
import android.content.Context;
-import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Rect;
-import android.os.SystemProperties;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.ViewConfiguration;
-import android.view.WindowManager;
import com.android.systemui.R;
import com.android.systemui.RecentsComponent;
import com.android.systemui.stackdivider.Divider;
-import com.android.systemui.statusbar.BaseStatusBar;
+import com.android.systemui.tuner.TunerService;
import static android.view.WindowManager.*;
/**
* Class to detect gestures on the navigation bar.
*/
-public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureListener {
+public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureListener
+ implements TunerService.Tunable {
- private static final String DOCK_WINDOW_GESTURE_ENABLED_PROP = "persist.dock_gesture_enabled";
+ private static final String KEY_DOCK_WINDOW_GESTURE = "overview_nav_bar_gesture";
/**
* When dragging from the navigation bar, we drag in recents.
@@ -78,7 +76,7 @@
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
mMinFlingVelocity = configuration.getScaledMinimumFlingVelocity();
mTaskSwitcherDetector = new GestureDetector(context, this);
- mDockWindowEnabled = SystemProperties.getBoolean(DOCK_WINDOW_GESTURE_ENABLED_PROP, false);
+ TunerService.get(context).addTunable(this, KEY_DOCK_WINDOW_GESTURE);
}
public void setComponents(RecentsComponent recentsComponent, Divider divider) {
@@ -267,4 +265,14 @@
}
return true;
}
+
+ @Override
+ public void onTuningChanged(String key, String newValue) {
+ switch (key) {
+ case KEY_DOCK_WINDOW_GESTURE:
+ mDockWindowEnabled = (newValue != null) &&
+ (Integer.parseInt(newValue) != 0);
+ break;
+ }
+ }
}