use of android.content.UriMatcher in project android_frameworks_base by ResurrectionRemix.
the class UriMatcherTest method testContentUrisWithLeadingSlash.
@SmallTest
public void testContentUrisWithLeadingSlash() {
UriMatcher matcher = new UriMatcher(ROOT);
matcher.addURI("people", null, PEOPLE);
matcher.addURI("people", "/#", PEOPLE_ID);
matcher.addURI("people", "/#/phones", PEOPLE_PHONES);
matcher.addURI("people", "/#/phones/blah", PEOPLE_PHONES_ID);
matcher.addURI("people", "/#/phones/#", PEOPLE_PHONES_ID);
matcher.addURI("people", "/#/addresses", PEOPLE_ADDRESSES);
matcher.addURI("people", "/#/addresses/#", PEOPLE_ADDRESSES_ID);
matcher.addURI("people", "/#/contact-methods", PEOPLE_CONTACTMETH);
matcher.addURI("people", "/#/contact-methods/#", PEOPLE_CONTACTMETH_ID);
matcher.addURI("calls", null, CALLS);
matcher.addURI("calls", "/#", CALLS_ID);
matcher.addURI("caller-id", null, CALLERID);
matcher.addURI("caller-id", "/*", CALLERID_TEXT);
matcher.addURI("filter-recent", null, FILTERRECENT);
matcher.addURI("auth", "/another/path/segment", ANOTHER_PATH_SEGMENT);
checkAll(matcher);
}
use of android.content.UriMatcher in project android_frameworks_base by ResurrectionRemix.
the class DocumentsProvider method attachInfo.
/**
* Implementation is provided by the parent class.
*/
@Override
public void attachInfo(Context context, ProviderInfo info) {
mAuthority = info.authority;
mMatcher = new UriMatcher(UriMatcher.NO_MATCH);
mMatcher.addURI(mAuthority, "root", MATCH_ROOTS);
mMatcher.addURI(mAuthority, "root/*", MATCH_ROOT);
mMatcher.addURI(mAuthority, "root/*/recent", MATCH_RECENT);
mMatcher.addURI(mAuthority, "root/*/search", MATCH_SEARCH);
mMatcher.addURI(mAuthority, "document/*", MATCH_DOCUMENT);
mMatcher.addURI(mAuthority, "document/*/children", MATCH_CHILDREN);
mMatcher.addURI(mAuthority, "tree/*/document/*", MATCH_DOCUMENT_TREE);
mMatcher.addURI(mAuthority, "tree/*/document/*/children", MATCH_CHILDREN_TREE);
// Sanity check our setup
if (!info.exported) {
throw new SecurityException("Provider must be exported");
}
if (!info.grantUriPermissions) {
throw new SecurityException("Provider must grantUriPermissions");
}
if (!android.Manifest.permission.MANAGE_DOCUMENTS.equals(info.readPermission) || !android.Manifest.permission.MANAGE_DOCUMENTS.equals(info.writePermission)) {
throw new SecurityException("Provider must be protected by MANAGE_DOCUMENTS");
}
super.attachInfo(context, info);
}
use of android.content.UriMatcher in project android_frameworks_base by crdroidandroid.
the class SearchIndexablesProvider method attachInfo.
/**
* Implementation is provided by the parent class.
*/
@Override
public void attachInfo(Context context, ProviderInfo info) {
mAuthority = info.authority;
mMatcher = new UriMatcher(UriMatcher.NO_MATCH);
mMatcher.addURI(mAuthority, SearchIndexablesContract.INDEXABLES_XML_RES_PATH, MATCH_RES_CODE);
mMatcher.addURI(mAuthority, SearchIndexablesContract.INDEXABLES_RAW_PATH, MATCH_RAW_CODE);
mMatcher.addURI(mAuthority, SearchIndexablesContract.NON_INDEXABLES_KEYS_PATH, MATCH_NON_INDEXABLE_KEYS_CODE);
// Sanity check our setup
if (!info.exported) {
throw new SecurityException("Provider must be exported");
}
if (!info.grantUriPermissions) {
throw new SecurityException("Provider must grantUriPermissions");
}
if (!android.Manifest.permission.READ_SEARCH_INDEXABLES.equals(info.readPermission)) {
throw new SecurityException("Provider must be protected by READ_SEARCH_INDEXABLES");
}
super.attachInfo(context, info);
}
use of android.content.UriMatcher in project aware-client by denzilferreira.
the class Telephony_Provider method onCreate.
@Override
public boolean onCreate() {
AUTHORITY = getContext().getPackageName() + ".provider.telephony";
sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
sUriMatcher.addURI(Telephony_Provider.AUTHORITY, DATABASE_TABLES[0], TELEPHONY);
sUriMatcher.addURI(Telephony_Provider.AUTHORITY, DATABASE_TABLES[0] + "/#", TELEPHONY_ID);
sUriMatcher.addURI(Telephony_Provider.AUTHORITY, DATABASE_TABLES[1], GSM);
sUriMatcher.addURI(Telephony_Provider.AUTHORITY, DATABASE_TABLES[1] + "/#", GSM_ID);
sUriMatcher.addURI(Telephony_Provider.AUTHORITY, DATABASE_TABLES[2], NEIGHBOR);
sUriMatcher.addURI(Telephony_Provider.AUTHORITY, DATABASE_TABLES[2] + "/#", NEIGHBOR_ID);
sUriMatcher.addURI(Telephony_Provider.AUTHORITY, DATABASE_TABLES[3], CDMA);
sUriMatcher.addURI(Telephony_Provider.AUTHORITY, DATABASE_TABLES[3] + "/#", CDMA_ID);
telephonyMap = new HashMap<String, String>();
telephonyMap.put(Telephony_Data._ID, Telephony_Data._ID);
telephonyMap.put(Telephony_Data.TIMESTAMP, Telephony_Data.TIMESTAMP);
telephonyMap.put(Telephony_Data.DEVICE_ID, Telephony_Data.DEVICE_ID);
telephonyMap.put(Telephony_Data.DATA_ENABLED, Telephony_Data.DATA_ENABLED);
telephonyMap.put(Telephony_Data.IMEI_MEID_ESN, Telephony_Data.IMEI_MEID_ESN);
telephonyMap.put(Telephony_Data.SOFTWARE_VERSION, Telephony_Data.SOFTWARE_VERSION);
telephonyMap.put(Telephony_Data.LINE_NUMBER, Telephony_Data.LINE_NUMBER);
telephonyMap.put(Telephony_Data.NETWORK_COUNTRY_ISO_MCC, Telephony_Data.NETWORK_COUNTRY_ISO_MCC);
telephonyMap.put(Telephony_Data.NETWORK_OPERATOR_CODE, Telephony_Data.NETWORK_OPERATOR_CODE);
telephonyMap.put(Telephony_Data.NETWORK_OPERATOR_NAME, Telephony_Data.NETWORK_OPERATOR_NAME);
telephonyMap.put(Telephony_Data.NETWORK_TYPE, Telephony_Data.NETWORK_TYPE);
telephonyMap.put(Telephony_Data.PHONE_TYPE, Telephony_Data.PHONE_TYPE);
telephonyMap.put(Telephony_Data.SIM_STATE, Telephony_Data.SIM_STATE);
telephonyMap.put(Telephony_Data.SIM_OPERATOR_CODE, Telephony_Data.SIM_OPERATOR_CODE);
telephonyMap.put(Telephony_Data.SIM_OPERATOR_NAME, Telephony_Data.SIM_OPERATOR_NAME);
telephonyMap.put(Telephony_Data.SIM_SERIAL, Telephony_Data.SIM_SERIAL);
telephonyMap.put(Telephony_Data.SUBSCRIBER_ID, Telephony_Data.SUBSCRIBER_ID);
gsmMap = new HashMap<String, String>();
gsmMap.put(GSM_Data._ID, GSM_Data._ID);
gsmMap.put(GSM_Data.TIMESTAMP, GSM_Data.TIMESTAMP);
gsmMap.put(GSM_Data.DEVICE_ID, GSM_Data.DEVICE_ID);
gsmMap.put(GSM_Data.CID, GSM_Data.CID);
gsmMap.put(GSM_Data.LAC, GSM_Data.LAC);
gsmMap.put(GSM_Data.PSC, GSM_Data.PSC);
gsmMap.put(GSM_Data.SIGNAL_STRENGTH, GSM_Data.SIGNAL_STRENGTH);
gsmMap.put(GSM_Data.GSM_BER, GSM_Data.GSM_BER);
gsmNeighborsMap = new HashMap<String, String>();
gsmNeighborsMap.put(GSM_Neighbors_Data._ID, GSM_Neighbors_Data._ID);
gsmNeighborsMap.put(GSM_Neighbors_Data.TIMESTAMP, GSM_Neighbors_Data.TIMESTAMP);
gsmNeighborsMap.put(GSM_Neighbors_Data.DEVICE_ID, GSM_Neighbors_Data.DEVICE_ID);
gsmNeighborsMap.put(GSM_Neighbors_Data.CID, GSM_Neighbors_Data.CID);
gsmNeighborsMap.put(GSM_Neighbors_Data.LAC, GSM_Neighbors_Data.LAC);
gsmNeighborsMap.put(GSM_Neighbors_Data.PSC, GSM_Neighbors_Data.PSC);
gsmNeighborsMap.put(GSM_Neighbors_Data.SIGNAL_STRENGTH, GSM_Neighbors_Data.SIGNAL_STRENGTH);
cdmaMap = new HashMap<String, String>();
cdmaMap.put(CDMA_Data._ID, CDMA_Data._ID);
cdmaMap.put(CDMA_Data.TIMESTAMP, CDMA_Data.TIMESTAMP);
cdmaMap.put(CDMA_Data.DEVICE_ID, CDMA_Data.DEVICE_ID);
cdmaMap.put(CDMA_Data.BASE_STATION_ID, CDMA_Data.BASE_STATION_ID);
cdmaMap.put(CDMA_Data.BASE_STATION_LATITUDE, CDMA_Data.BASE_STATION_LATITUDE);
cdmaMap.put(CDMA_Data.BASE_STATION_LONGITUDE, CDMA_Data.BASE_STATION_LONGITUDE);
cdmaMap.put(CDMA_Data.NETWORK_ID, CDMA_Data.NETWORK_ID);
cdmaMap.put(CDMA_Data.SYSTEM_ID, CDMA_Data.SYSTEM_ID);
cdmaMap.put(CDMA_Data.SIGNAL_STRENGTH, CDMA_Data.SIGNAL_STRENGTH);
cdmaMap.put(CDMA_Data.CDMA_ECIO, CDMA_Data.CDMA_ECIO);
cdmaMap.put(CDMA_Data.EVDO_DBM, CDMA_Data.EVDO_DBM);
cdmaMap.put(CDMA_Data.EVDO_ECIO, CDMA_Data.EVDO_ECIO);
cdmaMap.put(CDMA_Data.EVDO_SNR, CDMA_Data.EVDO_SNR);
return true;
}
use of android.content.UriMatcher in project aware-client by denzilferreira.
the class Temperature_Provider method onCreate.
@Override
public boolean onCreate() {
AUTHORITY = getContext().getPackageName() + ".provider.temperature";
sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
sUriMatcher.addURI(Temperature_Provider.AUTHORITY, DATABASE_TABLES[0], SENSOR_DEV);
sUriMatcher.addURI(Temperature_Provider.AUTHORITY, DATABASE_TABLES[0] + "/#", SENSOR_DEV_ID);
sUriMatcher.addURI(Temperature_Provider.AUTHORITY, DATABASE_TABLES[1], SENSOR_DATA);
sUriMatcher.addURI(Temperature_Provider.AUTHORITY, DATABASE_TABLES[1] + "/#", SENSOR_DATA_ID);
sensorMap = new HashMap<String, String>();
sensorMap.put(Temperature_Sensor._ID, Temperature_Sensor._ID);
sensorMap.put(Temperature_Sensor.TIMESTAMP, Temperature_Sensor.TIMESTAMP);
sensorMap.put(Temperature_Sensor.DEVICE_ID, Temperature_Sensor.DEVICE_ID);
sensorMap.put(Temperature_Sensor.MAXIMUM_RANGE, Temperature_Sensor.MAXIMUM_RANGE);
sensorMap.put(Temperature_Sensor.MINIMUM_DELAY, Temperature_Sensor.MINIMUM_DELAY);
sensorMap.put(Temperature_Sensor.NAME, Temperature_Sensor.NAME);
sensorMap.put(Temperature_Sensor.POWER_MA, Temperature_Sensor.POWER_MA);
sensorMap.put(Temperature_Sensor.RESOLUTION, Temperature_Sensor.RESOLUTION);
sensorMap.put(Temperature_Sensor.TYPE, Temperature_Sensor.TYPE);
sensorMap.put(Temperature_Sensor.VENDOR, Temperature_Sensor.VENDOR);
sensorMap.put(Temperature_Sensor.VERSION, Temperature_Sensor.VERSION);
sensorDataMap = new HashMap<String, String>();
sensorDataMap.put(Temperature_Data._ID, Temperature_Data._ID);
sensorDataMap.put(Temperature_Data.TIMESTAMP, Temperature_Data.TIMESTAMP);
sensorDataMap.put(Temperature_Data.DEVICE_ID, Temperature_Data.DEVICE_ID);
sensorDataMap.put(Temperature_Data.TEMPERATURE_CELSIUS, Temperature_Data.TEMPERATURE_CELSIUS);
sensorDataMap.put(Temperature_Data.ACCURACY, Temperature_Data.ACCURACY);
sensorDataMap.put(Temperature_Data.LABEL, Temperature_Data.LABEL);
return true;
}
Aggregations