Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8b92405 authored by Suprabh Shukla's avatar Suprabh Shukla
Browse files

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
parent beefb25b
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -3065,6 +3065,33 @@
                       android:value="com.android.settings.applications.appinfo.WriteSettingsDetails" />
        </activity>

        <activity
            android:name="Settings$AlarmsAndRemindersActivity"
            android:exported="true"
            android:label="@string/alarms_and_reminders_label">
            <intent-filter android:priority="1">
                <action android:name="android.settings.REQUEST_SCHEDULE_EXACT_ALARM" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                       android:value="com.android.settings.applications.manageapplications.ManageApplications" />
            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
                       android:value="true" />
        </activity>

        <activity
            android:name="Settings$AlarmsAndRemindersAppActivity"
            android:exported="true"
            android:label="@string/alarms_and_reminders_label">
            <intent-filter android:priority="1">
                <action android:name="android.settings.REQUEST_SCHEDULE_EXACT_ALARM" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="package" />
            </intent-filter>
            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                       android:value="com.android.settings.applications.appinfo.AlarmsAndRemindersDetails" />
        </activity>

        <activity
            android:name="Settings$ManageExternalSourcesActivity"
            android:exported="true"
+18 −0
Original line number Diff line number Diff line
@@ -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>
+30 −0
Original line number Diff line number Diff line
<?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>
+10 −0
Original line number Diff line number Diff line
@@ -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"
+4 −0
Original line number Diff line number Diff line
@@ -204,6 +204,10 @@ public class Settings extends SettingsActivity {
    public static class ManagedProfileSettingsActivity extends SettingsActivity { /* empty */ }
    public static class DeletionHelperActivity extends SettingsActivity { /* empty */ }

    /** Actviity to manage apps with {@link android.Manifest.permission#SCHEDULE_EXACT_ALARM} */
    public static class AlarmsAndRemindersActivity extends SettingsActivity {/* empty */ }
    /** App specific version of {@link AlarmsAndRemindersActivity} */
    public static class AlarmsAndRemindersAppActivity extends SettingsActivity {/* empty */ }

    public static class ApnEditorActivity extends SettingsActivity { /* empty */ }
    public static class ChooseAccountActivity extends SettingsActivity { /* empty */ }
Loading