diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-11-12 12:43:22 -0800 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-11-12 12:44:19 -0800 |
commit | b677746bd8cfbf7dc37ebe31c000017a70037b06 (patch) | |
tree | d0a53027bdde97339492c7e23df9df65dc149a82 /packages | |
parent | 83e40921b2475e467ffd9c8aed2dd7f3b206817e (diff) | |
download | frameworks_base-b677746bd8cfbf7dc37ebe31c000017a70037b06.zip frameworks_base-b677746bd8cfbf7dc37ebe31c000017a70037b06.tar.gz frameworks_base-b677746bd8cfbf7dc37ebe31c000017a70037b06.tar.bz2 |
Change recents UIs to do task switches.
When switching to a recent task that is currently active, do a
task switch instead of a start activity, so the activity is brought
back in its exact same state.
Also fix problem in phone recents where the icon would disappear
after you touch it.
Change-Id: Id5c8478f8c33c90f52fbb4d969037d2bf5af9fff
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/recent/RecentApplicationsActivity.java | 13 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java | 20 |
2 files changed, 27 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentApplicationsActivity.java b/packages/SystemUI/src/com/android/systemui/recent/RecentApplicationsActivity.java index faea3fc..ff2a4ed 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentApplicationsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentApplicationsActivity.java @@ -29,6 +29,8 @@ import java.util.List; import android.app.Activity; import android.app.ActivityManager; +import android.app.ActivityManagerNative; +import android.app.IActivityManager; import android.app.IThumbnailReceiver; import android.app.ActivityManager.RunningTaskInfo; import android.content.ActivityNotFoundException; @@ -189,8 +191,15 @@ public class RecentApplicationsActivity extends Activity { public void onCardSelected(int n) { if (n < mActivityDescriptions.size()) { ActivityDescription item = mActivityDescriptions.get(n); - // prepare a launch intent and send it - if (item.intent != null) { + if (item.id >= 0) { + // This is an active task; it should just go to the foreground. + IActivityManager am = ActivityManagerNative.getDefault(); + try { + am.moveTaskToFront(item.id); + } catch (RemoteException e) { + } + } else if (item.intent != null) { + // prepare a launch intent and send it item.intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY); try { if (DBG) Log.v(TAG, "Starting intent " + item.intent); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java index 1831eda..3d4d42c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java @@ -20,6 +20,8 @@ import java.util.ArrayList; import java.util.List; import android.app.ActivityManager; +import android.app.ActivityManagerNative; +import android.app.IActivityManager; import android.app.IThumbnailReceiver; import android.app.ActivityManager.RunningTaskInfo; import android.content.Context; @@ -236,7 +238,7 @@ public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnC appIcon.setImageDrawable(activityDescription.icon); appDescription.setText(activityDescription.label); view.setOnClickListener(this); - view.setTag(activityDescription.intent); + view.setTag(activityDescription); Log.v(TAG, "Adding task: " + activityDescription.label); mRecentsContainer.addView(view); } @@ -247,9 +249,19 @@ public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnC } public void onClick(View v) { - Intent intent = (Intent) v.getTag(); - if (DEBUG) Log.v(TAG, "Starting activity " + intent); - getContext().startActivity(intent); + ActivityDescription ad = (ActivityDescription)v.getTag(); + if (ad.id >= 0) { + // This is an active task; it should just go to the foreground. + IActivityManager am = ActivityManagerNative.getDefault(); + try { + am.moveTaskToFront(ad.id); + } catch (RemoteException e) { + } + } else { + Intent intent = ad.intent; + if (DEBUG) Log.v(TAG, "Starting activity " + intent); + getContext().startActivity(intent); + } mBar.animateCollapse(); } } |