Adding a cache variable for ActivityManagerInternal.

Adding a cache variable for the ActivityManagerInternal local service
that is fetched on every call of isAppForeground. This change is an
update to ag/5932523 to increase boot time performance.

Also updating the relevant tests since an exception is not thrown
anymore from calling isAppForeground.

Bug: 122591875
Test: atest WifiServiceImplTest
Test: atest WifiLockManagerTest
Change-Id: I0330ca2a6584c32496968f374a79c2c8f297ed68
4 files changed