CMSettings: Fix defaults load on provider creation.

The database is innaccessible during creation through
  the android resolver interfaces, thus, no defaults were
  loaded even though the code would execute.

  So rewrite the DatabaseHelper to create a singular bulk transaction
  per table when default settings are to be loaded, and provide
  verification tests for the CMSettingsProvider.

TICKET: CYNGNOS-1706
Change-Id: I3d8c5f25704ec9620fe57b82865531fb976a516f
This commit is contained in:
Adnan Begovic 2016-01-25 11:21:28 -08:00 committed by Gerrit Code Review
parent 910648e8e2
commit d0d4ce972e
4 changed files with 361 additions and 97 deletions

View File

@ -48,10 +48,10 @@ public class CMDatabaseHelper extends SQLiteOpenHelper{
private static final String DATABASE_NAME = "cmsettings.db";
private static final int DATABASE_VERSION = 3;
static class CMTableNames {
static final String TABLE_SYSTEM = "system";
static final String TABLE_SECURE = "secure";
static final String TABLE_GLOBAL = "global";
public static class CMTableNames {
public static final String TABLE_SYSTEM = "system";
public static final String TABLE_SECURE = "secure";
public static final String TABLE_GLOBAL = "global";
}
private static final String CREATE_TABLE_SQL_FORMAT = "CREATE TABLE %s (" +
@ -231,91 +231,109 @@ public class CMDatabaseHelper extends SQLiteOpenHelper{
}
private void loadSecureSettings(SQLiteDatabase db) {
// Secure
loadBooleanSetting(db, CMTableNames.TABLE_SECURE, CMSettings.Secure.ADVANCED_MODE,
R.bool.def_advanced_mode);
SQLiteStatement stmt = null;
try {
stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)"
+ " VALUES(?,?);");
// Secure
loadBooleanSetting(stmt, CMSettings.Secure.ADVANCED_MODE,
R.bool.def_advanced_mode);
loadRegionLockedStringSetting(db, CMTableNames.TABLE_SECURE,
CMSettings.Secure.DEFAULT_THEME_COMPONENTS, R.string.def_theme_components);
loadRegionLockedStringSetting(stmt,
CMSettings.Secure.DEFAULT_THEME_COMPONENTS, R.string.def_theme_components);
loadRegionLockedStringSetting(db, CMTableNames.TABLE_SECURE,
CMSettings.Secure.DEFAULT_THEME_PACKAGE, R.string.def_theme_package);
loadRegionLockedStringSetting(stmt,
CMSettings.Secure.DEFAULT_THEME_PACKAGE, R.string.def_theme_package);
loadIntegerSetting(db, CMTableNames.TABLE_SECURE, CMSettings.Secure.DEV_FORCE_SHOW_NAVBAR,
R.integer.def_force_show_navbar);
loadIntegerSetting(stmt, CMSettings.Secure.DEV_FORCE_SHOW_NAVBAR,
R.integer.def_force_show_navbar);
loadStringSetting(db, CMTableNames.TABLE_SECURE, CMSettings.Secure.QS_TILES,
R.string.def_qs_tiles);
loadStringSetting(stmt, CMSettings.Secure.QS_TILES,
R.string.def_qs_tiles);
loadBooleanSetting(db, CMTableNames.TABLE_SECURE, CMSettings.Secure.QS_USE_MAIN_TILES,
R.bool.def_sysui_qs_main_tiles);
loadBooleanSetting(stmt, CMSettings.Secure.QS_USE_MAIN_TILES,
R.bool.def_sysui_qs_main_tiles);
loadBooleanSetting(db, CMTableNames.TABLE_SECURE, CMSettings.Secure.STATS_COLLECTION,
R.bool.def_stats_collection);
loadBooleanSetting(stmt, CMSettings.Secure.STATS_COLLECTION,
R.bool.def_stats_collection);
loadBooleanSetting(db, CMTableNames.TABLE_SECURE,
CMSettings.Secure.LOCKSCREEN_VISUALIZER_ENABLED, R.bool.def_lockscreen_visualizer);
loadBooleanSetting(stmt, CMSettings.Secure.LOCKSCREEN_VISUALIZER_ENABLED,
R.bool.def_lockscreen_visualizer);
loadStringSetting(db, CMTableNames.TABLE_SECURE,
CMSettings.Secure.PROTECTED_COMPONENT_MANAGERS,
R.string.def_protected_component_managers);
loadStringSetting(stmt,
CMSettings.Secure.PROTECTED_COMPONENT_MANAGERS,
R.string.def_protected_component_managers);
} finally {
if (stmt != null) stmt.close();
}
}
private void loadSystemSettings(SQLiteDatabase db) {
// System
loadIntegerSetting(db, CMTableNames.TABLE_SYSTEM, CMSettings.System.STATUS_BAR_QUICK_QS_PULLDOWN,
R.integer.def_qs_quick_pulldown);
SQLiteStatement stmt = null;
try {
stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)"
+ " VALUES(?,?);");
// System
loadIntegerSetting(stmt, CMSettings.System.STATUS_BAR_QUICK_QS_PULLDOWN,
R.integer.def_qs_quick_pulldown);
loadIntegerSetting(db, CMTableNames.TABLE_SYSTEM, CMSettings.System.NOTIFICATION_LIGHT_BRIGHTNESS_LEVEL,
R.integer.def_notification_brightness_level);
loadIntegerSetting(stmt, CMSettings.System.NOTIFICATION_LIGHT_BRIGHTNESS_LEVEL,
R.integer.def_notification_brightness_level);
loadBooleanSetting(db, CMTableNames.TABLE_SYSTEM, CMSettings.System.NOTIFICATION_LIGHT_MULTIPLE_LEDS_ENABLE,
R.bool.def_notification_multiple_leds);
loadBooleanSetting(stmt, CMSettings.System.NOTIFICATION_LIGHT_MULTIPLE_LEDS_ENABLE,
R.bool.def_notification_multiple_leds);
loadBooleanSetting(db, CMTableNames.TABLE_SYSTEM, CMSettings.System.SYSTEM_PROFILES_ENABLED,
R.bool.def_profiles_enabled);
loadBooleanSetting(stmt, CMSettings.System.SYSTEM_PROFILES_ENABLED,
R.bool.def_profiles_enabled);
loadIntegerSetting(db, CMTableNames.TABLE_SYSTEM, CMSettings.System.ENABLE_PEOPLE_LOOKUP,
R.integer.def_people_lookup);
loadIntegerSetting(stmt, CMSettings.System.ENABLE_PEOPLE_LOOKUP,
R.integer.def_people_lookup);
loadBooleanSetting(stmt, CMSettings.System.NOTIFICATION_LIGHT_PULSE_CUSTOM_ENABLE,
R.bool.def_notification_pulse_custom_enable);
loadBooleanSetting(db, CMTableNames.TABLE_SYSTEM, CMSettings.System.NOTIFICATION_LIGHT_PULSE_CUSTOM_ENABLE,
R.bool.def_notification_pulse_custom_enable);
loadBooleanSetting(stmt, CMSettings.System.SWAP_VOLUME_KEYS_ON_ROTATION,
R.bool.def_swap_volume_keys_on_rotation);
loadBooleanSetting(db, CMTableNames.TABLE_SYSTEM, CMSettings.System.SWAP_VOLUME_KEYS_ON_ROTATION,
R.bool.def_swap_volume_keys_on_rotation);
if (mContext.getResources().getBoolean(R.bool.def_notification_pulse_custom_enable)) {
loadStringSetting(db, CMTableNames.TABLE_SYSTEM, CMSettings.System.NOTIFICATION_LIGHT_PULSE_CUSTOM_VALUES,
R.string.def_notification_pulse_custom_value);
if (mContext.getResources().getBoolean(R.bool.def_notification_pulse_custom_enable)) {
loadStringSetting(stmt, CMSettings.System.NOTIFICATION_LIGHT_PULSE_CUSTOM_VALUES,
R.string.def_notification_pulse_custom_value);
}
} finally {
if (stmt != null) stmt.close();
}
}
private void loadGlobalSettings(SQLiteDatabase db) {
// Global
loadBooleanSetting(db, CMTableNames.TABLE_GLOBAL,
CMSettings.Global.POWER_NOTIFICATIONS_ENABLED,
R.bool.def_power_notifications_enabled);
SQLiteStatement stmt = null;
try {
stmt = db.compileStatement("INSERT OR IGNORE INTO global(name,value)"
+ " VALUES(?,?);");
// Global
loadBooleanSetting(stmt,
CMSettings.Global.POWER_NOTIFICATIONS_ENABLED,
R.bool.def_power_notifications_enabled);
loadBooleanSetting(db, CMTableNames.TABLE_GLOBAL,
CMSettings.Global.POWER_NOTIFICATIONS_VIBRATE,
R.bool.def_power_notifications_vibrate);
loadBooleanSetting(stmt,
CMSettings.Global.POWER_NOTIFICATIONS_VIBRATE,
R.bool.def_power_notifications_vibrate);
loadStringSetting(db, CMTableNames.TABLE_GLOBAL,
CMSettings.Global.POWER_NOTIFICATIONS_RINGTONE,
R.string.def_power_notifications_ringtone);
loadStringSetting(stmt,
CMSettings.Global.POWER_NOTIFICATIONS_RINGTONE,
R.string.def_power_notifications_ringtone);
} finally {
if (stmt != null) stmt.close();
}
}
/**
* Loads a region locked string setting into a database table. If the resource for the specific
* mcc is not found, the setting is loaded from the default resources.
* @param db The {@link SQLiteDatabase} to insert into.
* @param tableName The name of the table to insert into.
* @param stmt The SQLLiteStatement (transaction) for this setting.
* @param name The name of the value to insert into the table.
* @param resId The name of the string resource.
*/
private void loadRegionLockedStringSetting(SQLiteDatabase db, String tableName, String name,
int resId) {
private void loadRegionLockedStringSetting(SQLiteStatement stmt, String name, int resId) {
String mcc = SystemProperties.get(MCC_PROP_NAME);
Resources customResources = null;
@ -345,73 +363,47 @@ public class CMDatabaseHelper extends SQLiteOpenHelper{
String value = customResources == null ? mContext.getResources().getString(resId)
: customResources.getString(resId);
loadSettingsForTable(db, tableName, name, value);
loadSetting(stmt, name, value);
}
/**
* Loads a string resource into a database table. If a conflict occurs, that value is not
* inserted into the database table.
* @param db The {@link SQLiteDatabase} to insert into.
* @param tableName The name of the table to insert into.
* @param stmt The SQLLiteStatement (transaction) for this setting.
* @param name The name of the value to insert into the table.
* @param resId The name of the string resource.
*/
private void loadStringSetting(SQLiteDatabase db, String tableName, String name, int resId) {
loadSettingsForTable(db, tableName, name, mContext.getResources().getString(resId));
private void loadStringSetting(SQLiteStatement stmt, String name, int resId) {
loadSetting(stmt, name, mContext.getResources().getString(resId));
}
/**
* Loads a boolean resource into a database table. If a conflict occurs, that value is not
* inserted into the database table.
* @param db The {@link SQLiteDatabase} to insert into.
* @param tableName The name of the table to insert into.
* @param stmt The SQLLiteStatement (transaction) for this setting.
* @param name The name of the value to insert into the table.
* @param resId The name of the boolean resource.
*/
private void loadBooleanSetting(SQLiteDatabase db, String tableName, String name, int resId) {
loadSettingsForTable(db, tableName, name,
private void loadBooleanSetting(SQLiteStatement stmt, String name, int resId) {
loadSetting(stmt, name,
mContext.getResources().getBoolean(resId) ? "1" : "0");
}
/**
* Loads an integer resource into a database table. If a conflict occurs, that value is not
* inserted into the database table.
* @param db The {@link SQLiteDatabase} to insert into.
* @param tableName The name of the table to insert into.
* @param stmt The SQLLiteStatement (transaction) for this setting.
* @param name The name of the value to insert into the table.
* @param resId The name of the integer resource.
*/
private void loadIntegerSetting(SQLiteDatabase db, String tableName, String name, int resId) {
loadSettingsForTable(db, tableName, name,
private void loadIntegerSetting(SQLiteStatement stmt, String name, int resId) {
loadSetting(stmt, name,
Integer.toString(mContext.getResources().getInteger(resId)));
}
/**
* Loads a name/value pair into a database table. If a conflict occurs, that value is not
* inserted into the database table.
* @param db The {@link SQLiteDatabase} to insert into.
* @param tableName The name of the table to insert into.
* @param name The name of the value to insert into the table.
* @param value The value to insert into the table.
*/
private void loadSettingsForTable(SQLiteDatabase db, String tableName, String name,
String value) {
if (LOCAL_LOGV) Log.d(TAG, "Loading key: " + name + ", value: " + value);
ContentValues contentValues = new ContentValues();
contentValues.put(Settings.NameValueTable.NAME, name);
contentValues.put(Settings.NameValueTable.VALUE, value);
db.insertWithOnConflict(tableName, null, contentValues, SQLiteDatabase.CONFLICT_IGNORE);
}
private void loadSetting(SQLiteStatement stmt, String key, Object value) {
stmt.bindString(1, key);
stmt.bindString(2, value.toString());
stmt.execute();
}
private void loadStringSetting(SQLiteStatement stmt, String key, int resid) {
loadSetting(stmt, key, mContext.getResources().getString(resid));
}
}

View File

@ -55,12 +55,12 @@ import java.util.Set;
* The CMSettingsProvider serves as a {@link ContentProvider} for CM specific settings
*/
public class CMSettingsProvider extends ContentProvider {
static final String TAG = "CMSettingsProvider";
public static final String TAG = "CMSettingsProvider";
private static final boolean LOCAL_LOGV = false;
private static final boolean USER_CHECK_THROWS = true;
static final String PREF_HAS_MIGRATED_CM_SETTINGS = "has_migrated_cm13_settings";
public static final String PREF_HAS_MIGRATED_CM_SETTINGS = "has_migrated_cm13_settings";
private static final Bundle NULL_SETTING = Bundle.forPair("value", null);

View File

@ -0,0 +1,272 @@
/**
* Copyright (c) 2016, The CyanogenMod 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 org.cyanogenmod.cmsettings.tests;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.UserHandle;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
import java.util.ArrayList;
import android.text.TextUtils;
import android.util.Log;
import android.util.TypedValue;
import cyanogenmod.providers.CMSettings;
import org.cyanogenmod.cmsettings.CMDatabaseHelper;
import org.cyanogenmod.cmsettings.CMSettingsProvider;
import org.cyanogenmod.cmsettings.R;
/**
* Created by adnan on 1/25/16.
*/
public class CMSettingsProviderDefaultsTest extends AndroidTestCase {
private ContentResolver mContentResolver;
private boolean mHasMigratedSettings;
private Resources mRemoteResources;
// These data structures are set up in a way that is easier for manual input of new defaults
private static ArrayList<Setting> SYSTEM_SETTINGS_DEFAULTS = new ArrayList<Setting>();
private static ArrayList<Setting> SECURE_SETTINGS_DEFAULTS = new ArrayList<Setting>();
private static ArrayList<Setting> GLOBAL_SETTINGS_DEFAULTS = new ArrayList<Setting>();
//SYSTEM
static {
SYSTEM_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.System.STATUS_BAR_QUICK_QS_PULLDOWN,
"R.integer.def_qs_quick_pulldown"));
SYSTEM_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.System.NOTIFICATION_LIGHT_BRIGHTNESS_LEVEL,
"R.integer.def_notification_brightness_level"));
SYSTEM_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.System.ENABLE_PEOPLE_LOOKUP,
"R.integer.def_people_lookup"));
SYSTEM_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.System.NOTIFICATION_LIGHT_MULTIPLE_LEDS_ENABLE,
"R.bool.def_notification_multiple_leds"));
SYSTEM_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.System.SYSTEM_PROFILES_ENABLED,
"R.bool.def_profiles_enabled"));
SYSTEM_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.System.NOTIFICATION_LIGHT_PULSE_CUSTOM_ENABLE,
"R.bool.def_notification_pulse_custom_enable"));
SYSTEM_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.System.SWAP_VOLUME_KEYS_ON_ROTATION,
"R.bool.def_swap_volume_keys_on_rotation"));
SYSTEM_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.System.NOTIFICATION_LIGHT_PULSE_CUSTOM_VALUES,
"R.string.def_notification_pulse_custom_value"));
}
//SECURE
static {
SECURE_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.Secure.DEV_FORCE_SHOW_NAVBAR,
"R.integer.def_force_show_navbar"));
SECURE_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.Secure.ADVANCED_MODE,
"R.bool.def_advanced_mode"));
SECURE_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.Secure.QS_USE_MAIN_TILES,
"R.bool.def_sysui_qs_main_tiles"));
SECURE_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.Secure.STATS_COLLECTION,
"R.bool.def_stats_collection"));
SECURE_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.Secure.LOCKSCREEN_VISUALIZER_ENABLED,
"R.bool.def_lockscreen_visualizer"));
SECURE_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.Secure.DEFAULT_THEME_COMPONENTS,
"R.string.def_theme_components"));
SECURE_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.Secure.DEFAULT_THEME_PACKAGE,
"R.string.def_theme_package"));
SECURE_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.Secure.QS_TILES,
"R.string.def_qs_tiles"));
SECURE_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.Secure.PROTECTED_COMPONENT_MANAGERS,
"R.string.def_protected_component_managers"));
}
//GLOBAL
static {
GLOBAL_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.Global.POWER_NOTIFICATIONS_ENABLED,
"R.bool.def_power_notifications_enabled"));
GLOBAL_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.Global.POWER_NOTIFICATIONS_VIBRATE,
"R.bool.def_power_notifications_vibrate"));
GLOBAL_SETTINGS_DEFAULTS.add(new Setting(
CMSettings.Global.POWER_NOTIFICATIONS_RINGTONE,
"R.string.def_power_notifications_ringtone"));
}
@Override
protected void setUp() throws Exception {
super.setUp();
mContentResolver = getContext().getContentResolver();
mHasMigratedSettings = getContext().getSharedPreferences(CMSettingsProvider.TAG,
Context.MODE_PRIVATE).getBoolean(CMSettingsProvider.PREF_HAS_MIGRATED_CM_SETTINGS,
false);
mRemoteResources = getRemoteResources("org.cyanogenmod.cmsettings");
}
@SmallTest
public void testVerifySystemSettingsDefault() {
if (verifyNotMigratedSettings()) {
for (Setting setting : SYSTEM_SETTINGS_DEFAULTS) {
verifyDefaultSettingForTable(setting, CMDatabaseHelper.CMTableNames.TABLE_SYSTEM);
}
}
}
@SmallTest
public void testVerifySecureSettingsDefaults() {
if (verifyNotMigratedSettings()) {
for (Setting setting : SECURE_SETTINGS_DEFAULTS) {
verifyDefaultSettingForTable(setting, CMDatabaseHelper.CMTableNames.TABLE_SECURE);
}
}
}
@SmallTest
public void testVerifyGlobalSettingsDefaults() {
if (verifyNotMigratedSettings()) {
for (Setting setting : GLOBAL_SETTINGS_DEFAULTS) {
verifyDefaultSettingForTable(setting, CMDatabaseHelper.CMTableNames.TABLE_GLOBAL);
}
}
}
private boolean verifyNotMigratedSettings() {
return !mHasMigratedSettings;
}
private void verifyDefaultSettingForTable(Setting setting, String table) {
TypedValue value = new TypedValue();
try {
int identifier = mRemoteResources.getIdentifier(
setting.mDefResName, setting.mType, "org.cyanogenmod.cmsettings");
mRemoteResources.getValue(identifier, value, true);
} catch (Resources.NotFoundException e) {
// Resource not found, can't verify because it probably wasn't loaded in
throw new AssertionError("Unable to find resource for " + setting.mKey);
}
try {
switch (value.type) {
case TypedValue.TYPE_INT_DEC:
int actualValue = getIntForTable(setting, table);
try {
assertEquals(value.data, actualValue);
} catch (AssertionError e) {
throw new AssertionError("Compared value of " + setting.mKey + " expected "
+ value.data + " got " + actualValue);
}
break;
case TypedValue.TYPE_INT_BOOLEAN:
int actualBooleanValue = getIntForTable(setting, table);
try {
//This is gross
//Boolean can be "true" as long as it isn't 0
if (value.data != 0) {
value.data = 1;
}
assertEquals(value.data, actualBooleanValue);
} catch (AssertionError e) {
throw new AssertionError("Compared value of " + setting.mKey + " expected "
+ value.data + " got " + actualBooleanValue);
}
break;
case TypedValue.TYPE_STRING:
if (!TextUtils.isEmpty(value.string)) {
//This should really be done as a parameterized test
String actualStringValue = getStringForTable(setting, table);
try {
assertEquals(value.string, actualStringValue);
} catch (AssertionError e) {
throw new AssertionError("Compared value of " + setting.mKey
+ " expected " + value.string + " got " + actualStringValue);
}
}
break;
case TypedValue.TYPE_NULL:
break;
}
} catch (CMSettings.CMSettingNotFoundException e) {
e.printStackTrace();
throw new AssertionError("Setting " + setting.mKey + " not found!");
}
}
private int getIntForTable(Setting setting, String table)
throws CMSettings.CMSettingNotFoundException {
switch (table) {
case CMDatabaseHelper.CMTableNames.TABLE_SYSTEM:
return CMSettings.System.getIntForUser(mContentResolver, setting.mKey,
UserHandle.USER_OWNER);
case CMDatabaseHelper.CMTableNames.TABLE_SECURE:
return CMSettings.Secure.getIntForUser(mContentResolver, setting.mKey,
UserHandle.USER_OWNER);
case CMDatabaseHelper.CMTableNames.TABLE_GLOBAL:
return CMSettings.Global.getIntForUser(mContentResolver, setting.mKey,
UserHandle.USER_OWNER);
default:
throw new AssertionError("Invalid or empty table!");
}
}
private String getStringForTable(Setting setting, String table)
throws CMSettings.CMSettingNotFoundException {
switch (table) {
case CMDatabaseHelper.CMTableNames.TABLE_SYSTEM:
return CMSettings.System.getStringForUser(mContentResolver, setting.mKey,
UserHandle.USER_OWNER);
case CMDatabaseHelper.CMTableNames.TABLE_SECURE:
return CMSettings.Secure.getStringForUser(mContentResolver, setting.mKey,
UserHandle.USER_OWNER);
case CMDatabaseHelper.CMTableNames.TABLE_GLOBAL:
return CMSettings.Global.getStringForUser(mContentResolver, setting.mKey,
UserHandle.USER_OWNER);
default:
throw new AssertionError("Invalid or empty table!");
}
}
private static class Setting {
public String mKey;
public String mDefResName;
public String mType;
public Setting(String key, String defResId) {
mKey = key;
String[] parts = defResId.split("\\.");
mType = parts[1];
mDefResName = parts[2];
}
}
private Resources getRemoteResources(String packageName)
throws PackageManager.NameNotFoundException {
PackageManager packageManager = mContext.getPackageManager();
return packageManager.getResourcesForApplication(packageName);
}
}

View File

@ -223,7 +223,7 @@ import java.util.Map;
@MediumTest
public void testInsertUpdateDeleteSuccess() {
testInsertUpdateDeleteForUri(CMSettings.System.CONTENT_URI);
//testInsertUpdateDeleteForUri(CMSettings.System.CONTENT_URI);
testInsertUpdateDeleteForUri(CMSettings.Secure.CONTENT_URI);
testInsertUpdateDeleteForUri(CMSettings.Global.CONTENT_URI);
}