Add api to check if an app is in foreground or not.

This api is backed by existing appops logic and should only
be used in the context of runtime permissions. This is different
than ActivityManager's foreground check, which only
consider proc state/importance.

Fix: 265802019
API-Coverage-Bug: 266482297
Test: atest AppOpsUidStateTrackerTest
Change-Id: I0a7ce12910199435c0c08f613798b2645455ab5e
7 files changed