* commit '3cb55598500be4cb3ae654cc2950a9338fb01a6a': Fix issue #5139085: Some Recents items can't be killed
This commit is contained in:
@@ -96,11 +96,13 @@ public class RecentsPanelView extends RelativeLayout
|
||||
/* package */ final class ActivityDescription {
|
||||
final ActivityManager.RecentTaskInfo recentTaskInfo;
|
||||
final ResolveInfo resolveInfo;
|
||||
int taskId; // application task id for curating apps
|
||||
Intent intent; // launch intent for application
|
||||
final int taskId; // application task id for curating apps
|
||||
final int persistentTaskId; // persistent id
|
||||
final Intent intent; // launch intent for application
|
||||
final String packageName; // used to override animations (see onClick())
|
||||
final int position; // position in list
|
||||
|
||||
Matrix matrix; // arbitrary rotation matrix to correct orientation
|
||||
String packageName; // used to override animations (see onClick())
|
||||
int position; // position in list
|
||||
|
||||
private Bitmap mThumbnail; // generated by Activity.onCreateThumbnail()
|
||||
private Drawable mIcon; // application package icon
|
||||
@@ -108,11 +110,12 @@ public class RecentsPanelView extends RelativeLayout
|
||||
|
||||
public ActivityDescription(ActivityManager.RecentTaskInfo _recentInfo,
|
||||
ResolveInfo _resolveInfo, Intent _intent,
|
||||
int _id, int _pos, String _packageName) {
|
||||
int _pos, String _packageName) {
|
||||
recentTaskInfo = _recentInfo;
|
||||
resolveInfo = _resolveInfo;
|
||||
intent = _intent;
|
||||
taskId = _id;
|
||||
taskId = _recentInfo.id;
|
||||
persistentTaskId = _recentInfo.persistentId;
|
||||
position = _pos;
|
||||
packageName = _packageName;
|
||||
}
|
||||
@@ -496,17 +499,17 @@ public class RecentsPanelView extends RelativeLayout
|
||||
final String title = info.loadLabel(pm).toString();
|
||||
// Drawable icon = info.loadIcon(pm);
|
||||
Drawable icon = getFullResIcon(resolveInfo, pm);
|
||||
int id = recentInfo.id;
|
||||
if (title != null && title.length() > 0 && icon != null) {
|
||||
if (DEBUG) Log.v(TAG, "creating activity desc for id=" + id + ", label=" + title);
|
||||
if (DEBUG) Log.v(TAG, "creating activity desc for id="
|
||||
+ recentInfo.id + ", label=" + title);
|
||||
ActivityManager.TaskThumbnails thumbs = am.getTaskThumbnails(
|
||||
recentInfo.persistentId);
|
||||
ActivityDescription item = new ActivityDescription(recentInfo,
|
||||
resolveInfo, intent, id, index, info.packageName);
|
||||
resolveInfo, intent, index, info.packageName);
|
||||
activityDescriptions.add(item);
|
||||
++index;
|
||||
} else {
|
||||
if (DEBUG) Log.v(TAG, "SKIPPING item " + id);
|
||||
if (DEBUG) Log.v(TAG, "SKIPPING item " + recentInfo.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -727,7 +730,7 @@ public class RecentsPanelView extends RelativeLayout
|
||||
// the task.
|
||||
final ActivityManager am = (ActivityManager)
|
||||
mContext.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
am.removeTask(ad.taskId, ActivityManager.REMOVE_TASK_KILL_PROCESS);
|
||||
am.removeTask(ad.persistentTaskId, ActivityManager.REMOVE_TASK_KILL_PROCESS);
|
||||
}
|
||||
|
||||
private void startApplicationDetailsActivity(String packageName) {
|
||||
|
||||
@@ -5171,6 +5171,29 @@ public final class ActivityManagerService extends ActivityManagerNative
|
||||
cleanUpRemovedTaskLocked(r,
|
||||
(flags&ActivityManager.REMOVE_TASK_KILL_PROCESS) != 0);
|
||||
return true;
|
||||
} else {
|
||||
TaskRecord tr = null;
|
||||
int i=0;
|
||||
while (i < mRecentTasks.size()) {
|
||||
TaskRecord t = mRecentTasks.get(i);
|
||||
if (t.taskId == taskId) {
|
||||
tr = t;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (tr != null) {
|
||||
if (tr.numActivities <= 0) {
|
||||
// Caller is just removing a recent task that is
|
||||
// not actively running. That is easy!
|
||||
mRecentTasks.remove(i);
|
||||
} else {
|
||||
Slog.w(TAG, "removeTask: task " + taskId
|
||||
+ " does not have activities to remove, "
|
||||
+ " but numActivities=" + tr.numActivities
|
||||
+ ": " + tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(ident);
|
||||
|
||||
Reference in New Issue
Block a user