Merge changes I4d542a09,Icd792ed4,I020dcbac into nyc-dev

am: fcd6e7cb72

* commit 'fcd6e7cb72b57c439550092ca3cfa2900289bb47':
  Removing boot completed check before hiding Recents.
  Track double taps to launch the previous task.
  Dev preview changes for incompatible apps.
This commit is contained in:
Winson
2016-02-25 22:25:13 +00:00
committed by android-build-merger
12 changed files with 120 additions and 56 deletions

View File

@@ -30,21 +30,41 @@
android:paddingBottom="8dp"
android:paddingStart="12dp"
android:paddingEnd="16dp" />
<TextView
android:id="@+id/title"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
android:layout_marginStart="56dp"
android:layout_marginEnd="112dp"
android:textSize="16sp"
android:textColor="#ffffffff"
android:text="@string/recents_empty_message"
android:fontFamily="sans-serif-medium"
android:singleLine="true"
android:maxLines="2"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
android:layout_marginEnd="56dp"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:textSize="16sp"
android:textColor="#ffffffff"
android:text="@string/recents_empty_message"
android:fontFamily="sans-serif-medium"
android:singleLine="true"
android:maxLines="1"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
<TextView
android:id="@+id/sub_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:textSize="11sp"
android:textColor="#ffffffff"
android:text="@string/recents_launch_non_dockable_task_label"
android:fontFamily="sans-serif-medium"
android:singleLine="true"
android:maxLines="1"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:visibility="gone" />
</LinearLayout>
<com.android.systemui.recents.views.FixedSizeImageView
android:id="@+id/move_task"
android:layout_width="@dimen/recents_task_view_header_button_width"

View File

@@ -722,6 +722,10 @@
<string name="recents_history_button_label">History</string>
<!-- Recents: History clear all string. [CHAR LIMIT=NONE] -->
<string name="recents_history_clear_all_button_label">Clear</string>
<!-- Recents: Non-dockable task drag message. [CHAR LIMIT=NONE] -->
<string name="recents_drag_non_dockable_task_message">This app does not support multi-window</string>
<!-- Recents: Non-dockable task launch sub header. [CHAR LIMIT=NONE] -->
<string name="recents_launch_non_dockable_task_label">App does not support multi-window</string>
<!-- Recents: MultiStack add stack split horizontal radio button. [CHAR LIMIT=NONE] -->
<string name="recents_multistack_add_stack_dialog_split_horizontal">Split Horizontal</string>

View File

@@ -528,17 +528,16 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
@Override
public void onMultiWindowChanged(boolean inMultiWindow) {
super.onMultiWindowChanged(inMultiWindow);
if (!inMultiWindow) {
RecentsTaskLoader loader = Recents.getTaskLoader();
RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options();
launchOpts.loadIcons = false;
launchOpts.loadThumbnails = false;
launchOpts.onlyLoadForCache = true;
RecentsTaskLoadPlan loadPlan = loader.createLoadPlan(this);
loader.preloadTasks(loadPlan, -1, false);
loader.loadTasks(this, loadPlan, launchOpts);
EventBus.getDefault().send(new TaskStackUpdatedEvent(loadPlan.getTaskStack()));
}
RecentsTaskLoader loader = Recents.getTaskLoader();
RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options();
launchOpts.loadIcons = false;
launchOpts.loadThumbnails = false;
launchOpts.onlyLoadForCache = true;
RecentsTaskLoadPlan loadPlan = loader.createLoadPlan(this);
loader.preloadTasks(loadPlan, -1, false);
loader.loadTasks(this, loadPlan, launchOpts);
EventBus.getDefault().send(new TaskStackUpdatedEvent(loadPlan.getTaskStack(),
inMultiWindow));
}
@Override

View File

@@ -161,10 +161,8 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
Handler mHandler;
TaskStackListenerImpl mTaskStackListener;
RecentsAppWidgetHost mAppWidgetHost;
boolean mBootCompleted;
boolean mCanReuseTaskStackViews = true;
boolean mDraggingInRecents;
boolean mReloadTasks;
boolean mLaunchedWhileDocking;
// Task launching
@@ -236,7 +234,6 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
}
public void onBootCompleted() {
mBootCompleted = true;
updateHeaderBarLayout(true /* tryAndBindSearchWidget */, null /* stack */);
}
@@ -317,23 +314,21 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
}
public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
if (mBootCompleted) {
if (triggeredFromAltTab && mFastAltTabTrigger.isDozing()) {
// The user has released alt-tab before the trigger has run, so just show the next
// task immediately
showNextTask();
if (triggeredFromAltTab && mFastAltTabTrigger.isDozing()) {
// The user has released alt-tab before the trigger has run, so just show the next
// task immediately
showNextTask();
// Cancel the fast alt-tab trigger
mFastAltTabTrigger.stopDozing();
mFastAltTabTrigger.resetTrigger();
return;
}
// Defer to the activity to handle hiding recents, if it handles it, then it must still
// be visible
EventBus.getDefault().post(new HideRecentsEvent(triggeredFromAltTab,
triggeredFromHomeKey));
// Cancel the fast alt-tab trigger
mFastAltTabTrigger.stopDozing();
mFastAltTabTrigger.resetTrigger();
return;
}
// Defer to the activity to handle hiding recents, if it handles it, then it must still
// be visible
EventBus.getDefault().post(new HideRecentsEvent(triggeredFromAltTab,
triggeredFromHomeKey));
}
public void toggleRecents() {
@@ -347,7 +342,6 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
mTriggeredFromAltTab = false;
try {
ViewConfiguration viewConfig = ViewConfiguration.get(mContext);
SystemServicesProxy ssp = Recents.getSystemServices();
ActivityManager.RunningTaskInfo topTask = ssp.getTopMostTask();
MutableBoolean isTopTaskHome = new MutableBoolean(true);

View File

@@ -28,8 +28,10 @@ public class TaskStackUpdatedEvent extends EventBus.AnimatedEvent {
* A new TaskStack instance representing the latest stack state.
*/
public final TaskStack stack;
public final boolean inMultiWindow;
public TaskStackUpdatedEvent(TaskStack stack) {
public TaskStackUpdatedEvent(TaskStack stack, boolean inMultiWindow) {
this.stack = stack;
this.inMultiWindow = inMultiWindow;
}
}

View File

@@ -198,8 +198,8 @@ public class RecentsTaskLoadPlan {
// Add the task to the stack
Task task = new Task(taskKey, t.affiliatedTaskId, t.affiliatedTaskColor, icon,
thumbnail, title, contentDescription, dismissDescription, activityColor,
backgroundColor, !isStackTask, isLaunchTarget, isSystemApp, t.bounds,
t.taskDescription);
backgroundColor, !isStackTask, isLaunchTarget, isSystemApp, t.isDockable,
t.bounds, t.taskDescription);
allTasks.add(task);
affiliatedTaskCounts.put(taskKey.id, affiliatedTaskCounts.get(taskKey.id, 0) + 1);

View File

@@ -168,6 +168,8 @@ public class Task {
public boolean isHistorical;
@ViewDebug.ExportedProperty(category="recents")
public boolean isSystemApp;
@ViewDebug.ExportedProperty(category="recents")
public boolean isDockable;
private ArrayList<TaskCallbacks> mCallbacks = new ArrayList<>();
@@ -178,8 +180,8 @@ public class Task {
public Task(TaskKey key, int affiliationTaskId, int affiliationColor, Drawable icon,
Bitmap thumbnail, String title, String contentDescription,
String dismissDescription, int colorPrimary, int colorBackground,
boolean isHistorical, boolean isLaunchTarget, boolean isSystemApp, Rect bounds,
ActivityManager.TaskDescription taskDescription) {
boolean isHistorical, boolean isLaunchTarget, boolean isSystemApp,
boolean isDockable, Rect bounds, ActivityManager.TaskDescription taskDescription) {
boolean isInAffiliationGroup = (affiliationTaskId != key.id);
boolean hasAffiliationGroupColor = isInAffiliationGroup && (affiliationColor != 0);
this.key = key;
@@ -199,6 +201,7 @@ public class Task {
this.isLaunchTarget = isLaunchTarget;
this.isHistorical = isHistorical;
this.isSystemApp = isSystemApp;
this.isDockable = isDockable;
}
/** Copies the other task. */
@@ -219,6 +222,7 @@ public class Task {
this.isLaunchTarget = o.isLaunchTarget;
this.isHistorical = o.isHistorical;
this.isSystemApp = o.isSystemApp;
this.isDockable = o.isDockable;
}
/**

View File

@@ -663,8 +663,10 @@ public class RecentsView extends FrameLayout {
}
public final void onBusEvent(TaskStackUpdatedEvent event) {
mStack.setTasks(event.stack.computeAllTasksList(), true /* notifyStackChanges */);
mStack.createAffiliatedGroupings(getContext());
if (!event.inMultiWindow) {
mStack.setTasks(event.stack.computeAllTasksList(), true /* notifyStackChanges */);
mStack.createAffiliatedGroupings(getContext());
}
}
public final void onBusEvent(EnterRecentsWindowAnimationCompletedEvent event) {

View File

@@ -21,7 +21,9 @@ import android.graphics.Point;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
import android.view.ViewDebug;
import android.widget.Toast;
import com.android.systemui.R;
import com.android.systemui.recents.Recents;
import com.android.systemui.recents.RecentsConfiguration;
import com.android.systemui.recents.events.EventBus;
@@ -148,11 +150,16 @@ public class RecentsViewTouchHandler {
mVisibleDockStates.clear();
if (!ssp.hasDockedTask() && mRv.getTaskStack().getTaskCount() > 1) {
// Add the dock state drop targets (these take priority)
TaskStack.DockState[] dockStates = getDockStatesForCurrentOrientation();
for (TaskStack.DockState dockState : dockStates) {
registerDropTargetForCurrentDrag(dockState);
mVisibleDockStates.add(dockState);
if (!event.task.isDockable) {
Toast.makeText(mRv.getContext(), R.string.recents_drag_non_dockable_task_message,
Toast.LENGTH_SHORT).show();
} else {
// Add the dock state drop targets (these take priority)
TaskStack.DockState[] dockStates = getDockStatesForCurrentOrientation();
for (TaskStack.DockState dockState : dockStates) {
registerDropTargetForCurrentDrag(dockState);
mVisibleDockStates.add(dockState);
}
}
}

View File

@@ -1573,6 +1573,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
Task launchTask = mStack.getStackTasks().get(launchTaskIndex);
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());
}
}
@@ -1830,12 +1833,28 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
public final void onBusEvent(TaskStackUpdatedEvent event) {
// Scroll the stack to the front after it has been updated
if (!event.inMultiWindow) {
// Scroll the stack to the front after it has been updated
event.addPostAnimationCallback(new Runnable() {
@Override
public void run() {
mStackScroller.animateScroll(mLayoutAlgorithm.mMaxScrollP,
null /* postScrollRunnable */);
}
});
}
// When the multi-window state changes, rebind all task view headers again to update their
// dockable state
event.addPostAnimationCallback(new Runnable() {
@Override
public void run() {
mStackScroller.animateScroll(mLayoutAlgorithm.mMaxScrollP,
null /* postScrollRunnable */);
List<TaskView> taskViews = getTaskViews();
int taskViewCount = taskViews.size();
for (int i = 0; i < taskViewCount; i++) {
TaskView tv = taskViews.get(i);
tv.getHeaderView().rebindToTask(tv.getTask(), tv.mTouchExplorationEnabled,
tv.mIsDisabledInSafeMode);
}
}
});
}

View File

@@ -139,6 +139,7 @@ public class TaskViewHeader extends FrameLayout
// Header views
ImageView mIconView;
TextView mTitleView;
TextView mSubTitleView;
ImageView mMoveTaskButton;
ImageView mDismissButton;
ViewStub mAppOverlayViewStub;
@@ -237,6 +238,7 @@ public class TaskViewHeader extends FrameLayout
mIconView.setClickable(false);
mIconView.setOnLongClickListener(this);
mTitleView = (TextView) findViewById(R.id.title);
mSubTitleView = (TextView) findViewById(R.id.sub_title);
mDismissButton = (ImageView) findViewById(R.id.dismiss_task);
if (ssp.hasFreeformWorkspaceSupport()) {
mMoveTaskButton = (ImageView) findViewById(R.id.move_task);
@@ -367,6 +369,7 @@ public class TaskViewHeader extends FrameLayout
/** Binds the bar view to the task */
public void rebindToTask(Task t, boolean touchExplorationEnabled, boolean disabledInSafeMode) {
SystemServicesProxy ssp = Recents.getSystemServices();
mTask = t;
// If an activity icon is defined, then we use that as the primary icon to show in the bar,
@@ -384,6 +387,13 @@ public class TaskViewHeader extends FrameLayout
mTitleView.setContentDescription(t.contentDescription);
mTitleView.setTextColor(t.useLightOnPrimaryColor ?
mTaskBarViewLightTextColor : mTaskBarViewDarkTextColor);
if (!t.isDockable && ssp.hasDockedTask()) {
mSubTitleView.setVisibility(View.VISIBLE);
mSubTitleView.setTextColor(t.useLightOnPrimaryColor ?
mTaskBarViewLightTextColor : mTaskBarViewDarkTextColor);
} else {
mSubTitleView.setVisibility(View.GONE);
}
mDismissButton.setImageDrawable(t.useLightOnPrimaryColor ?
mLightDismissDrawable : mDarkDismissDrawable);
mDismissButton.setContentDescription(t.dismissDescription);

View File

@@ -447,5 +447,8 @@ message MetricsEvent {
// Logs the action the user takes when an app ANR'd.
ACTION_APP_ANR = 317;
// Logged when a user double taps the overview button to launch the previous task
OVERVIEW_LAUNCH_PREVIOUS_TASK = 318;
}
}