diff options
| -rw-r--r-- | core/java/android/app/ActivityManager.java | 2 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/recents/Recents.java | 43 |
2 files changed, 28 insertions, 17 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index f64bf1dd1226..2f6907e3f31e 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -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>() { diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java index 54bf68bcb678..efac0fb3d90a 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java @@ -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 |