summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorPatrick Scott <phanna@android.com>2010-09-22 08:16:53 -0400
committerPatrick Scott <phanna@android.com>2010-09-24 13:52:14 -0400
commita73c4b082c2ab38831fc57c6bfb425d32ffe2aa4 (patch)
tree2de288f4d5523f374d6ab3bfce2fdf8abbcc0b87 /core
parent880dfe4f675128188f8d598f2025a417ccabd1bf (diff)
downloadframeworks_base-a73c4b082c2ab38831fc57c6bfb425d32ffe2aa4.zip
frameworks_base-a73c4b082c2ab38831fc57c6bfb425d32ffe2aa4.tar.gz
frameworks_base-a73c4b082c2ab38831fc57c6bfb425d32ffe2aa4.tar.bz2
Add new Alarm provider class for setting an alarm.
The new class provides static variables for creating an intent to broadcast to applications implementing the alarm clock. A new permission has been added and applications are recommended to require this permission if accepting the set alarm broadcast. Change-Id: I7b1014acdc54371cbda19bcf9b5c395b647aa413
Diffstat (limited to 'core')
-rw-r--r--core/java/android/provider/AlarmClock.java71
-rw-r--r--core/res/AndroidManifest.xml8
-rw-r--r--core/res/res/values/strings.xml9
3 files changed, 88 insertions, 0 deletions
diff --git a/core/java/android/provider/AlarmClock.java b/core/java/android/provider/AlarmClock.java
new file mode 100644
index 0000000..b93dfd8
--- /dev/null
+++ b/core/java/android/provider/AlarmClock.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+package android.provider;
+
+import android.annotation.SdkConstant;
+import android.annotation.SdkConstant.SdkConstantType;
+
+/**
+ * The AlarmClock provider contains an Intent action and extras that can be used
+ * to start an Activity to set a new alarm in an alarm clock application.
+ *
+ * Applications that wish to receive the ACTION_SET_ALARM Intent should create
+ * an activity to handle the Intent that requires the permission
+ * com.android.alarm.permission.SET_ALARM. Applications that wish to create a
+ * new alarm should use
+ * {@link android.content.Context#startActivity Context.startActivity()} so that
+ * the user has the option of choosing which alarm clock application to use.
+ */
+public final class AlarmClock {
+ /**
+ * Activity Action: Set an alarm.
+ * <p>
+ * Input: Nothing.
+ * <p>
+ * Output: Nothing.
+ */
+ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+ public static final String ACTION_SET_ALARM = "android.intent.action.SET_ALARM";
+
+ /**
+ * Activity Extra: Provide a custom message for the alarm.
+ * <p>
+ * This can be passed as an extra field in the Intent created with
+ * ACTION_SET_ALARM.
+ */
+ public static final String EXTRA_MESSAGE = "android.intent.extra.alarm.MESSAGE";
+
+ /**
+ * Activity Extra: The hour of the alarm being set.
+ * <p>
+ * This value can be passed as an extra field to the Intent created with
+ * ACTION_SET_ALARM. If it is not provided, the behavior is undefined and
+ * is up to the application. The value is an integer and ranges from 0 to
+ * 23.
+ */
+ public static final String EXTRA_HOUR = "android.intent.extra.alarm.HOUR";
+
+ /**
+ * Activity Extra: The minutes of the alarm being set.
+ * <p>
+ * This value can be passed as an extra field to the Intent created with
+ * ACTION_SET_ALARM. If it is not provided, the behavior is undefined and
+ * is up to the application. The value is an integer and ranges from 0 to
+ * 59.
+ */
+ public static final String EXTRA_MINUTES = "android.intent.extra.alarm.MINUTES";
+}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index ab0ff3f..68a5a14 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -242,6 +242,14 @@
android:description="@string/permdesc_writeHistoryBookmarks"
android:protectionLevel="dangerous" />
+ <!-- Allows an application to broadcast an Intent to set an alarm for the
+ user. -->
+ <permission android:name="com.android.alarm.permission.SET_ALARM"
+ android:permissionGroup="android.permission-group.PERSONAL_INFO"
+ android:label="@string/permlab_setAlarm"
+ android:description="@string/permdesc_setAlarm"
+ android:protectionLevel="normal" />
+
<!-- ======================================= -->
<!-- Permissions for accessing location info -->
<!-- ======================================= -->
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 808b371..ebccfb6 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1619,6 +1619,15 @@
<!-- Title of an application permission, listed so the user can choose whether
they want to allow the application to do this. -->
+ <string name="permlab_setAlarm">set alarm in alarm clock</string>
+ <!-- Description of an application permission, listed so the user can choose whether
+ they want to allow the application to do this. -->
+ <string name="permdesc_setAlarm">Allows the application to set an alarm in
+ an installed alarm clock application. Some alarm clock applications may
+ not implement this feature.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether
+ they want to allow the application to do this. -->
<string name="permlab_writeGeolocationPermissions">Modify Browser geolocation permissions</string>
<!-- Description of an application permission, listed so the user can choose whether
they want to allow the application to do this. -->