Code example for ActivityManager

Methods: getRunningTasks

0
	public static ScreenState getScreenState(Context c){
		PowerManager pm = (PowerManager) c.getSystemService(Context.POWER_SERVICE);
		boolean isScreenOn = pm.isScreenOn();
		if(isScreenOn){
			ActivityManager manager = (ActivityManager) c.getSystemService(Context.ACTIVITY_SERVICE);
			List<RunningTaskInfo> runningTaskInfos = manager.getRunningTasks(Integer.MAX_VALUE);
			RunningTaskInfo info = runningTaskInfos.get(0);
			String nowPackageName = info.baseActivity.getPackageName();
			if(nowPackageName.equals(MY_PACKAGE_NAME)){
				return ScreenState.MYAPP;
			}else{ 
				return ScreenState.OTHERAPP;
			} 
//			Log.e("MyUtils",nowPackageName); 
		}else{ 
//			Log.e("isScreenOn:",String.valueOf(isScreenOn)); 
			return ScreenState.LOCK;
		} 
	} 
	 
	public static Boolean isInCir(float x, float y,float screenCenterX,