diff options
10 files changed, 154 insertions, 527 deletions
diff --git a/packages/SystemUI/res/layout/recents.xml b/packages/SystemUI/res/layout/recents.xml index 26523f9..bdda527 100644 --- a/packages/SystemUI/res/layout/recents.xml +++ b/packages/SystemUI/res/layout/recents.xml @@ -32,12 +32,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:focusable="true"> - <!-- MultiStack Debug View --> - <ViewStub android:id="@+id/multistack_debug_view_stub" - android:layout="@layout/recents_multistack_debug" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="left|bottom" /> </com.android.systemui.recents.views.RecentsView> <!-- Empty View --> diff --git a/packages/SystemUI/res/layout/recents_multistack_debug.xml b/packages/SystemUI/res/layout/recents_multistack_debug.xml deleted file mode 100644 index 6524a54..0000000 --- a/packages/SystemUI/res/layout/recents_multistack_debug.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2014 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="left|bottom" - android:orientation="vertical"> - <Button - android:id="@+id/add_stack" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:gravity="center" - android:padding="8dp" - android:textSize="20sp" - android:textColor="#ffffffff" - android:text="@string/recents_multistack_add_stack" - android:fontFamily="sans-serif" - android:background="#000000" - android:alpha="0.5" /> - <Button - android:id="@+id/resize_stack" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:gravity="center" - android:padding="8dp" - android:textSize="20sp" - android:textColor="#ffffffff" - android:text="@string/recents_multistack_resize_stack" - android:fontFamily="sans-serif" - android:background="#000000" - android:alpha="0.5" /> -</LinearLayout>
\ No newline at end of file diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 2d87e8f..66d494b 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -682,12 +682,6 @@ <!-- Recents: Dismiss all button. [CHAR LIMIT=NONE] --> <string name="recents_dismiss_all_message">Dismiss all applications</string> - <!-- Recents: MultiStack add stack button. [CHAR LIMIT=NONE] --> - <string name="recents_multistack_add_stack">+</string> - <!-- Recents: MultiStack remove stack button. [CHAR LIMIT=NONE] --> - <string name="recents_multistack_remove_stack">-</string> - <!-- Recents: MultiStack resize stack button. [CHAR LIMIT=NONE] --> - <string name="recents_multistack_resize_stack">[]</string> <!-- Recents: MultiStack add stack split horizontal radio button. [CHAR LIMIT=NONE] --> <string name="recents_multistack_add_stack_dialog_split_horizontal">Split Horizontal</string> <!-- Recents: MultiStack add stack split vertical radio button. [CHAR LIMIT=NONE] --> diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index 1561f70..1248672 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java @@ -74,8 +74,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView View mEmptyView; DebugOverlayView mDebugOverlay; - // MultiStack debug - RecentsMultiStackDialog mMultiStackDebugDialog; + // Resize task debug + RecentsResizeTaskDialog mResizeTaskDebugDialog; // Search AppWidget RecentsAppWidgetHost mAppWidgetHost; @@ -592,37 +592,18 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView } - /**** RecentsMultiStackDialog ****/ + /**** RecentsResizeTaskDialog ****/ - private RecentsMultiStackDialog getMultiStackDebugDialog() { - if (mMultiStackDebugDialog == null) { - mMultiStackDebugDialog = new RecentsMultiStackDialog(getFragmentManager()); + private RecentsResizeTaskDialog getResizeTaskDebugDialog() { + if (mResizeTaskDebugDialog == null) { + mResizeTaskDebugDialog = new RecentsResizeTaskDialog(getFragmentManager()); } - return mMultiStackDebugDialog; + return mResizeTaskDebugDialog; } @Override - public void onMultiStackAddStack() { - RecentsMultiStackDialog dialog = getMultiStackDebugDialog(); - dialog.showAddStackDialog(); - } - - @Override - public void onMultiStackResizeStack() { - RecentsMultiStackDialog dialog = getMultiStackDebugDialog(); - dialog.showResizeStackDialog(); - } - - @Override - public void onMultiStackRemoveStack() { - RecentsMultiStackDialog dialog = getMultiStackDebugDialog(); - dialog.showRemoveStackDialog(); - } - - @Override - public void onMultiStackMoveTask(Task t) { - RecentsMultiStackDialog dialog = getMultiStackDebugDialog(); - dialog.showMoveTaskDialog(t); + public void onTaskResize(Task t) { + getResizeTaskDebugDialog().showResizeTaskDialog(t); } /**** RecentsView.RecentsViewCallbacks Implementation ****/ diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsMultiStackDialog.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsMultiStackDialog.java deleted file mode 100644 index fdf9d39..0000000 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsMultiStackDialog.java +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.systemui.recents; - -import android.app.ActivityManager; -import android.app.AlertDialog; -import android.app.Dialog; -import android.app.DialogFragment; -import android.app.FragmentManager; -import android.content.ComponentName; -import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; -import android.content.pm.ActivityInfo; -import android.content.pm.ResolveInfo; -import android.graphics.Rect; -import android.os.Bundle; -import android.util.MutableInt; -import android.util.SparseArray; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.EditText; -import android.widget.Toast; -import com.android.systemui.R; -import com.android.systemui.recents.misc.SystemServicesProxy; -import com.android.systemui.recents.model.RecentsTaskLoader; -import com.android.systemui.recents.model.Task; - -import java.util.List; - -/** - * A helper for the dialogs that show when multistack debugging is on. - */ -public class RecentsMultiStackDialog extends DialogFragment { - - static final String TAG = "RecentsMultiStackDialog"; - - public static final int ADD_STACK_DIALOG = 0; - public static final int ADD_STACK_PICK_APP_DIALOG = 1; - public static final int REMOVE_STACK_DIALOG = 2; - public static final int RESIZE_STACK_DIALOG = 3; - public static final int RESIZE_STACK_PICK_STACK_DIALOG = 4; - public static final int MOVE_TASK_DIALOG = 5; - - FragmentManager mFragmentManager; - int mCurrentDialogType; - MutableInt mTargetStackIndex = new MutableInt(0); - Task mTaskToMove; - SparseArray<ActivityManager.StackInfo> mStacks; - List<ResolveInfo> mLauncherActivities; - Rect mAddStackRect; - Intent mAddStackIntent; - - View mAddStackDialogContent; - - public RecentsMultiStackDialog() {} - - public RecentsMultiStackDialog(FragmentManager mgr) { - mFragmentManager = mgr; - } - - /** Shows the add-stack dialog. */ - void showAddStackDialog() { - mCurrentDialogType = ADD_STACK_DIALOG; - show(mFragmentManager, TAG); - } - - /** Creates a new add-stack dialog. */ - private void createAddStackDialog(final Context context, LayoutInflater inflater, - AlertDialog.Builder builder, final SystemServicesProxy ssp) { - builder.setTitle("Add Stack - Enter new dimensions"); - mAddStackDialogContent = - inflater.inflate(R.layout.recents_multistack_stack_size_dialog, null, false); - Rect windowRect = ssp.getWindowRect(); - setDimensionInEditText(mAddStackDialogContent, R.id.inset_left, windowRect.left); - setDimensionInEditText(mAddStackDialogContent, R.id.inset_top, windowRect.top); - setDimensionInEditText(mAddStackDialogContent, R.id.inset_right, windowRect.right); - setDimensionInEditText(mAddStackDialogContent, R.id.inset_bottom, windowRect.bottom); - builder.setView(mAddStackDialogContent); - builder.setPositiveButton("Add Stack", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - int left = getDimensionFromEditText(mAddStackDialogContent, R.id.inset_left); - int top = getDimensionFromEditText(mAddStackDialogContent, R.id.inset_top); - int right = getDimensionFromEditText(mAddStackDialogContent, R.id.inset_right); - int bottom = getDimensionFromEditText(mAddStackDialogContent, R.id.inset_bottom); - if (bottom <= top || right <= left) { - Toast.makeText(context, "Invalid dimensions", Toast.LENGTH_SHORT).show(); - dismiss(); - return; - } - - // Prompt the user for the app to start - dismiss(); - mCurrentDialogType = ADD_STACK_PICK_APP_DIALOG; - mAddStackRect = new Rect(left, top, right, bottom); - show(mFragmentManager, TAG); - } - }); - builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dismiss(); - } - }); - } - - /** Creates a new add-stack pick-app dialog. */ - private void createAddStackPickAppDialog(final Context context, LayoutInflater inflater, - AlertDialog.Builder builder, final SystemServicesProxy ssp) { - mLauncherActivities = ssp.getLauncherApps(); - mAddStackIntent = null; - int activityCount = mLauncherActivities.size(); - CharSequence[] activityNames = new CharSequence[activityCount]; - for (int i = 0; i < activityCount; i++) { - activityNames[i] = ssp.getActivityLabel(mLauncherActivities.get(i).activityInfo); - } - builder.setTitle("Add Stack - Pick starting app"); - builder.setSingleChoiceItems(activityNames, -1, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - ActivityInfo ai = mLauncherActivities.get(which).activityInfo; - mAddStackIntent = new Intent(Intent.ACTION_MAIN); - mAddStackIntent.addCategory(Intent.CATEGORY_LAUNCHER); - mAddStackIntent.setComponent(new ComponentName(ai.packageName, ai.name)); - } - }); - builder.setPositiveButton("Add Stack", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - // Display 0 = default display - ssp.createNewStack(0, mAddStackRect, mAddStackIntent); - } - }); - builder.setNegativeButton("Skip", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - // Display 0 = default display - ssp.createNewStack(0, mAddStackRect, null); - } - }); - } - - /** Shows the resize-stack dialog. */ - void showResizeStackDialog() { - mCurrentDialogType = RESIZE_STACK_PICK_STACK_DIALOG; - show(mFragmentManager, TAG); - } - - /** Creates a new resize-stack pick-stack dialog. */ - private void createResizeStackPickStackDialog(final Context context, LayoutInflater inflater, - AlertDialog.Builder builder, final SystemServicesProxy ssp) { - mStacks = ssp.getAllStackInfos(); - mTargetStackIndex.value = -1; - CharSequence[] stackNames = getAllStacksDescriptions(mStacks, -1, null); - builder.setTitle("Resize Stack - Pick stack"); - builder.setSingleChoiceItems(stackNames, mTargetStackIndex.value, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - mTargetStackIndex.value = which; - } - }); - builder.setPositiveButton("Resize Stack", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - if (mTargetStackIndex.value != -1) { - // Prompt the user for the new dimensions - dismiss(); - mCurrentDialogType = RESIZE_STACK_DIALOG; - show(mFragmentManager, TAG); - } - } - }); - builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dismiss(); - } - }); - } - - /** Creates a new resize-stack dialog. */ - private void createResizeStackDialog(final Context context, LayoutInflater inflater, - AlertDialog.Builder builder, final SystemServicesProxy ssp) { - builder.setTitle("Resize Stack - Enter new dimensions"); - final ActivityManager.StackInfo stack = mStacks.valueAt(mTargetStackIndex.value); - mAddStackDialogContent = - inflater.inflate(R.layout.recents_multistack_stack_size_dialog, null, false); - setDimensionInEditText(mAddStackDialogContent, R.id.inset_left, stack.bounds.left); - setDimensionInEditText(mAddStackDialogContent, R.id.inset_top, stack.bounds.top); - setDimensionInEditText(mAddStackDialogContent, R.id.inset_right, stack.bounds.right); - setDimensionInEditText(mAddStackDialogContent, R.id.inset_bottom, stack.bounds.bottom); - builder.setView(mAddStackDialogContent); - builder.setPositiveButton("Resize Stack", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - int left = getDimensionFromEditText(mAddStackDialogContent, R.id.inset_left); - int top = getDimensionFromEditText(mAddStackDialogContent, R.id.inset_top); - int right = getDimensionFromEditText(mAddStackDialogContent, R.id.inset_right); - int bottom = getDimensionFromEditText(mAddStackDialogContent, R.id.inset_bottom); - if (bottom <= top || right <= left) { - Toast.makeText(context, "Invalid dimensions", Toast.LENGTH_SHORT).show(); - dismiss(); - return; - } - ssp.resizeStack(stack.stackId, new Rect(left, top, right, bottom)); - } - }); - builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dismiss(); - } - }); - } - - /** Shows the remove-stack dialog. */ - void showRemoveStackDialog() { - mCurrentDialogType = REMOVE_STACK_DIALOG; - show(mFragmentManager, TAG); - } - - /** Shows the move-task dialog. */ - void showMoveTaskDialog(Task task) { - mCurrentDialogType = MOVE_TASK_DIALOG; - mTaskToMove = task; - show(mFragmentManager, TAG); - } - - /** Creates a new move-stack dialog. */ - private void createMoveTaskDialog(final Context context, LayoutInflater inflater, - AlertDialog.Builder builder, final SystemServicesProxy ssp) { - mStacks = ssp.getAllStackInfos(); - mTargetStackIndex.value = -1; - CharSequence[] stackNames = getAllStacksDescriptions(mStacks, mTaskToMove.key.stackId, - mTargetStackIndex); - builder.setTitle("Move Task to Stack"); - builder.setSingleChoiceItems(stackNames, mTargetStackIndex.value, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - mTargetStackIndex.value = which; - } - }); - builder.setPositiveButton("Move Task", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - if (mTargetStackIndex.value != -1) { - ActivityManager.StackInfo toStack = mStacks.valueAt(mTargetStackIndex.value); - if (toStack.stackId != mTaskToMove.key.stackId) { - ssp.moveTaskToStack(mTaskToMove.key.id, toStack.stackId, true); - mTaskToMove.setStackId(toStack.stackId); - } - } - } - }); - builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dismiss(); - } - }); - } - - /** Helper to get an integer value from an edit text. */ - private int getDimensionFromEditText(View container, int id) { - String text = ((EditText) container.findViewById(id)).getText().toString(); - if (text.trim().length() != 0) { - return Integer.parseInt(text.trim()); - } - return 0; - } - - /** Helper to set an integer value to an edit text. */ - private void setDimensionInEditText(View container, int id, int value) { - ((EditText) container.findViewById(id)).setText("" + value); - } - - /** Gets a list of all the stacks. */ - private CharSequence[] getAllStacksDescriptions(SparseArray<ActivityManager.StackInfo> stacks, - int targetStackId, MutableInt indexOfTargetStackId) { - int stackCount = stacks.size(); - CharSequence[] stackNames = new CharSequence[stackCount]; - for (int i = 0; i < stackCount; i++) { - ActivityManager.StackInfo stack = stacks.valueAt(i); - Rect b = stack.bounds; - String desc = "Stack " + stack.stackId + " / " + - "" + (stack.taskIds.length > 0 ? stack.taskIds.length : "No") + " tasks\n" + - "(" + b.left + ", " + b.top + ")-(" + b.right + ", " + b.bottom + ")\n"; - stackNames[i] = desc; - if (targetStackId != -1 && stack.stackId == targetStackId) { - indexOfTargetStackId.value = i; - } - } - return stackNames; - } - - @Override - public Dialog onCreateDialog(Bundle args) { - final Context context = this.getActivity(); - final SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); - LayoutInflater inflater = getActivity().getLayoutInflater(); - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - switch(mCurrentDialogType) { - case ADD_STACK_DIALOG: - createAddStackDialog(context, inflater, builder, ssp); - break; - case ADD_STACK_PICK_APP_DIALOG: - createAddStackPickAppDialog(context, inflater, builder, ssp); - break; - case MOVE_TASK_DIALOG: - createMoveTaskDialog(context, inflater, builder, ssp); - break; - case RESIZE_STACK_PICK_STACK_DIALOG: - createResizeStackPickStackDialog(context, inflater, builder, ssp); - break; - case RESIZE_STACK_DIALOG: - createResizeStackDialog(context, inflater, builder, ssp); - break; - } - return builder.create(); - } -} diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsResizeTaskDialog.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsResizeTaskDialog.java new file mode 100644 index 0000000..d67eceb --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsResizeTaskDialog.java @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.recents; + +import android.app.ActivityManager; +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.DialogFragment; +import android.app.FragmentManager; +import android.content.ComponentName; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.pm.ActivityInfo; +import android.content.pm.ResolveInfo; +import android.graphics.Rect; +import android.os.Bundle; +import android.util.MutableInt; +import android.util.SparseArray; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.EditText; +import android.widget.Toast; +import com.android.systemui.R; +import com.android.systemui.recents.misc.SystemServicesProxy; +import com.android.systemui.recents.model.RecentsTaskLoader; +import com.android.systemui.recents.model.Task; + +import java.util.List; + +/** + * A helper for the dialogs that show when task debugging is on. + */ +public class RecentsResizeTaskDialog extends DialogFragment { + + static final String TAG = "RecentsResizeTaskDialog"; + + // The task we want to resize. + Task mTaskToResize; + FragmentManager mFragmentManager; + View mResizeTaskDialogContent; + + public RecentsResizeTaskDialog() {} + + public RecentsResizeTaskDialog(FragmentManager mgr) { + mFragmentManager = mgr; + } + + /** Shows the resize-task dialog. */ + void showResizeTaskDialog(Task t) { + mTaskToResize = t; + show(mFragmentManager, TAG); + } + + /** Creates a new resize-task dialog. */ + private void createResizeTaskDialog(final Context context, LayoutInflater inflater, + AlertDialog.Builder builder, final SystemServicesProxy ssp) { + builder.setTitle("Resize Task - Enter new dimensions"); + mResizeTaskDialogContent = + inflater.inflate(R.layout.recents_multistack_stack_size_dialog, null, false); + Rect bounds = ssp.getTaskBounds(mTaskToResize.key.stackId); + setDimensionInEditText(mResizeTaskDialogContent, R.id.inset_left, bounds.left); + setDimensionInEditText(mResizeTaskDialogContent, R.id.inset_top, bounds.top); + setDimensionInEditText(mResizeTaskDialogContent, R.id.inset_right, bounds.right); + setDimensionInEditText(mResizeTaskDialogContent, R.id.inset_bottom, bounds.bottom); + builder.setView(mResizeTaskDialogContent); + builder.setPositiveButton("Resize Task", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + int left = getDimensionFromEditText(mResizeTaskDialogContent, R.id.inset_left); + int top = getDimensionFromEditText(mResizeTaskDialogContent, R.id.inset_top); + int right = getDimensionFromEditText(mResizeTaskDialogContent, R.id.inset_right); + int bottom = getDimensionFromEditText(mResizeTaskDialogContent, R.id.inset_bottom); + if (bottom <= top || right <= left) { + Toast.makeText(context, "Invalid dimensions", Toast.LENGTH_SHORT).show(); + dismiss(); + return; + } + ssp.resizeTask(mTaskToResize.key.id, new Rect(left, top, right, bottom)); + dismiss(); + } + }); + builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dismiss(); + } + }); + } + + /** Helper to get an integer value from an edit text. */ + private int getDimensionFromEditText(View container, int id) { + String text = ((EditText) container.findViewById(id)).getText().toString(); + if (text.trim().length() != 0) { + return Integer.parseInt(text.trim()); + } + return 0; + } + + /** Helper to set an integer value to an edit text. */ + private void setDimensionInEditText(View container, int id, int value) { + ((EditText) container.findViewById(id)).setText("" + value); + } + + @Override + public Dialog onCreateDialog(Bundle args) { + final Context context = this.getActivity(); + final SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); + LayoutInflater inflater = getActivity().getLayoutInflater(); + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + createResizeTaskDialog(context, inflater, builder, ssp); + return builder.create(); + } +} diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java index 72040fe..a473a29 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java +++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java @@ -233,23 +233,6 @@ public class SystemServicesProxy { return null; } - /** Returns a list of all the launcher apps sorted by name. */ - public List<ResolveInfo> getLauncherApps() { - if (mPm == null) return new ArrayList<ResolveInfo>(); - - final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); - mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); - List<ResolveInfo> activities = mPm.queryIntentActivities(mainIntent, 0 /* flags */); - Collections.sort(activities, new Comparator<ResolveInfo>() { - @Override - public int compare(ResolveInfo o1, ResolveInfo o2) { - return getActivityLabel(o1.activityInfo).compareTo( - getActivityLabel(o2.activityInfo)); - } - }); - return activities; - } - /** Returns whether the recents is currently running */ public boolean isRecentsTopMost(ActivityManager.RunningTaskInfo topTask, AtomicBoolean isHomeTopMost) { @@ -272,27 +255,20 @@ public class SystemServicesProxy { return false; } - /** Create a new stack. */ - public void createNewStack(int displayId, Rect bounds, Intent activity) { - try { - IActivityContainer container = mIam.createStackOnDisplay(displayId); - if (container != null) { - // Resize the stack - resizeStack(container.getStackId(), bounds); - // Start the new activity on that stack - container.startActivity(activity); - } - } catch (RemoteException e) { - e.printStackTrace(); - } + /** Get the bounds of a stack / task. */ + public Rect getTaskBounds(int stackId) { + ActivityManager.StackInfo info = getAllStackInfos().get(stackId); + if (info != null) + return getAllStackInfos().get(stackId).bounds; + return new Rect(); } - /** Resizes a stack. */ - public void resizeStack(int stackId, Rect bounds) { + /** Resize a given task. */ + public void resizeTask(int taskId, Rect bounds) { if (mIam == null) return; try { - mIam.resizeStack(stackId, bounds); + mIam.resizeTask(taskId, bounds); } catch (RemoteException e) { e.printStackTrace(); } @@ -406,18 +382,6 @@ public class SystemServicesProxy { } } - /** Moves a task to another stack. */ - public void moveTaskToStack(int taskId, int stackId, boolean toTop) { - if (mIam == null) return; - if (Constants.DebugFlags.App.EnableSystemServicesProxy) return; - - try { - mIam.moveTaskToStack(taskId, stackId, toTop); - } catch (RemoteException e) { - e.printStackTrace(); - } - } - /** Removes the task */ public void removeTask(int taskId) { if (mAm == null) return; diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java index d46e41b..448a7a9 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java @@ -59,17 +59,12 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV public void onExitToHomeAnimationTriggered(); public void onScreenPinningRequest(); - public void onMultiStackAddStack(); - public void onMultiStackResizeStack(); - public void onMultiStackRemoveStack(); - public void onMultiStackMoveTask(Task t); + public void onTaskResize(Task t); } RecentsConfiguration mConfig; LayoutInflater mInflater; DebugOverlayView mDebugOverlay; - ViewStub mMultiStackDebugStub; - View mMultiStackDebugView; RecentsViewLayoutAlgorithm mLayoutAlgorithm; ArrayList<TaskStack> mStacks; @@ -96,28 +91,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV mLayoutAlgorithm = new RecentsViewLayoutAlgorithm(mConfig); } - @Override - protected void onFinishInflate() { - if (!mConfig.multiStackEnabled) return; - - mMultiStackDebugStub = (ViewStub) findViewById(R.id.multistack_debug_view_stub); - if (mMultiStackDebugView == null) { - mMultiStackDebugView = mMultiStackDebugStub.inflate(); - mMultiStackDebugView.findViewById(R.id.add_stack).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - mCb.onMultiStackAddStack(); - } - }); - mMultiStackDebugView.findViewById(R.id.resize_stack).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - mCb.onMultiStackResizeStack(); - } - }); - } - } - /** Sets the callbacks */ public void setCallbacks(RecentsViewCallbacks cb) { mCb = cb; @@ -167,11 +140,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV } } - // Bring the debug view to the front - if (mMultiStackDebugView != null) { - mMultiStackDebugView.bringToFront(); - } - // Trigger a new layout requestLayout(); } @@ -330,11 +298,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV } } - // Measure the multistack debug view - if (mMultiStackDebugView != null) { - mMultiStackDebugView.measure(width, height); - } - setMeasuredDimension(width, height); } @@ -363,18 +326,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV top + stackView.getMeasuredHeight()); } } - - // Layout the multistack debug view - if (mMultiStackDebugView != null) { - Rect taskStackBounds = new Rect(); - mConfig.getAvailableTaskStackBounds(getMeasuredWidth(), getMeasuredHeight(), - mConfig.systemInsets.top, mConfig.systemInsets.right, taskStackBounds); - mMultiStackDebugView.layout(left, - taskStackBounds.bottom - mConfig.systemInsets.bottom - - mMultiStackDebugView.getMeasuredHeight(), - left + mMultiStackDebugView.getMeasuredWidth(), - taskStackBounds.bottom - mConfig.systemInsets.bottom); - } } @Override @@ -638,9 +589,9 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV } @Override - public void onMultiStackMoveTask(Task t) { + public void onTaskResize(Task t) { if (mCb != null) { - mCb.onMultiStackMoveTask(t); + mCb.onTaskResize(t); } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java index 21975b0..e81a1d0 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java @@ -61,7 +61,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal public void onTaskStackFilterTriggered(); public void onTaskStackUnfilterTriggered(); - public void onMultiStackMoveTask(Task t); + public void onTaskResize(Task t); } RecentsConfiguration mConfig; @@ -1339,9 +1339,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal } @Override - public void onMultiStackMoveTask(TaskView tv) { + public void onTaskResize(TaskView tv) { if (mCb != null) { - mCb.onMultiStackMoveTask(tv.getTask()); + mCb.onTaskResize(tv.getTask()); } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java index 098f2f9..682775b 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java @@ -46,7 +46,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, public void onTaskViewClipStateChanged(TaskView tv); public void onTaskViewFocusChanged(TaskView tv, boolean focused); - public void onMultiStackMoveTask(TaskView tv); + public void onTaskResize(TaskView tv); } RecentsConfiguration mConfig; @@ -732,7 +732,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, dismissTask(); } else if (v == mHeaderView.mMoveTaskButton) { if (mCb != null) { - mCb.onMultiStackMoveTask(tv); + mCb.onTaskResize(tv); } } } |