Skip to content

Commit d65c2be

Browse files
Jake HambyAndroid (Google) Code Review
authored andcommitted
Merge "Add ContentProvider for apps to read received SMS cell broadcasts."
2 parents 875f064 + c3296ff commit d65c2be

File tree

4 files changed

+623
-0
lines changed

4 files changed

+623
-0
lines changed

core/java/android/provider/Telephony.java

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,6 +1816,181 @@ public static final class Carriers implements BaseColumns {
18161816
public static final String BEARER = "bearer";
18171817
}
18181818

1819+
/**
1820+
* Contains received SMS cell broadcast messages.
1821+
*/
1822+
public static final class CellBroadcasts implements BaseColumns {
1823+
1824+
/** Not instantiable. */
1825+
private CellBroadcasts() {}
1826+
1827+
/**
1828+
* The content:// style URL for this table
1829+
*/
1830+
public static final Uri CONTENT_URI =
1831+
Uri.parse("content://cellbroadcasts");
1832+
1833+
/**
1834+
* Message geographical scope.
1835+
* <P>Type: INTEGER</P>
1836+
*/
1837+
public static final String GEOGRAPHICAL_SCOPE = "geo_scope";
1838+
1839+
/**
1840+
* Message serial number.
1841+
* <P>Type: INTEGER</P>
1842+
*/
1843+
public static final String SERIAL_NUMBER = "serial_number";
1844+
1845+
/**
1846+
* PLMN of broadcast sender. (SERIAL_NUMBER + PLMN + LAC + CID) uniquely identifies a
1847+
* broadcast for duplicate detection purposes.
1848+
* <P>Type: TEXT</P>
1849+
*/
1850+
public static final String PLMN = "plmn";
1851+
1852+
/**
1853+
* Location Area (GSM) or Service Area (UMTS) of broadcast sender. Unused for CDMA.
1854+
* Only included if Geographical Scope of message is not PLMN wide (01).
1855+
* <P>Type: INTEGER</P>
1856+
*/
1857+
public static final String LAC = "lac";
1858+
1859+
/**
1860+
* Cell ID of message sender (GSM/UMTS). Unused for CDMA. Only included when the
1861+
* Geographical Scope of message is cell wide (00 or 11).
1862+
* <P>Type: INTEGER</P>
1863+
*/
1864+
public static final String CID = "cid";
1865+
1866+
/**
1867+
* Message code (OBSOLETE: merged into SERIAL_NUMBER).
1868+
* <P>Type: INTEGER</P>
1869+
*/
1870+
public static final String V1_MESSAGE_CODE = "message_code";
1871+
1872+
/**
1873+
* Message identifier (OBSOLETE: renamed to SERVICE_CATEGORY).
1874+
* <P>Type: INTEGER</P>
1875+
*/
1876+
public static final String V1_MESSAGE_IDENTIFIER = "message_id";
1877+
1878+
/**
1879+
* Service category (GSM/UMTS message identifier, CDMA service category).
1880+
* <P>Type: INTEGER</P>
1881+
*/
1882+
public static final String SERVICE_CATEGORY = "service_category";
1883+
1884+
/**
1885+
* Message language code.
1886+
* <P>Type: TEXT</P>
1887+
*/
1888+
public static final String LANGUAGE_CODE = "language";
1889+
1890+
/**
1891+
* Message body.
1892+
* <P>Type: TEXT</P>
1893+
*/
1894+
public static final String MESSAGE_BODY = "body";
1895+
1896+
/**
1897+
* Message delivery time.
1898+
* <P>Type: INTEGER (long)</P>
1899+
*/
1900+
public static final String DELIVERY_TIME = "date";
1901+
1902+
/**
1903+
* Has the message been viewed?
1904+
* <P>Type: INTEGER (boolean)</P>
1905+
*/
1906+
public static final String MESSAGE_READ = "read";
1907+
1908+
/**
1909+
* Message format (3GPP or 3GPP2).
1910+
* <P>Type: INTEGER</P>
1911+
*/
1912+
public static final String MESSAGE_FORMAT = "format";
1913+
1914+
/**
1915+
* Message priority (including emergency).
1916+
* <P>Type: INTEGER</P>
1917+
*/
1918+
public static final String MESSAGE_PRIORITY = "priority";
1919+
1920+
/**
1921+
* ETWS warning type (ETWS alerts only).
1922+
* <P>Type: INTEGER</P>
1923+
*/
1924+
public static final String ETWS_WARNING_TYPE = "etws_warning_type";
1925+
1926+
/**
1927+
* CMAS message class (CMAS alerts only).
1928+
* <P>Type: INTEGER</P>
1929+
*/
1930+
public static final String CMAS_MESSAGE_CLASS = "cmas_message_class";
1931+
1932+
/**
1933+
* CMAS category (CMAS alerts only).
1934+
* <P>Type: INTEGER</P>
1935+
*/
1936+
public static final String CMAS_CATEGORY = "cmas_category";
1937+
1938+
/**
1939+
* CMAS response type (CMAS alerts only).
1940+
* <P>Type: INTEGER</P>
1941+
*/
1942+
public static final String CMAS_RESPONSE_TYPE = "cmas_response_type";
1943+
1944+
/**
1945+
* CMAS severity (CMAS alerts only).
1946+
* <P>Type: INTEGER</P>
1947+
*/
1948+
public static final String CMAS_SEVERITY = "cmas_severity";
1949+
1950+
/**
1951+
* CMAS urgency (CMAS alerts only).
1952+
* <P>Type: INTEGER</P>
1953+
*/
1954+
public static final String CMAS_URGENCY = "cmas_urgency";
1955+
1956+
/**
1957+
* CMAS certainty (CMAS alerts only).
1958+
* <P>Type: INTEGER</P>
1959+
*/
1960+
public static final String CMAS_CERTAINTY = "cmas_certainty";
1961+
1962+
/**
1963+
* The default sort order for this table
1964+
*/
1965+
public static final String DEFAULT_SORT_ORDER = DELIVERY_TIME + " DESC";
1966+
1967+
/**
1968+
* Query columns for instantiating {@link android.telephony.CellBroadcastMessage} objects.
1969+
*/
1970+
public static final String[] QUERY_COLUMNS = {
1971+
_ID,
1972+
GEOGRAPHICAL_SCOPE,
1973+
PLMN,
1974+
LAC,
1975+
CID,
1976+
SERIAL_NUMBER,
1977+
SERVICE_CATEGORY,
1978+
LANGUAGE_CODE,
1979+
MESSAGE_BODY,
1980+
DELIVERY_TIME,
1981+
MESSAGE_READ,
1982+
MESSAGE_FORMAT,
1983+
MESSAGE_PRIORITY,
1984+
ETWS_WARNING_TYPE,
1985+
CMAS_MESSAGE_CLASS,
1986+
CMAS_CATEGORY,
1987+
CMAS_RESPONSE_TYPE,
1988+
CMAS_SEVERITY,
1989+
CMAS_URGENCY,
1990+
CMAS_CERTAINTY
1991+
};
1992+
}
1993+
18191994
public static final class Intents {
18201995
private Intents() {
18211996
// Not instantiable

core/res/AndroidManifest.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,23 @@
202202
android:label="@string/permlab_receiveEmergencyBroadcast"
203203
android:description="@string/permdesc_receiveEmergencyBroadcast" />
204204

205+
<!-- Allows an application to read previously received cell broadcast
206+
messages and to register a content observer to get notifications when
207+
a cell broadcast has been received and added to the database. For
208+
emergency alerts, the database is updated immediately after the
209+
alert dialog and notification sound/vibration/speech are presented.
210+
The "read" column is then updated after the user dismisses the alert.
211+
This enables supplementary emergency assistance apps to start loading
212+
additional emergency information (if Internet access is available)
213+
when the alert is first received, and to delay presenting the info
214+
to the user until after the initial alert dialog is dismissed.
215+
@hide Pending API council approval -->
216+
<permission android:name="android.permission.READ_CELL_BROADCASTS"
217+
android:permissionGroup="android.permission-group.MESSAGES"
218+
android:protectionLevel="dangerous"
219+
android:label="@string/permlab_readCellBroadcasts"
220+
android:description="@string/permdesc_readCellBroadcasts" />
221+
205222
<!-- Allows an application to read SMS messages. -->
206223
<permission android:name="android.permission.READ_SMS"
207224
android:permissionGroup="android.permission-group.MESSAGES"

core/res/res/values/strings.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,15 @@
474474
and process emergency broadcast messages. This permission is only available
475475
to system apps.</string>
476476

477+
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
478+
<string name="permlab_readCellBroadcasts">read cell broadcast messages</string>
479+
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
480+
<string name="permdesc_readCellBroadcasts">Allows the app to read
481+
cell broadcast messages received by your device. Cell broadcast alerts
482+
are delivered in some locations to warn you of emergency situations.
483+
Malicious apps may interfere with the performance or operation of your
484+
device when an emergency cell broadcast is received.</string>
485+
477486
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
478487
<string name="permlab_sendSms">send SMS messages</string>
479488
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->

0 commit comments

Comments
 (0)