Merge changes I3eba2cdb,Ie529f27e,I4f0290fa,I7fb1f704,I32b9dd59, ... into nyc-dev
* changes: Scroll to the launch-task when toggling overview. Ensure that recents toggles even in the empty state. Removing paging tuner setting. Updating empty state graphic. Fixing issue with the stack layout not being updated on config change. Ensuring that we evict ActivityInfos from the cache.
This commit is contained in:
BIN
packages/SystemUI/res/drawable-hdpi/recents_empty.png
Executable file
BIN
packages/SystemUI/res/drawable-hdpi/recents_empty.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
BIN
packages/SystemUI/res/drawable-mdpi/recents_empty.png
Executable file
BIN
packages/SystemUI/res/drawable-mdpi/recents_empty.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
packages/SystemUI/res/drawable-xhdpi/recents_empty.png
Executable file
BIN
packages/SystemUI/res/drawable-xhdpi/recents_empty.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
packages/SystemUI/res/drawable-xxhdpi/recents_empty.png
Executable file
BIN
packages/SystemUI/res/drawable-xxhdpi/recents_empty.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
BIN
packages/SystemUI/res/drawable-xxxhdpi/recents_empty.png
Executable file
BIN
packages/SystemUI/res/drawable-xxxhdpi/recents_empty.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
@@ -16,10 +16,12 @@
|
||||
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:drawableTop="@drawable/recents_empty"
|
||||
android:drawablePadding="25dp"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#ffffffff"
|
||||
android:text="@string/recents_empty_message"
|
||||
|
||||
@@ -715,7 +715,9 @@
|
||||
<string name="quick_settings_work_mode_label">Work mode</string>
|
||||
|
||||
<!-- Recents: The empty recents string. [CHAR LIMIT=NONE] -->
|
||||
<string name="recents_empty_message">Your recent screens appear here</string>
|
||||
<string name="recents_empty_message">No recent items</string>
|
||||
<!-- Recents: The empty recents string after dismissing all tasks. [CHAR LIMIT=NONE] -->
|
||||
<string name="recents_empty_message_dismissed_all">You\'ve cleared everything</string>
|
||||
<!-- Recents: The info panel app info button string. [CHAR LIMIT=NONE] -->
|
||||
<string name="recents_app_info_button_label">Application Info</string>
|
||||
<!-- Recents: The screen pinning button. [CHAR LIMIT=NONE] -->
|
||||
@@ -1184,11 +1186,6 @@
|
||||
<!-- Option to use new paging layout in quick settings [CHAR LIMIT=60] -->
|
||||
<string name="qs_paging" translatable="false">Use the new Quick Settings</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_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 gesture</string>
|
||||
<!-- Description for the toggle to enable the gesture to enter split-screen by swiping up from the Overview button. [CHAR LIMIT=NONE]-->
|
||||
|
||||
@@ -137,11 +137,6 @@
|
||||
android:key="other"
|
||||
android:title="@string/other" >
|
||||
|
||||
<com.android.systemui.tuner.TunerSwitch
|
||||
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"
|
||||
android:title="@string/overview_nav_bar_gesture"
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.res.Configuration;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
@@ -361,7 +362,8 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
RecentsConfiguration config = Recents.getConfiguration();
|
||||
RecentsActivityLaunchState launchState = config.getLaunchState();
|
||||
if (!loadPlan.hasTasks()) {
|
||||
loader.preloadTasks(loadPlan, -1, launchState.launchedFromHome);
|
||||
loader.preloadTasks(loadPlan, launchState.launchedToTaskId,
|
||||
launchState.launchedFromHome);
|
||||
}
|
||||
|
||||
RecentsTaskLoadPlan.Options loadOpts = new RecentsTaskLoadPlan.Options();
|
||||
@@ -433,6 +435,13 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
mIterateTrigger.stopDozing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
|
||||
EventBus.getDefault().send(new ConfigurationChangedEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
@@ -740,7 +749,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
public final void onBusEvent(AllTaskViewsDismissedEvent event) {
|
||||
SystemServicesProxy ssp = Recents.getSystemServices();
|
||||
if (ssp.hasDockedTask()) {
|
||||
mRecentsView.showEmptyView();
|
||||
mRecentsView.showEmptyView(R.string.recents_empty_message_dismissed_all);
|
||||
} else {
|
||||
// Just go straight home (no animation necessary because there are no more task views)
|
||||
dismissRecentsToHome(false /* animateTaskViews */);
|
||||
|
||||
@@ -41,6 +41,8 @@ public class RecentsDebugFlags implements TunerService.Tunable {
|
||||
public static final boolean EnableHistory = false;
|
||||
// Overrides the Tuner flags and enables the timeout
|
||||
private static final boolean EnableFastToggleTimeout = false;
|
||||
// Overrides the Tuner flags and enables the paging via the Recents button
|
||||
private static final boolean EnablePaging = false;
|
||||
|
||||
// Enables us to create mock recents tasks
|
||||
public static final boolean EnableMockTasks = false;
|
||||
@@ -54,10 +56,6 @@ public class RecentsDebugFlags implements TunerService.Tunable {
|
||||
public static final int MockTaskGroupsTaskCount = 12;
|
||||
}
|
||||
|
||||
private static final String KEY_ENABLE_PAGING = "overview_enable_paging";
|
||||
|
||||
private boolean mEnablePaging;
|
||||
|
||||
/**
|
||||
* We read the prefs once when we start the activity, then update them as the tuner changes
|
||||
* the flags.
|
||||
@@ -65,7 +63,6 @@ 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_ENABLE_PAGING);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,16 +80,11 @@ public class RecentsDebugFlags implements TunerService.Tunable {
|
||||
* @return whether we are enabling paging.
|
||||
*/
|
||||
public boolean isPagingEnabled() {
|
||||
return mEnablePaging;
|
||||
return Static.EnablePaging;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTuningChanged(String key, String newValue) {
|
||||
switch (key) {
|
||||
case KEY_ENABLE_PAGING:
|
||||
mEnablePaging = (newValue != null) && (Integer.parseInt(newValue) != 0);
|
||||
break;
|
||||
}
|
||||
EventBus.getDefault().send(new DebugFlagsChangedEvent());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,6 +268,14 @@ public class RecentsTaskLoader {
|
||||
BitmapDrawable mDefaultIcon;
|
||||
Bitmap mDefaultThumbnail;
|
||||
|
||||
private TaskKeyLruCache.EvictionCallback mClearActivityInfoOnEviction =
|
||||
new TaskKeyLruCache.EvictionCallback() {
|
||||
@Override
|
||||
public void onEntryEvicted(Task.TaskKey key) {
|
||||
mActivityInfoCache.remove(key.getComponent());
|
||||
}
|
||||
};
|
||||
|
||||
public RecentsTaskLoader(Context context) {
|
||||
Resources res = context.getResources();
|
||||
mDefaultTaskBarBackgroundColor =
|
||||
@@ -292,10 +300,11 @@ public class RecentsTaskLoader {
|
||||
// Initialize the proxy, cache and loaders
|
||||
int numRecentTasks = ActivityManager.getMaxRecentTasksStatic();
|
||||
mLoadQueue = new TaskResourceLoadQueue();
|
||||
mIconCache = new TaskKeyLruCache<>(iconCacheSize);
|
||||
mIconCache = new TaskKeyLruCache<>(iconCacheSize, mClearActivityInfoOnEviction);
|
||||
mThumbnailCache = new TaskKeyLruCache<>(thumbnailCacheSize);
|
||||
mActivityLabelCache = new TaskKeyLruCache<>(numRecentTasks);
|
||||
mContentDescriptionCache = new TaskKeyLruCache<>(numRecentTasks);
|
||||
mActivityLabelCache = new TaskKeyLruCache<>(numRecentTasks, mClearActivityInfoOnEviction);
|
||||
mContentDescriptionCache = new TaskKeyLruCache<>(numRecentTasks,
|
||||
mClearActivityInfoOnEviction);
|
||||
mActivityInfoCache = new LruCache(numRecentTasks);
|
||||
mLoader = new BackgroundTaskLoader(mLoadQueue, mIconCache, mThumbnailCache,
|
||||
mDefaultThumbnail, mDefaultIcon);
|
||||
@@ -375,7 +384,6 @@ public class RecentsTaskLoader {
|
||||
mIconCache.remove(t.key);
|
||||
mActivityLabelCache.remove(t.key);
|
||||
mContentDescriptionCache.remove(t.key);
|
||||
mActivityInfoCache.remove(t.key.getComponent());
|
||||
if (notifyTaskDataUnloaded) {
|
||||
t.notifyTaskDataUnloaded(null, mDefaultIcon);
|
||||
}
|
||||
|
||||
@@ -30,16 +30,29 @@ import android.util.SparseArray;
|
||||
*/
|
||||
public class TaskKeyLruCache<V> {
|
||||
|
||||
public interface EvictionCallback {
|
||||
public void onEntryEvicted(Task.TaskKey key);
|
||||
}
|
||||
|
||||
private static final String TAG = "TaskKeyLruCache";
|
||||
|
||||
private final SparseArray<Task.TaskKey> mKeys = new SparseArray<>();
|
||||
private final LruCache<Integer, V> mCache;
|
||||
private final EvictionCallback mEvictionCallback;
|
||||
|
||||
public TaskKeyLruCache(int cacheSize) {
|
||||
this(cacheSize, null);
|
||||
}
|
||||
|
||||
public TaskKeyLruCache(int cacheSize, EvictionCallback evictionCallback) {
|
||||
mEvictionCallback = evictionCallback;
|
||||
mCache = new LruCache<Integer, V>(cacheSize) {
|
||||
|
||||
@Override
|
||||
protected void entryRemoved(boolean evicted, Integer taskId, V oldV, V newV) {
|
||||
if (mEvictionCallback != null) {
|
||||
mEvictionCallback.onEntryEvicted(mKeys.get(taskId));
|
||||
}
|
||||
mKeys.remove(taskId);
|
||||
}
|
||||
};
|
||||
@@ -84,8 +97,9 @@ public class TaskKeyLruCache<V> {
|
||||
|
||||
/** Removes a cache entry for a specific key. */
|
||||
final void remove(Task.TaskKey key) {
|
||||
mKeys.remove(key.id);
|
||||
// Remove the key after the cache value because we need it to make the callback
|
||||
mCache.remove(key.id);
|
||||
mKeys.remove(key.id);
|
||||
}
|
||||
|
||||
/** Removes all the entries in the cache. */
|
||||
|
||||
@@ -97,7 +97,7 @@ public class RecentsView extends FrameLayout {
|
||||
private RecentsAppWidgetHostView mSearchBar;
|
||||
private TextView mHistoryButton;
|
||||
private TextView mHistoryClearAllButton;
|
||||
private View mEmptyView;
|
||||
private TextView mEmptyView;
|
||||
private RecentsHistoryView mHistoryView;
|
||||
|
||||
private boolean mAwaitingFirstLayout = true;
|
||||
@@ -159,7 +159,7 @@ public class RecentsView extends FrameLayout {
|
||||
}
|
||||
});
|
||||
}
|
||||
mEmptyView = inflater.inflate(R.layout.recents_empty, this, false);
|
||||
mEmptyView = (TextView) inflater.inflate(R.layout.recents_empty, this, false);
|
||||
addView(mEmptyView);
|
||||
|
||||
setBackground(mBackgroundScrim);
|
||||
@@ -206,7 +206,7 @@ public class RecentsView extends FrameLayout {
|
||||
if (stack.getTaskCount() > 0) {
|
||||
hideEmptyView();
|
||||
} else {
|
||||
showEmptyView();
|
||||
showEmptyView(R.string.recents_empty_message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,11 +327,12 @@ public class RecentsView extends FrameLayout {
|
||||
/**
|
||||
* Hides the task stack and shows the empty view.
|
||||
*/
|
||||
public void showEmptyView() {
|
||||
public void showEmptyView(int msgResId) {
|
||||
if (RecentsDebugFlags.Static.EnableSearchBar && (mSearchBar != null)) {
|
||||
mSearchBar.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
mTaskStackView.setVisibility(View.INVISIBLE);
|
||||
mEmptyView.setText(msgResId);
|
||||
mEmptyView.setVisibility(View.VISIBLE);
|
||||
mEmptyView.bringToFront();
|
||||
if (RecentsDebugFlags.Static.EnableHistory) {
|
||||
@@ -400,8 +401,8 @@ public class RecentsView extends FrameLayout {
|
||||
|
||||
// Measure the empty view to the full size of the screen
|
||||
if (mEmptyView.getVisibility() != GONE) {
|
||||
measureChild(mEmptyView, MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
|
||||
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
|
||||
measureChild(mEmptyView, MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST),
|
||||
MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST));
|
||||
}
|
||||
|
||||
if (RecentsDebugFlags.Static.EnableHistory) {
|
||||
@@ -449,7 +450,13 @@ public class RecentsView extends FrameLayout {
|
||||
|
||||
// Layout the empty view
|
||||
if (mEmptyView.getVisibility() != GONE) {
|
||||
mEmptyView.layout(left, top, right, bottom);
|
||||
int leftRightInsets = mSystemInsets.left + mSystemInsets.right;
|
||||
int topBottomInsets = mSystemInsets.top + mSystemInsets.bottom;
|
||||
int childWidth = mEmptyView.getMeasuredWidth();
|
||||
int childHeight = mEmptyView.getMeasuredHeight();
|
||||
int childLeft = left + Math.max(0, (right - left - leftRightInsets - childWidth)) / 2;
|
||||
int childTop = top + Math.max(0, (bottom - top - topBottomInsets - childHeight)) / 2;
|
||||
mEmptyView.layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);
|
||||
}
|
||||
|
||||
if (RecentsDebugFlags.Static.EnableHistory) {
|
||||
|
||||
@@ -61,6 +61,7 @@ import com.android.systemui.recents.events.activity.EnterRecentsTaskStackAnimati
|
||||
import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent;
|
||||
import com.android.systemui.recents.events.activity.HideHistoryButtonEvent;
|
||||
import com.android.systemui.recents.events.activity.HideHistoryEvent;
|
||||
import com.android.systemui.recents.events.activity.HideRecentsEvent;
|
||||
import com.android.systemui.recents.events.activity.IterateRecentsEvent;
|
||||
import com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent;
|
||||
import com.android.systemui.recents.events.activity.LaunchTaskEvent;
|
||||
@@ -113,6 +114,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
private static final int DRAG_SCALE_DURATION = 175;
|
||||
private static final float DRAG_SCALE_FACTOR = 1.05f;
|
||||
|
||||
private static final int LAUNCH_NEXT_SCROLL_BASE_DURATION = 200;
|
||||
private static final int LAUNCH_NEXT_SCROLL_INCR_DURATION = 32;
|
||||
|
||||
private static final ArraySet<Task.TaskKey> EMPTY_TASK_SET = new ArraySet<>();
|
||||
|
||||
LayoutInflater mInflater;
|
||||
@@ -1618,12 +1622,34 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
mUIDozeTrigger.stopDozing();
|
||||
cancelAllTaskViewAnimations();
|
||||
|
||||
Task launchTask = mStack.getStackTasks().get(launchTaskIndex);
|
||||
EventBus.getDefault().send(new LaunchTaskEvent(getChildViewForTask(launchTask),
|
||||
launchTask, null, INVALID_STACK_ID, false /* screenPinningRequested */));
|
||||
final Task launchTask = mStack.getStackTasks().get(launchTaskIndex);
|
||||
if (getChildViewForTask(launchTask) == null) {
|
||||
List<TaskView> taskViews = getTaskViews();
|
||||
int lastTaskIndex = !taskViews.isEmpty()
|
||||
? mStack.indexOfStackTask(taskViews.get(taskViews.size() - 1).getTask())
|
||||
: mStack.getTaskCount() - 1;
|
||||
int duration = LAUNCH_NEXT_SCROLL_BASE_DURATION +
|
||||
Math.abs(mStack.indexOfStackTask(launchTask) - lastTaskIndex)
|
||||
* LAUNCH_NEXT_SCROLL_INCR_DURATION;
|
||||
mStackScroller.animateScroll(mLayoutAlgorithm.getStackScrollForTask(launchTask),
|
||||
duration, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EventBus.getDefault().send(new LaunchTaskEvent(
|
||||
getChildViewForTask(launchTask), launchTask, null,
|
||||
INVALID_STACK_ID, false /* screenPinningRequested */));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
EventBus.getDefault().send(new LaunchTaskEvent(getChildViewForTask(launchTask),
|
||||
launchTask, null, INVALID_STACK_ID, false /* screenPinningRequested */));
|
||||
}
|
||||
|
||||
MetricsLogger.action(getContext(), MetricsEvent.OVERVIEW_LAUNCH_PREVIOUS_TASK,
|
||||
launchTask.key.getComponent().toString());
|
||||
} else if (mStack.getTaskCount() == 0) {
|
||||
// If there are no tasks, then just hide recents back to home.
|
||||
EventBus.getDefault().send(new HideRecentsEvent(false, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -179,6 +179,13 @@ public class TaskStackViewScroller {
|
||||
|
||||
/** Animates the stack scroll */
|
||||
void animateScroll(float newScroll, final Runnable postRunnable) {
|
||||
int duration = mContext.getResources().getInteger(
|
||||
R.integer.recents_animate_task_stack_scroll_duration);
|
||||
animateScroll(newScroll, duration, postRunnable);
|
||||
}
|
||||
|
||||
/** Animates the stack scroll */
|
||||
void animateScroll(float newScroll, int duration, final Runnable postRunnable) {
|
||||
// Finish any current scrolling animations
|
||||
if (mScrollAnimator != null && mScrollAnimator.isRunning()) {
|
||||
setStackScroll(mFinalAnimatedScroll);
|
||||
@@ -190,8 +197,7 @@ public class TaskStackViewScroller {
|
||||
if (Float.compare(mStackScrollP, newScroll) != 0) {
|
||||
mFinalAnimatedScroll = newScroll;
|
||||
mScrollAnimator = ObjectAnimator.ofFloat(this, STACK_SCROLL, getStackScroll(), newScroll);
|
||||
mScrollAnimator.setDuration(mContext.getResources().getInteger(
|
||||
R.integer.recents_animate_task_stack_scroll_duration));
|
||||
mScrollAnimator.setDuration(duration);
|
||||
mScrollAnimator.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
|
||||
mScrollAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user