Setting the result in onPause is too late for delivering it to the
requesting activity. Changing to setting the result any time the
uncommitted state is written. The state will still be committed in
onPause only.
Test: Manually with a test app using startActivityForResult.
Bug: 188477366
Change-Id: I676c99e7d2a64b644cef60ecd14728d4d49180c3
The consequences of revoking the permission are irreversible so delay
committing until the user navigates out of the activity.
Test: Manual
Bug: 186280600
Change-Id: Ib53496fd4e39fe15dca4aadc5bcc773d5433131c
Calling AlarmManager to know the state of the permission, which is now
the source of truth, as the logic deciding the state of the permission
may change.
Also killing the app when the permission changes to denied, this avoids
the app maintaining stale state about this permission.
Test: make -j RunSettingsRoboTests
atest SettingsUnitTests:AppStateAlarmsAndRemindersBridgeTest
Manually: Toggle the state of an app to "Not allowed" and check the logs
for activity manager kill messages.
Bug: 181152252
Bug: 183136253
Change-Id: I438782eaef4caae50fd76685c675a3e45ee28d9f
Adding a settings screen to control the permission SCHEDULE_EXACT_ALARM.
Apps can start this by starting a newly introduced API intent
REQUEST_SCHEDULE_EXACT_ALARM.
Test: make -j RunSettingsRoboTests
Manually by UI inspection:
Settings -> Apps -> Special App access -> Alarms and Reminders
or by running:
adb shell am start -a android.settings.REQUEST_SCHEDULE_EXACT_ALARM
Bug: 171306433
Bug: 171305516
Change-Id: I1293d38fc50a22b2af46f80ab24f676ed632f964