Optimizing AppStandby.getIdleUidsForUser

This is called by NPMS on boot for all users, and it makes a lot of
calls to getAppMinBucket. Optimizing the newly added call into alarm
manager internal, and some bookkeeping at the front.

Alarm manager now maintains a list of all apps that have requested the
permission. This saves any calls into permission manager in
hasScheduleExactAlarm.

Test: atest FrameworksMockingServicesTests:com.android.server.alarm
atest FrameworksServicesTests:AppStandbyControllerTests

atrace for boot time analysis.

Bug: 185081934
Change-Id: I4f0b80715acb37a777d28f8c41f666b20f26bd8d
4 files changed