diff options
| author | Jake Hamby <jhamby@google.com> | 2012-04-18 12:32:18 -0700 |
|---|---|---|
| committer | Jake Hamby <jhamby@google.com> | 2012-04-18 16:41:19 -0700 |
| commit | c3296ffdfc70c6778b6ae760b812b4e53e335f97 (patch) | |
| tree | b059c834c8cae8ec24a0f9bfd33cb82d2316247a /core | |
| parent | 4b12171c64176aa8967b7a91c293ab0403b26e46 (diff) | |
| download | frameworks_base-c3296ffdfc70c6778b6ae760b812b4e53e335f97.zip frameworks_base-c3296ffdfc70c6778b6ae760b812b4e53e335f97.tar.gz frameworks_base-c3296ffdfc70c6778b6ae760b812b4e53e335f97.tar.bz2 | |
Add ContentProvider for apps to read received SMS cell broadcasts.
The CellBroadcastReceiver app will allow apps with the new permission
"android.permission.READ_CELL_BROADCASTS" to read previously received
cell broadcast messages from a new ContentProvider database at URI
"content://cellbroadcasts". This will enable third parties to provide
additional information to users in the event of emergencies without
delaying or interfering with the initial system alert dialog to warn
the user when the alert is received.
Includes a new android.telephony.CellBroadcastMessage class which
can be instantiated from the Cursor retrieved from the ContentProvider.
This was previously a part of the CellBroadcastReceiver app, but can now
be used by third party apps with read permission on the ContentProvider.
Change-Id: I2c31f62b63c050c7946de2d81c28a5f4dc6f00b0
Diffstat (limited to 'core')
| -rwxr-xr-x | core/java/android/provider/Telephony.java | 175 | ||||
| -rw-r--r-- | core/res/AndroidManifest.xml | 17 | ||||
| -rwxr-xr-x | core/res/res/values/strings.xml | 9 |
3 files changed, 201 insertions, 0 deletions
diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java index 9612151..19d8d5c 100755 --- a/core/java/android/provider/Telephony.java +++ b/core/java/android/provider/Telephony.java @@ -1816,6 +1816,181 @@ public final class Telephony { public static final String BEARER = "bearer"; } + /** + * Contains received SMS cell broadcast messages. + */ + public static final class CellBroadcasts implements BaseColumns { + + /** Not instantiable. */ + private CellBroadcasts() {} + + /** + * The content:// style URL for this table + */ + public static final Uri CONTENT_URI = + Uri.parse("content://cellbroadcasts"); + + /** + * Message geographical scope. + * <P>Type: INTEGER</P> + */ + public static final String GEOGRAPHICAL_SCOPE = "geo_scope"; + + /** + * Message serial number. + * <P>Type: INTEGER</P> + */ + public static final String SERIAL_NUMBER = "serial_number"; + + /** + * PLMN of broadcast sender. (SERIAL_NUMBER + PLMN + LAC + CID) uniquely identifies a + * broadcast for duplicate detection purposes. + * <P>Type: TEXT</P> + */ + public static final String PLMN = "plmn"; + + /** + * Location Area (GSM) or Service Area (UMTS) of broadcast sender. Unused for CDMA. + * Only included if Geographical Scope of message is not PLMN wide (01). + * <P>Type: INTEGER</P> + */ + public static final String LAC = "lac"; + + /** + * Cell ID of message sender (GSM/UMTS). Unused for CDMA. Only included when the + * Geographical Scope of message is cell wide (00 or 11). + * <P>Type: INTEGER</P> + */ + public static final String CID = "cid"; + + /** + * Message code (OBSOLETE: merged into SERIAL_NUMBER). + * <P>Type: INTEGER</P> + */ + public static final String V1_MESSAGE_CODE = "message_code"; + + /** + * Message identifier (OBSOLETE: renamed to SERVICE_CATEGORY). + * <P>Type: INTEGER</P> + */ + public static final String V1_MESSAGE_IDENTIFIER = "message_id"; + + /** + * Service category (GSM/UMTS message identifier, CDMA service category). + * <P>Type: INTEGER</P> + */ + public static final String SERVICE_CATEGORY = "service_category"; + + /** + * Message language code. + * <P>Type: TEXT</P> + */ + public static final String LANGUAGE_CODE = "language"; + + /** + * Message body. + * <P>Type: TEXT</P> + */ + public static final String MESSAGE_BODY = "body"; + + /** + * Message delivery time. + * <P>Type: INTEGER (long)</P> + */ + public static final String DELIVERY_TIME = "date"; + + /** + * Has the message been viewed? + * <P>Type: INTEGER (boolean)</P> + */ + public static final String MESSAGE_READ = "read"; + + /** + * Message format (3GPP or 3GPP2). + * <P>Type: INTEGER</P> + */ + public static final String MESSAGE_FORMAT = "format"; + + /** + * Message priority (including emergency). + * <P>Type: INTEGER</P> + */ + public static final String MESSAGE_PRIORITY = "priority"; + + /** + * ETWS warning type (ETWS alerts only). + * <P>Type: INTEGER</P> + */ + public static final String ETWS_WARNING_TYPE = "etws_warning_type"; + + /** + * CMAS message class (CMAS alerts only). + * <P>Type: INTEGER</P> + */ + public static final String CMAS_MESSAGE_CLASS = "cmas_message_class"; + + /** + * CMAS category (CMAS alerts only). + * <P>Type: INTEGER</P> + */ + public static final String CMAS_CATEGORY = "cmas_category"; + + /** + * CMAS response type (CMAS alerts only). + * <P>Type: INTEGER</P> + */ + public static final String CMAS_RESPONSE_TYPE = "cmas_response_type"; + + /** + * CMAS severity (CMAS alerts only). + * <P>Type: INTEGER</P> + */ + public static final String CMAS_SEVERITY = "cmas_severity"; + + /** + * CMAS urgency (CMAS alerts only). + * <P>Type: INTEGER</P> + */ + public static final String CMAS_URGENCY = "cmas_urgency"; + + /** + * CMAS certainty (CMAS alerts only). + * <P>Type: INTEGER</P> + */ + public static final String CMAS_CERTAINTY = "cmas_certainty"; + + /** + * The default sort order for this table + */ + public static final String DEFAULT_SORT_ORDER = DELIVERY_TIME + " DESC"; + + /** + * Query columns for instantiating {@link android.telephony.CellBroadcastMessage} objects. + */ + public static final String[] QUERY_COLUMNS = { + _ID, + GEOGRAPHICAL_SCOPE, + PLMN, + LAC, + CID, + SERIAL_NUMBER, + SERVICE_CATEGORY, + LANGUAGE_CODE, + MESSAGE_BODY, + DELIVERY_TIME, + MESSAGE_READ, + MESSAGE_FORMAT, + MESSAGE_PRIORITY, + ETWS_WARNING_TYPE, + CMAS_MESSAGE_CLASS, + CMAS_CATEGORY, + CMAS_RESPONSE_TYPE, + CMAS_SEVERITY, + CMAS_URGENCY, + CMAS_CERTAINTY + }; + } + public static final class Intents { private Intents() { // Not instantiable diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index f5c0f8f..3c2121d 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -202,6 +202,23 @@ android:label="@string/permlab_receiveEmergencyBroadcast" android:description="@string/permdesc_receiveEmergencyBroadcast" /> + <!-- Allows an application to read previously received cell broadcast + messages and to register a content observer to get notifications when + a cell broadcast has been received and added to the database. For + emergency alerts, the database is updated immediately after the + alert dialog and notification sound/vibration/speech are presented. + The "read" column is then updated after the user dismisses the alert. + This enables supplementary emergency assistance apps to start loading + additional emergency information (if Internet access is available) + when the alert is first received, and to delay presenting the info + to the user until after the initial alert dialog is dismissed. + @hide Pending API council approval --> + <permission android:name="android.permission.READ_CELL_BROADCASTS" + android:permissionGroup="android.permission-group.MESSAGES" + android:protectionLevel="dangerous" + android:label="@string/permlab_readCellBroadcasts" + android:description="@string/permdesc_readCellBroadcasts" /> + <!-- Allows an application to read SMS messages. --> <permission android:name="android.permission.READ_SMS" android:permissionGroup="android.permission-group.MESSAGES" diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index e00986c..157408d 100755 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -474,6 +474,15 @@ and process emergency broadcast messages. This permission is only available to system apps.</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_readCellBroadcasts">read cell broadcast messages</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_readCellBroadcasts">Allows the app to read + cell broadcast messages received by your device. Cell broadcast alerts + are delivered in some locations to warn you of emergency situations. + Malicious apps may interfere with the performance or operation of your + device when an emergency cell broadcast is received.</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_sendSms">send SMS messages</string> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> |
