{"action":"created","issue":{"url":"https://api.github.com/repos/jaredrummler/AndroidProcesses/issues/1","labels_url":"https://api.github.com/repos/jaredrummler/AndroidProcesses/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/jaredrummler/AndroidProcesses/issues/1/comments","events_url":"https://api.github.com/repos/jaredrummler/AndroidProcesses/issues/1/events","html_url":"https://github.com/jaredrummler/AndroidProcesses/issues/1","id":112768072,"number":1,"title":"oom_score_adj cannot by read on Android 6","user":{"login":"samlu","id":1866938,"avatar_url":"https://avatars.githubusercontent.com/u/1866938?v=3","gravatar_id":"","url":"https://api.github.com/users/samlu","html_url":"https://github.com/samlu","followers_url":"https://api.github.com/users/samlu/followers","following_url":"https://api.github.com/users/samlu/following{/other_user}","gists_url":"https://api.github.com/users/samlu/gists{/gist_id}","starred_url":"https://api.github.com/users/samlu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samlu/subscriptions","organizations_url":"https://api.github.com/users/samlu/orgs","repos_url":"https://api.github.com/users/samlu/repos","events_url":"https://api.github.com/users/samlu/events{/privacy}","received_events_url":"https://api.github.com/users/samlu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-22T09:50:49Z","updated_at":"2015-10-25T16:19:38Z","closed_at":null,"body":"-r-------- u0_a111  u0_a111         0 2015-10-22 17:37 oom_score_adj\r\n\r\nAndroid 6 disables 3rd party apps to read oom_score_adj. \r\nIs there any solution to decide which foreground process is top app?"},"comment":{"url":"https://api.github.com/repos/jaredrummler/AndroidProcesses/issues/comments/150938517","html_url":"https://github.com/jaredrummler/AndroidProcesses/issues/1#issuecomment-150938517","issue_url":"https://api.github.com/repos/jaredrummler/AndroidProcesses/issues/1","id":150938517,"user":{"login":"jaredrummler","id":6203389,"avatar_url":"https://avatars.githubusercontent.com/u/6203389?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredrummler","html_url":"https://github.com/jaredrummler","followers_url":"https://api.github.com/users/jaredrummler/followers","following_url":"https://api.github.com/users/jaredrummler/following{/other_user}","gists_url":"https://api.github.com/users/jaredrummler/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredrummler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredrummler/subscriptions","organizations_url":"https://api.github.com/users/jaredrummler/orgs","repos_url":"https://api.github.com/users/jaredrummler/repos","events_url":"https://api.github.com/users/jaredrummler/events{/privacy}","received_events_url":"https://api.github.com/users/jaredrummler/received_events","type":"User","site_admin":false},"created_at":"2015-10-25T16:19:38Z","updated_at":"2015-10-25T16:19:38Z","body":"I need to look into this more. As of now, I think the only way to know the foreground app on Android M is to use UsageStatsManager. I *think* that if your process' oom_score is 0 and the policy (see /proc/[pid]/stat) is \"fg\" then *most likely* your process is the foreground application."}}