nigatigga

Untitled

Oct 22nd, 2014
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. final String packageName = getApplicationContext().getPackageName();
  2.  
  3.  
  4. for (Object object : packagezList) {
  5.  
  6.  
  7. for (ActivityManager.RunningAppProcessInfo appProcess : appProcesses) {
  8.  
  9.  
  10.  
  11. boolean b= appProcess.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_VISIBLE;
  12.  
  13. if (!b) {
  14. Log.e("is in foreground", getApplicationContext().getPackageName());
  15.  
  16.  
  17. // Provide the packagename(s) of apps here, you want to show password activity
  18.  
  19. if (((appProcess.processName.contains((CharSequence) object)) &&
  20. (!appProcess.processName.contains(getApplicationContext().getPackageName()
  21. )) && (!appProcess.processName.equals(packageName)))) {
  22.  
  23.  
  24. /* // you have to make this check even better
  25. Log.e("Boom Motherfucker3", getApplicationContext().getPackageName());
  26.  
  27. Log.e("Just Blocked: ", appProcess.processName);
  28.  
  29.  
  30. Intent i = new Intent(getApplicationContext(), LockScreenActivity.class);
  31. i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION);
  32. i.putExtra("", "");
  33. startActivity(i);*/
  34.  
  35. }
  36.  
  37.  
  38. }
  39.  
  40.  
  41. }
  42.  
  43.  
  44. }
  45.  
  46. }
  47. } catch (Exception e) {
  48. // Log.e("Foreground App", e.getMessage(), e);
  49. }
Advertisement
Add Comment
Please, Sign In to add comment