Merge "Enabling history and paging by default"
This commit is contained in:
@@ -1171,31 +1171,11 @@
|
||||
<!-- 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 paging recents via the recents button. DO NOT TRANSLATE -->
|
||||
<string name="overview_page_on_toggle">Enable paging</string>
|
||||
<!-- Description for the toggle for fast-toggling recents via the recents button. DO NOT TRANSLATE -->
|
||||
<string name="overview_page_on_toggle_desc">Enable paging via the Overview button</string>
|
||||
|
||||
<!-- Toggles fast-toggling recents via the recents button. DO NOT TRANSLATE -->
|
||||
<string name="overview_fast_toggle_via_button">Enable 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>
|
||||
|
||||
<!-- 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. 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 -->
|
||||
|
||||
@@ -72,11 +72,6 @@
|
||||
<PreferenceScreen
|
||||
android:title="@string/overview" >
|
||||
|
||||
<com.android.systemui.tuner.TunerSwitch
|
||||
android:key="overview_page_on_toggle"
|
||||
android:title="@string/overview_page_on_toggle"
|
||||
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"
|
||||
@@ -87,21 +82,6 @@
|
||||
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" />
|
||||
|
||||
<com.android.systemui.tuner.TunerSwitch
|
||||
android:key="overview_show_history"
|
||||
android:title="@string/overview_show_history"
|
||||
android:summary="@string/overview_show_history_desc" />
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
<SwitchPreference
|
||||
|
||||
@@ -53,31 +53,26 @@ public class RecentsActivityLaunchState {
|
||||
*/
|
||||
public int getInitialFocusTaskIndex(int numTasks) {
|
||||
RecentsDebugFlags flags = Recents.getDebugFlags();
|
||||
if (flags.isPageOnToggleEnabled() && !launchedWithAltTab) {
|
||||
// If we are fast toggling, then focus the next task depending on when you are on home
|
||||
// or coming in from another app
|
||||
if (launchedWithAltTab) {
|
||||
if (launchedFromAppWithThumbnail) {
|
||||
// If alt-tabbing from another app, focus the next task
|
||||
return numTasks - 2;
|
||||
} else {
|
||||
// If alt-tabbing from home, focus the first task
|
||||
return numTasks - 1;
|
||||
}
|
||||
} else {
|
||||
if (launchedFromHome) {
|
||||
return numTasks - 1;
|
||||
} else {
|
||||
if (flags.isFastToggleRecentsEnabled() || !flags.isInitialStatePaging()) {
|
||||
// If we are not fast-toggling or are starting in the non-focused mode, then
|
||||
// we should assume the front most task has focus
|
||||
return numTasks - 1;
|
||||
} else {
|
||||
return numTasks - 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (launchedWithAltTab && launchedFromAppWithThumbnail) {
|
||||
// If alt-tabbing from another app, focus the next task
|
||||
return numTasks - 2;
|
||||
} else if ((launchedWithAltTab && launchedFromHome) ||
|
||||
(!launchedWithAltTab && launchedFromAppWithThumbnail)) {
|
||||
// If alt-tabbing from home, or launching from an app normally, focus that task
|
||||
return numTasks - 1;
|
||||
} else {
|
||||
// Otherwise, we are launching recents from home normally, focus no tasks so that we
|
||||
// know to return home
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,16 +143,13 @@ public class RecentsConfiguration {
|
||||
int rightInset, Rect searchBarBounds, Rect taskStackBounds) {
|
||||
if (hasTransposedNavBar) {
|
||||
// In landscape phones, the search bar appears on the left, but we overlay it on top
|
||||
int swInset = getInsetToSmallestWidth(windowBounds.right - rightInset -
|
||||
windowBounds.left);
|
||||
taskStackBounds.set(windowBounds.left + swInset, windowBounds.top + topInset,
|
||||
windowBounds.right - swInset - rightInset, windowBounds.bottom);
|
||||
taskStackBounds.set(windowBounds.left, windowBounds.top + topInset,
|
||||
windowBounds.right - rightInset, windowBounds.bottom);
|
||||
} else {
|
||||
// In portrait, the search bar appears on the top (which already has the inset)
|
||||
int swInset = getInsetToSmallestWidth(windowBounds.right - windowBounds.left);
|
||||
int top = searchBarBounds.isEmpty() ? topInset : 0;
|
||||
taskStackBounds.set(windowBounds.left + swInset, searchBarBounds.bottom + top,
|
||||
windowBounds.right - swInset - rightInset, windowBounds.bottom);
|
||||
taskStackBounds.set(windowBounds.left, searchBarBounds.bottom + top,
|
||||
windowBounds.right - rightInset, windowBounds.bottom);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,15 +170,4 @@ public class RecentsConfiguration {
|
||||
windowBounds.right, windowBounds.top + topInset + searchBarSize);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constrain the width of the landscape stack to the smallest width of the device.
|
||||
*/
|
||||
private int getInsetToSmallestWidth(int availableWidth) {
|
||||
RecentsDebugFlags debugFlags = Recents.getDebugFlags();
|
||||
if (!debugFlags.isFullscreenThumbnailsEnabled() && (availableWidth > smallestWidth)) {
|
||||
return (availableWidth - smallestWidth) / 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,10 +26,7 @@ import com.android.systemui.tuner.TunerService;
|
||||
*/
|
||||
public class RecentsDebugFlags implements TunerService.Tunable {
|
||||
|
||||
private static final String KEY_FAST_TOGGLE = "overview_fast_toggle";
|
||||
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_FAST_TOGGLE = "overview_fast_toggle_via_button";
|
||||
private static final String KEY_INITIAL_STATE_PAGING = "overview_initial_state_paging";
|
||||
|
||||
public static class Static {
|
||||
@@ -52,9 +49,6 @@ public class RecentsDebugFlags implements TunerService.Tunable {
|
||||
}
|
||||
|
||||
private boolean mFastToggleRecents;
|
||||
private boolean mPageOnToggle;
|
||||
private boolean mUseFullscreenThumbnails;
|
||||
private boolean mShowHistory;
|
||||
private boolean mInitialStatePaging;
|
||||
|
||||
/**
|
||||
@@ -64,36 +58,14 @@ 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_PAGE_ON_TOGGLE,
|
||||
KEY_FULLSCREEN_THUMBNAILS, KEY_SHOW_HISTORY, KEY_INITIAL_STATE_PAGING);
|
||||
TunerService.get(context).addTunable(this, KEY_FAST_TOGGLE, KEY_INITIAL_STATE_PAGING);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether we are enabling fast toggling.
|
||||
*/
|
||||
public boolean isFastToggleRecentsEnabled() {
|
||||
return mPageOnToggle && mFastToggleRecents;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether the recents button toggles pages.
|
||||
*/
|
||||
public boolean isPageOnToggleEnabled() {
|
||||
return mPageOnToggle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether we should show fullscreen thumbnails
|
||||
*/
|
||||
public boolean isFullscreenThumbnailsEnabled() {
|
||||
return mUseFullscreenThumbnails;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether we should show the history
|
||||
*/
|
||||
public boolean isHistoryEnabled() {
|
||||
return mShowHistory;
|
||||
return mFastToggleRecents;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,18 +82,6 @@ public class RecentsDebugFlags implements TunerService.Tunable {
|
||||
mFastToggleRecents = (newValue != null) &&
|
||||
(Integer.parseInt(newValue) != 0);
|
||||
break;
|
||||
case KEY_PAGE_ON_TOGGLE:
|
||||
mPageOnToggle = (newValue != null) &&
|
||||
(Integer.parseInt(newValue) != 0);
|
||||
break;
|
||||
case KEY_FULLSCREEN_THUMBNAILS:
|
||||
mUseFullscreenThumbnails = (newValue != null) &&
|
||||
(Integer.parseInt(newValue) != 0);
|
||||
break;
|
||||
case KEY_SHOW_HISTORY:
|
||||
mShowHistory = (newValue != null) &&
|
||||
(Integer.parseInt(newValue) != 0);
|
||||
break;
|
||||
case KEY_INITIAL_STATE_PAGING:
|
||||
mInitialStatePaging = (newValue != null) &&
|
||||
(Integer.parseInt(newValue) != 0);
|
||||
|
||||
@@ -333,7 +333,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
|
||||
RecentsConfiguration config = Recents.getConfiguration();
|
||||
RecentsActivityLaunchState launchState = config.getLaunchState();
|
||||
RecentsDebugFlags flags = Recents.getDebugFlags();
|
||||
if (flags.isPageOnToggleEnabled() && !launchState.launchedWithAltTab) {
|
||||
if (!launchState.launchedWithAltTab) {
|
||||
// Notify recents to move onto the next task
|
||||
EventBus.getDefault().post(new IterateRecentsEvent());
|
||||
} else {
|
||||
|
||||
@@ -152,14 +152,12 @@ public class RecentsTaskLoadPlan {
|
||||
// This task is only shown in the stack if it statisfies the historical time or min
|
||||
// number of tasks constraints. Freeform tasks are also always shown.
|
||||
boolean isStackTask = true;
|
||||
if (debugFlags.isHistoryEnabled()) {
|
||||
boolean isFreeformTask = SystemServicesProxy.isFreeformStack(t.stackId);
|
||||
isStackTask = isFreeformTask || (!isHistoricalTask(t) ||
|
||||
(t.lastActiveTime >= lastStackActiveTime &&
|
||||
i >= (taskCount - MIN_NUM_TASKS)));
|
||||
if (isStackTask && newLastStackActiveTime < 0) {
|
||||
newLastStackActiveTime = t.lastActiveTime;
|
||||
}
|
||||
boolean isFreeformTask = SystemServicesProxy.isFreeformStack(t.stackId);
|
||||
isStackTask = isFreeformTask || (!isHistoricalTask(t) ||
|
||||
(t.lastActiveTime >= lastStackActiveTime &&
|
||||
i >= (taskCount - MIN_NUM_TASKS)));
|
||||
if (isStackTask && newLastStackActiveTime < 0) {
|
||||
newLastStackActiveTime = t.lastActiveTime;
|
||||
}
|
||||
|
||||
// Load the label, icon, and color
|
||||
@@ -192,7 +190,7 @@ public class RecentsTaskLoadPlan {
|
||||
stackTasks.add(task);
|
||||
}
|
||||
}
|
||||
if (debugFlags.isHistoryEnabled() && newLastStackActiveTime != -1) {
|
||||
if (newLastStackActiveTime != -1) {
|
||||
Prefs.putLong(mContext, Prefs.Key.OVERVIEW_LAST_STACK_TASK_ACTIVE_TIME,
|
||||
newLastStackActiveTime);
|
||||
}
|
||||
|
||||
@@ -599,15 +599,6 @@ public class RecentsView extends FrameLayout {
|
||||
hideHistoryButton(100);
|
||||
}
|
||||
|
||||
public final void onBusEvent(DebugFlagsChangedEvent event) {
|
||||
RecentsDebugFlags debugFlags = Recents.getDebugFlags();
|
||||
if (!debugFlags.isHistoryEnabled()) {
|
||||
hideHistoryButton(100);
|
||||
} else {
|
||||
showHistoryButton(100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the history button.
|
||||
*/
|
||||
@@ -620,11 +611,6 @@ public class RecentsView extends FrameLayout {
|
||||
|
||||
private void showHistoryButton(final int duration,
|
||||
final ReferenceCountedTrigger postHideHistoryAnimationTrigger) {
|
||||
RecentsDebugFlags debugFlags = Recents.getDebugFlags();
|
||||
if (!debugFlags.isHistoryEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mHistoryButton.setVisibility(View.VISIBLE);
|
||||
mHistoryButton.setAlpha(0f);
|
||||
mHistoryButton.setText(getContext().getString(R.string.recents_history_label_format,
|
||||
|
||||
@@ -355,9 +355,7 @@ public class TaskStackLayoutAlgorithm {
|
||||
/ (taskStackBounds.height() - mSystemInsets.bottom);
|
||||
int width = mStackRect.width();
|
||||
int minHeight = mStackRect.height() - mFocusedPeekHeight - mStackBottomOffset;
|
||||
int height = debugFlags.isFullscreenThumbnailsEnabled()
|
||||
? (int) Math.min(width / aspect, minHeight)
|
||||
: width;
|
||||
int height = (int) Math.min(width / aspect, minHeight);
|
||||
mTaskRect.set(mStackRect.left, mStackRect.top,
|
||||
mStackRect.left + width, mStackRect.top + height);
|
||||
|
||||
@@ -499,8 +497,7 @@ public class TaskStackLayoutAlgorithm {
|
||||
public float getDefaultFocusState() {
|
||||
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
|
||||
RecentsDebugFlags debugFlags = Recents.getDebugFlags();
|
||||
if (launchState.launchedWithAltTab ||
|
||||
(debugFlags.isPageOnToggleEnabled() && debugFlags.isInitialStatePaging())) {
|
||||
if (launchState.launchedWithAltTab || debugFlags.isInitialStatePaging()) {
|
||||
return 1f;
|
||||
}
|
||||
return 0f;
|
||||
|
||||
@@ -669,12 +669,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
|
||||
if (scrollToTask) {
|
||||
// TODO: Center the newly focused task view, only if not freeform
|
||||
RecentsDebugFlags debugFlags = Recents.getDebugFlags();
|
||||
float newScroll = mLayoutAlgorithm.getStackScrollForTask(newFocusedTask);
|
||||
if (!debugFlags.isFullscreenThumbnailsEnabled()) {
|
||||
newScroll -= 0.5f;
|
||||
}
|
||||
newScroll = mStackScroller.getBoundedStackScroll(newScroll);
|
||||
if (Float.compare(newScroll, mStackScroller.getStackScroll()) != 0) {
|
||||
mStackScroller.animateScroll(mStackScroller.getStackScroll(), newScroll,
|
||||
focusTaskRunnable);
|
||||
|
||||
@@ -493,6 +493,9 @@ public final class ActivityManagerService extends ActivityManagerNative
|
||||
// Used to indicate that an app transition should be animated.
|
||||
private static final boolean ANIMATE = true;
|
||||
|
||||
// Determines whether to take full screen screenshots
|
||||
static final boolean TAKE_FULLSCREEN_SCREENSHOTS = true;
|
||||
|
||||
private static native int nativeMigrateToBoost();
|
||||
private static native int nativeMigrateFromBoost();
|
||||
private boolean mIsBoosted = false;
|
||||
@@ -1276,7 +1279,6 @@ public final class ActivityManagerService extends ActivityManagerNative
|
||||
boolean mAlwaysFinishActivities = false;
|
||||
boolean mForceResizableActivities;
|
||||
boolean mSupportsFreeformWindowManagement;
|
||||
boolean mTakeFullscreenScreenshots;
|
||||
IActivityController mController = null;
|
||||
String mProfileApp = null;
|
||||
ProcessRecord mProfileProc = null;
|
||||
@@ -12013,13 +12015,9 @@ public final class ActivityManagerService extends ActivityManagerNative
|
||||
mContext.getPackageManager().hasSystemFeature(FEATURE_FREEFORM_WINDOW_MANAGEMENT);
|
||||
|
||||
final String debugApp = Settings.Global.getString(resolver, DEBUG_APP);
|
||||
final String fsScreenshots = Settings.Secure.getString(resolver,
|
||||
"overview_fullscreen_thumbnails");
|
||||
final boolean waitForDebugger = Settings.Global.getInt(resolver, WAIT_FOR_DEBUGGER, 0) != 0;
|
||||
final boolean alwaysFinishActivities =
|
||||
Settings.Global.getInt(resolver, ALWAYS_FINISH_ACTIVITIES, 0) != 0;
|
||||
final boolean takeFullscreenScreenshots = fsScreenshots != null &&
|
||||
Integer.parseInt(fsScreenshots) != 0;
|
||||
final boolean forceRtl = Settings.Global.getInt(resolver, DEVELOPMENT_FORCE_RTL, 0) != 0;
|
||||
final int defaultForceResizable = Build.IS_DEBUGGABLE ? 1 : 0;
|
||||
final boolean forceResizable = Settings.Global.getInt(
|
||||
@@ -12040,7 +12038,6 @@ public final class ActivityManagerService extends ActivityManagerNative
|
||||
mAlwaysFinishActivities = alwaysFinishActivities;
|
||||
mForceResizableActivities = forceResizable;
|
||||
mSupportsFreeformWindowManagement = freeformWindowManagement || forceResizable;
|
||||
mTakeFullscreenScreenshots = takeFullscreenScreenshots;
|
||||
// This happens before any activities are started, so we can
|
||||
// change mConfiguration in-place.
|
||||
updateConfigurationLocked(configuration, null, true);
|
||||
|
||||
@@ -862,7 +862,7 @@ final class ActivityStack {
|
||||
// When this flag is set, we currently take the fullscreen screenshot of the activity
|
||||
// but scaled to half the size. This gives us a "good-enough" fullscreen thumbnail to
|
||||
// use within SystemUI while keeping memory usage low.
|
||||
if (mService.mTakeFullscreenScreenshots) {
|
||||
if (ActivityManagerService.TAKE_FULLSCREEN_SCREENSHOTS) {
|
||||
w = h = -1;
|
||||
scale = 0.5f;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user