I am accessing user stats in the following ways:
 UsageStatsManager userStatsMgr = (UsageStatsManager)getSystemService("usagestats"); 
 List<UsageStats> userStats = mUsageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_BEST, timeStamp - 1000*200, timeStamp)
Seems to work for:
 android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP
But I am not sure whether it will continue to work on newer SDK? I see some warning while using this permission, but those were not specific. So I am wondering what exactly these restrictions are?
 ActivityManager mgr =  (ActivityManager)ctx.getSystemService(Context.ACTIVITY_SERVICE);
                            List<ActivityManager.RunningAppProcessInfo>   
     processes = manager.getRunningAppProcesses();
                            app=processes.get(0).processName;
And also
      ActivityManager actMgr = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
                    actMgr.killBackgroundProcesses(process);
 
     
     
    