Adding alarms and reminders activity

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
This commit is contained in:
Suprabh Shukla
2021-02-17 18:00:35 -08:00
parent beefb25b48
commit c8b9240535
14 changed files with 534 additions and 3 deletions

View File

@@ -3359,6 +3359,22 @@
<!-- Section header above list of external storage devices [CHAR LIMIT=30]-->
<string name="storage_external_title">Portable storage</string>
<!-- Label for the settings activity for controlling apps that can schedule alarms [CHAR LIMIT=30] -->
<string name="alarms_and_reminders_label">Alarms and reminders</string>
<!-- Label for the switch to toggler the permission for scheduling alarms [CHAR LIMIT=50] -->
<string name="alarms_and_reminders_switch_title">Allow to set alarms or reminders</string>
<!-- Title for the setting screen for controlling apps that can schedule alarms [CHAR LIMIT=30] -->
<string name="alarms_and_reminders_title">Alarms and reminders</string>
<!-- Description that appears below the alarms_and_reminders switch [CHAR LIMIT=NONE] -->
<string name="alarms_and_reminders_footer_title">
Allow this app to schedule alarms or other timing based events.
This will allow the app to wake up and run even when you are not using the device.
Note that revoking this permission may cause the app to malfunction, specifically any alarms
that the app has scheduled will no longer work.
</string>
<!-- Keywords for setting screen for controlling apps that can schedule alarms [CHAR LIMIT=100] -->
<string name="keywords_alarms_and_reminders">schedule, alarm, reminder, event</string>
<!-- Summary of a single storage volume, constrasting available and total storage space. [CHAR LIMIT=48]-->
<string name="storage_volume_summary"><xliff:g id="used" example="1.2GB">%1$s</xliff:g> used of <xliff:g id="total" example="32GB">%2$s</xliff:g></string>
<!-- Summary of a single storage volume used space. [CHAR LIMIT=24] -->
@@ -7304,6 +7320,8 @@
<string name="help_uri_printing" translatable="false"></string>
<!-- Help URI, About phone [DO NOT TRANSLATE] -->
<string name="help_uri_about" translatable="false"></string>
<!-- Help URI, manage apps that can set alarms and reminders [DO NOT TRANSLATE] -->
<string name="help_uri_alarms_and_reminders" translatable="false"></string>
<!-- Help URL, WiFi [DO NOT TRANSLATE] -->
<string name="help_url_wifi" translatable="false"></string>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2021 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/alarms_and_reminders_title">
<com.android.settings.widget.FilterTouchesRestrictedSwitchPreference
android:key="alarms_and_reminders_switch"
android:title="@string/alarms_and_reminders_switch_title" />
<com.android.settingslib.widget.FooterPreference
android:key="alarms_and_reminders_description"
android:title="@string/alarms_and_reminders_footer_title"
android:selectable="false" />
</PreferenceScreen>

View File

@@ -112,6 +112,16 @@
android:value="com.android.settings.Settings$ManageExternalSourcesActivity" />
</Preference>
<Preference
android:key="alarms_and_reminders"
android:title="@string/alarms_and_reminders_title"
android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
settings:keywords="@string/keywords_alarms_and_reminders">
<extra
android:name="classname"
android:value="com.android.settings.Settings$AlarmsAndRemindersActivity" />
</Preference>
<Preference
android:key="special_app_usage_access"
android:title="@string/usage_access"