use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.
the class DisplayPowerController method updateAutomaticBrightnessSettings.
private void updateAutomaticBrightnessSettings() {
int[] lux = getIntArrayForSetting(Settings.System.AUTO_BRIGHTNESS_LUX);
int[] values = getIntArrayForSetting(Settings.System.AUTO_BRIGHTNESS_BACKLIGHT);
Resources res = mContext.getResources();
mScreenAutoBrightnessSpline = null;
mUseSoftwareAutoBrightnessConfig = true;
if (lux != null && values != null) {
mScreenAutoBrightnessSpline = createAutoBrightnessSpline(lux, values);
if (mScreenAutoBrightnessSpline == null) {
Slog.w(TAG, "Found invalid auto-brightness configuration, falling back to default");
}
}
if (mScreenAutoBrightnessSpline == null) {
lux = res.getIntArray(com.android.internal.R.array.config_autoBrightnessLevels);
values = res.getIntArray(com.android.internal.R.array.config_autoBrightnessLcdBacklightValues);
mScreenAutoBrightnessSpline = createAutoBrightnessSpline(lux, values);
}
if (mScreenAutoBrightnessSpline == null) {
Slog.e(TAG, "Error in config.xml. config_autoBrightnessLcdBacklightValues " + "(size " + values.length + ") " + "must be monotic and have exactly one more entry than " + "config_autoBrightnessLevels (size " + lux.length + ") " + "which must be strictly increasing. " + "Auto-brightness will be disabled.");
mUseSoftwareAutoBrightnessConfig = false;
return;
}
}
use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.
the class PowerManagerService method readConfigurationLocked.
private void readConfigurationLocked() {
final Resources resources = mContext.getResources();
mWakeUpWhenPluggedOrUnpluggedConfig = resources.getBoolean(com.android.internal.R.bool.config_unplugTurnsOnScreen);
mDreamsSupportedConfig = resources.getBoolean(com.android.internal.R.bool.config_dreamsSupported);
mDreamsEnabledByDefaultConfig = resources.getBoolean(com.android.internal.R.bool.config_dreamsEnabledByDefault);
mDreamsActivatedOnSleepByDefaultConfig = resources.getBoolean(com.android.internal.R.bool.config_dreamsActivatedOnSleepByDefault);
mDreamsActivatedOnDockByDefaultConfig = resources.getBoolean(com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault);
}
use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.
the class MountServiceTests method copyRawToFile.
private void copyRawToFile(int rawResId, File outFile) {
Resources res = mContext.getResources();
InputStream is = null;
try {
is = res.openRawResource(rawResId);
} catch (NotFoundException e) {
fail("Failed to load resource with id: " + rawResId);
}
FileUtils.setPermissions(outFile.getPath(), FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IRWXO, -1, -1);
assertTrue(FileUtils.copyToFile(is, outFile));
FileUtils.setPermissions(outFile.getPath(), FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IRWXO, -1, -1);
}
use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.
the class GsmAlphabet method enableCountrySpecificEncodings.
/**
* Enable country-specific language tables from MCC-specific overlays.
* @context the context to use to get the TelephonyManager
*/
private static void enableCountrySpecificEncodings() {
Resources r = Resources.getSystem();
// See comments in frameworks/base/core/res/res/values/config.xml for allowed values
sEnabledSingleShiftTables = r.getIntArray(R.array.config_sms_enabled_single_shift_tables);
sEnabledLockingShiftTables = r.getIntArray(R.array.config_sms_enabled_locking_shift_tables);
if (sEnabledSingleShiftTables.length > 0) {
sHighestEnabledSingleShiftCode = sEnabledSingleShiftTables[sEnabledSingleShiftTables.length - 1];
} else {
sHighestEnabledSingleShiftCode = 0;
}
}
use of android.content.res.Resources in project android_frameworks_base by ParanoidAndroid.
the class Summarizer method getWebKitVersionFromUserAgentString.
private String getWebKitVersionFromUserAgentString() {
Resources resources = new Resources(new AssetManager(), new DisplayMetrics(), new Configuration());
String userAgent = resources.getString(com.android.internal.R.string.web_user_agent);
Matcher matcher = Pattern.compile("AppleWebKit/([0-9]+?\\.[0-9])").matcher(userAgent);
if (matcher.find()) {
return matcher.group(1);
}
return "unknown";
}
Aggregations