Fix app standby bugs.

1. Don't set app standby buckets when app idle is disabled. When the
bucket is set when app idle is disabled, AppStandbyController notifies
listeners, which then puts the listeners in an invalid state where
they think some apps are exempted from things like battery saver.

2. Remove uninstalled packages from AppStateTracker's exempted package
cache.

Bug: 156868557
Test: make cts -j 64 && cts-tradefed run commandAndExit cts -m CtsBatterySavingTestCases -t android.os.cts.batterysaving.BatterySaverAlarmTest
Test: make cts -j 64 && cts-tradefed run commandAndExit cts-on-gsi -m CtsBatterySavingTestCases -t android.os.cts.batterysaving.BatterySaverAlarmTest
Change-Id: If62c75eff0bc56ef1750e109335ba7e47832c128
Merged-In: 2a94051c041dab180dc7f22e9a4f5ff36dd7d483
2 files changed