getTasks: caller 10108 does not hold GET_TASKS; limiting output问题解决

出现以下刷屏输出:

11-28 11:55:43.249: W/ActivityManager(591): getTasks: caller 10108 does not hold GET_TASKS; limiting output

11-28 11:55:44.300: W/ActivityManager(591): getTasks: caller 10108 does not hold GET_TASKS; limiting output

11-28 11:55:45.352: W/ActivityManager(591): getTasks: caller 10108 does not hold GET_TASKS; limiting output

11-28 11:55:46.416: W/ActivityManager(591): getTasks: caller 10108 does not hold GET_TASKS; limiting output

11-28 11:55:47.468: W/ActivityManager(591): getTasks: caller 10108 does not hold GET_TASKS; limiting output

11-28 11:55:48.521: W/ActivityManager(591): getTasks: caller 10108 does not hold GET_TASKS; limiting output

11-28 11:55:49.571: W/ActivityManager(591): getTasks: caller 10108 does not hold GET_TASKS; limiting output

11-28 11:55:50.623: W/ActivityManager(591): getTasks: caller 10108 does not hold GET_TASKS; limiting output

11-28 11:55:51.675: W/ActivityManager(591): getTasks: caller 10108 does not hold GET_TASKS; limiting output

11-28 11:55:52.726: W/ActivityManager(591): getTasks: caller 10108 does not hold GET_TASKS; limiting output

11-28 11:55:53.777: W/ActivityManager(591): getTasks: caller 10108 does not hold GET_TASKS; limiting output

11-28 11:55:54.829: W/ActivityManager(591): getTasks: caller 10108 does not hold GET_TASKS; limiting output
目前在Android API 21的Logcat输出存在一个Bug没有解决,就会出现上述的刷屏问题,
目前我知道当调用一下代码时就会出现这个问题:

ActivityManager am = (ActivityManager) this.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> taskInfo = am.getRunningTasks(5);
想要解决这个问题,我在这里加入了版本检查:
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP);
并且在清单配置文件中加入以下权限:
<uses-permission android:name="android.permission.GET_TASKS" />





你可能感兴趣的:(getTasks: caller 10108 does not hold GET_TASKS; limiting output问题解决)