RecentsActivity简介
来源:互联网 发布:轩辕剑神掌进阶数据 编辑:程序博客网 时间:2024/06/05 21:43
RecentsActivity 视图界面通过 RecentsPanelView 呈现;
RecentsPanelView 任务栈信息由 RecentTasksLoader 负责加载;
RecentTasksLoader 中由 ActivityManager 的 getRecentTasks 方法获取最近任务栈信息。
RecentTasksLoader 中获取最近任务栈:
final ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
final List<ActivityManager.RecentTaskInfo> recentTasks = am.getRecentTasks(MAX_TASKS, ActivityManager.RECENT_IGNORE_UNAVAILABLE);
参数2说明:
/**
* Flag for use with {@link #getRecentTasks}: return all tasks, even those
* that have set their
* {@link android.content.Intent#FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS} flag.
*/
public static final int RECENT_WITH_EXCLUDED = 0x0001;
/**
* Provides a list that does not contain any
* recent tasks that currently are not available to the user.
*/
public static final int RECENT_IGNORE_UNAVAILABLE = 0x0002;
* Flag for use with {@link #getRecentTasks}: return all tasks, even those
* that have set their
* {@link android.content.Intent#FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS} flag.
*/
public static final int RECENT_WITH_EXCLUDED = 0x0001;
/**
* Provides a list that does not contain any
* recent tasks that currently are not available to the user.
*/
public static final int RECENT_IGNORE_UNAVAILABLE = 0x0002;
getRecentsTasks源码:
/**
* Return a list of the tasks that the user has recently launched, with
* the most recent being first and older ones after in order.
*
* @param maxNum The maximum number of entries to return in the list. The
* actual number returned may be smaller, depending on how many tasks the
* user has started and the maximum number the system can remember.
* @param flags Information about what to return. May be any combination
* of {@link #RECENT_WITH_EXCLUDED} and {@link #RECENT_IGNORE_UNAVAILABLE}.
*
* @return Returns a list of RecentTaskInfo records describing each of
* the recent tasks.
*
* @throws SecurityException Throws SecurityException if the caller does
* not hold the {@link android.Manifest.permission#GET_TASKS} permission.
*/
public List<RecentTaskInfo> getRecentTasks(int maxNum, int flags)
throws SecurityException {
try {
return ActivityManagerNative.getDefault().getRecentTasks(maxNum,
flags);
} catch (RemoteException e) {
// System dead, we will be dead too soon!
return null;
}
}
* Return a list of the tasks that the user has recently launched, with
* the most recent being first and older ones after in order.
*
* @param maxNum The maximum number of entries to return in the list. The
* actual number returned may be smaller, depending on how many tasks the
* user has started and the maximum number the system can remember.
* @param flags Information about what to return. May be any combination
* of {@link #RECENT_WITH_EXCLUDED} and {@link #RECENT_IGNORE_UNAVAILABLE}.
*
* @return Returns a list of RecentTaskInfo records describing each of
* the recent tasks.
*
* @throws SecurityException Throws SecurityException if the caller does
* not hold the {@link android.Manifest.permission#GET_TASKS} permission.
*/
public List<RecentTaskInfo> getRecentTasks(int maxNum, int flags)
throws SecurityException {
try {
return ActivityManagerNative.getDefault().getRecentTasks(maxNum,
flags);
} catch (RemoteException e) {
// System dead, we will be dead too soon!
return null;
}
}
0 0
- RecentsActivity简介
- RecentsActivity启动分析二
- Android 7.0 SystemUI(3)--RecentsActivity
- RecentsActivity的启动分析一
- Android4.4 应用在近期任务列表中不显示修改系统源码详解RecentsActivity与RecentTasksLoader
- 简介
- 简介
- 简介
- 简介
- 简介
- 简介
- 简介
- 简介
- 简介
- 简介
- 简介
- 简介
- 简介
- SQL基础语句
- 知乎问题:北京,2017,多少k的java web程序员应该懂多线程和jvm优化?
- 最大子段和
- Android AOP 实践笔记
- 基于MVC模式模拟实现登录注册开发过程(二)
- RecentsActivity简介
- [leetcode]71. Simplify Path
- centos安装redis及集群
- python+opencv打开摄像头,保存视频、拍照功能的实现
- 点击两次返回键退出
- Python脚本打包成exe
- rsync服务与搭建详解
- EOJ 3256 拼音魔法 【模拟】
- windows上的TFTP服务器的安装