Adjusting the tuner flags to allow disabling fast toggle.

Change-Id: I0da29479c075a41ddb49e9852eb912604efa9aa8
This commit is contained in:
Winson
2016-02-11 16:40:36 -08:00
parent 1bcf3c4742
commit 14e15b2ca1
4 changed files with 15 additions and 43 deletions

View File

@@ -1176,15 +1176,10 @@
<!-- Option to use new paging layout in quick settings [CHAR LIMIT=60] -->
<string name="qs_paging" translatable="false">Use the new Quick Settings</string>
<!-- Toggles fast-toggling recents via the recents button. DO NOT TRANSLATE -->
<string name="overview_fast_toggle_via_button">Enable fast toggle</string>
<!-- Disables fast-toggling recents via the recents button. DO NOT TRANSLATE -->
<string name="overview_disable_fast_toggle_via_button">Disable fast toggle</string>
<!-- Description for the toggle for fast-toggling recents via the recents button. DO NOT TRANSLATE -->
<string name="overview_fast_toggle_via_button_desc">Enable launch timeout while paging</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>
<string name="overview_disable_fast_toggle_via_button_desc">Disable launch timeout while paging</string>
<!-- Toggle to enable the gesture to enter split-screen by swiping up from the Overview button. [CHAR LIMIT=60]-->
<string name="overview_nav_bar_gesture">Enable split-screen swipe-up accelerator</string>

View File

@@ -113,14 +113,9 @@
android:title="@string/overview" >
<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_via_button"
android:title="@string/overview_fast_toggle_via_button"
android:summary="@string/overview_fast_toggle_via_button_desc" />
android:key="overview_disable_fast_toggle_via_button"
android:title="@string/overview_disable_fast_toggle_via_button"
android:summary="@string/overview_disable_fast_toggle_via_button_desc" />
<com.android.systemui.tuner.TunerSwitch
android:key="overview_nav_bar_gesture"

View File

@@ -52,11 +52,9 @@ public class RecentsDebugFlags implements TunerService.Tunable {
public static final int MockTaskGroupsTaskCount = 12;
}
private static final String KEY_FAST_TOGGLE = "overview_fast_toggle_via_button";
private static final String KEY_INITIAL_STATE_PAGING = "overview_initial_state_paging";
private static final String KEY_DISABLE_FAST_TOGGLE = "overview_disable_fast_toggle_via_button";
private boolean mFastToggleRecents;
private boolean mInitialStatePaging;
private boolean mDisableFastToggleRecents;
/**
* We read the prefs once when we start the activity, then update them as the tuner changes
@@ -65,7 +63,7 @@ public class RecentsDebugFlags implements TunerService.Tunable {
public RecentsDebugFlags(Context context) {
// 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_INITIAL_STATE_PAGING);
TunerService.get(context).addTunable(this, KEY_DISABLE_FAST_TOGGLE);
}
/**
@@ -74,32 +72,21 @@ public class RecentsDebugFlags implements TunerService.Tunable {
public boolean isFastToggleRecentsEnabled() {
// These checks EnableFastToggleTimeoutOverride
SystemServicesProxy ssp = Recents.getSystemServices();
if (ssp.hasFreeformWorkspaceSupport() || ssp.hasDockedTask() ||
ssp.isTouchExplorationEnabled()) {
if (mDisableFastToggleRecents || ssp.hasFreeformWorkspaceSupport() || ssp.hasDockedTask()
|| ssp.isTouchExplorationEnabled()) {
return false;
}
if (Static.EnableFastToggleTimeoutOverride) {
return true;
}
return mFastToggleRecents;
}
/**
* @return whether the initial stack state is paging.
*/
public boolean isInitialStatePaging() {
return mInitialStatePaging;
return true;
}
@Override
public void onTuningChanged(String key, String newValue) {
switch (key) {
case KEY_FAST_TOGGLE:
mFastToggleRecents = (newValue != null) &&
(Integer.parseInt(newValue) != 0);
break;
case KEY_INITIAL_STATE_PAGING:
mInitialStatePaging = (newValue != null) &&
case KEY_DISABLE_FAST_TOGGLE:
mDisableFastToggleRecents = (newValue != null) &&
(Integer.parseInt(newValue) != 0);
break;
}

View File

@@ -518,12 +518,7 @@ public class TaskStackLayoutAlgorithm {
* Returns the default focus state.
*/
public float getDefaultFocusState() {
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
RecentsDebugFlags debugFlags = Recents.getDebugFlags();
if (launchState.launchedWithAltTab || debugFlags.isInitialStatePaging()) {
return STATE_FOCUSED;
}
return STATE_UNFOCUSED;
return STATE_FOCUSED;
}
/**