Adding a permission to protect exact alarms
Added a new permission to protect the alarm manager APIs setAlarmClock and setExactAndAllowWhileIdle. The change will apply to apps targeting API S and above. - The permission will be granted by default to apps that request it. - This will be a user facing permission as these APIs allow for exact scheduling, and an app should generally only use them when scheduling work on behalf of the user. This means the user can revoke it when they want. - Alarms set with this API will also be allowed to start FGS from the background. - Quota on exact, allow-while-idle alarms has been relaxed generously, while alarm-clocks remain totally uninhibited. - Apps that are exempted from battery via <allow-in-power-save> in the sysconfig, can still use exact, allow-while-idle alarms without the permission, but with lower quota. - Inexact, allow-while-idle alarms do not require this permission, but will *not* be allowed to start FGS from the background. - A new API to query the state of this permission is included. Test: atest FrameworksMockingServicesTests:com.android.server.alarm atest CtsAlarmManagerTestCases BYPASS_INCLUSIVE_LANGUAGE_REASON=Existing APIs Bug: 171306433 Change-Id: Ifb6a3f3c42316b1c83fe6960920501f5e0ee51f2
Loading
Please register or sign in to comment