Merge "Don\'t dock tasks that are non-dockable" into nyc-dev

am: f2d7b28115

* commit 'f2d7b28115773b324a27173ef31c3e58ce3487a7':
  Don't dock tasks that are non-dockable
This commit is contained in:
Jorim Jaggi
2016-03-08 15:34:30 +00:00
committed by android-build-merger
2 changed files with 28 additions and 17 deletions

View File

@@ -1575,6 +1575,7 @@ public class ActivityManager {
Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
dest.writeInt(numActivities);
dest.writeInt(numRunning);
dest.writeInt(isDockable ? 1 : 0);
}
public void readFromParcel(Parcel source) {
@@ -1590,6 +1591,7 @@ public class ActivityManager {
description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
numActivities = source.readInt();
numRunning = source.readInt();
isDockable = source.readInt() != 0;
}
public static final Creator<RunningTaskInfo> CREATOR = new Creator<RunningTaskInfo>() {

View File

@@ -35,9 +35,11 @@ import android.util.EventLog;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.widget.Toast;
import com.android.systemui.EventLogConstants;
import com.android.systemui.EventLogTags;
import com.android.systemui.R;
import com.android.systemui.RecentsComponent;
import com.android.systemui.SystemUI;
import com.android.systemui.recents.events.EventBus;
@@ -393,28 +395,35 @@ public class Recents extends SystemUI
boolean screenPinningActive = ssp.isScreenPinningActive();
boolean isTopTaskHome = topTask != null && SystemServicesProxy.isHomeStack(topTask.stackId);
if (topTask != null && !isTopTaskHome && !screenPinningActive) {
if (sSystemServicesProxy.isSystemUser(currentUser)) {
mImpl.dockTopTask(topTask.id, dragMode, stackCreateMode, initialBounds);
} else {
if (mSystemToUserCallbacks != null) {
IRecentsNonSystemUserCallbacks callbacks =
mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
if (callbacks != null) {
try {
callbacks.dockTopTask(topTask.id, dragMode, stackCreateMode,
initialBounds);
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
if (topTask.isDockable) {
if (sSystemServicesProxy.isSystemUser(currentUser)) {
mImpl.dockTopTask(topTask.id, dragMode, stackCreateMode, initialBounds);
} else {
if (mSystemToUserCallbacks != null) {
IRecentsNonSystemUserCallbacks callbacks =
mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
if (callbacks != null) {
try {
callbacks.dockTopTask(topTask.id, dragMode, stackCreateMode,
initialBounds);
} catch (RemoteException e) {
Log.e(TAG, "Callback failed", e);
}
} else {
Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
}
} else {
Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
}
}
mDraggingInRecentsCurrentUser = currentUser;
return true;
} else {
Toast.makeText(mContext, R.string.recents_drag_non_dockable_task_message,
Toast.LENGTH_SHORT).show();
return false;
}
mDraggingInRecentsCurrentUser = currentUser;
return true;
} else {
return false;
}
return false;
}
@Override