use of android.content.ContentResolver in project platform_frameworks_base by android.
the class WifiDisplayController method updateSettings.
private void updateSettings() {
final ContentResolver resolver = mContext.getContentResolver();
mWifiDisplayOnSetting = Settings.Global.getInt(resolver, Settings.Global.WIFI_DISPLAY_ON, 0) != 0;
mWifiDisplayCertMode = Settings.Global.getInt(resolver, Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON, 0) != 0;
mWifiDisplayWpsConfig = WpsInfo.INVALID;
if (mWifiDisplayCertMode) {
mWifiDisplayWpsConfig = Settings.Global.getInt(resolver, Settings.Global.WIFI_DISPLAY_WPS_CONFIG, WpsInfo.INVALID);
}
updateWfdEnableState();
}
use of android.content.ContentResolver in project platform_frameworks_base by android.
the class ConditionProviders method loadComponentNamesFromSetting.
@Override
@NonNull
protected ArraySet<ComponentName> loadComponentNamesFromSetting(String settingName, int userId) {
final ContentResolver cr = mContext.getContentResolver();
String settingValue = Settings.Secure.getStringForUser(cr, settingName, userId);
if (TextUtils.isEmpty(settingValue))
return new ArraySet<>();
String[] packages = settingValue.split(ENABLED_SERVICES_SEPARATOR);
ArraySet<ComponentName> result = new ArraySet<>(packages.length);
for (int i = 0; i < packages.length; i++) {
if (!TextUtils.isEmpty(packages[i])) {
final ComponentName component = ComponentName.unflattenFromString(packages[i]);
if (component != null) {
result.addAll(queryPackageForServices(component.getPackageName(), userId));
} else {
result.addAll(queryPackageForServices(packages[i], userId));
}
}
}
return result;
}
use of android.content.ContentResolver in project platform_frameworks_base by android.
the class ModelTest method setupTestContext.
private void setupTestContext() {
final MockContentResolver resolver = new MockContentResolver();
context = new ContextWrapper(getContext()) {
@Override
public ContentResolver getContentResolver() {
return resolver;
}
};
provider = new TestContentProvider();
resolver.addProvider(AUTHORITY, provider);
}
use of android.content.ContentResolver in project platform_frameworks_base by android.
the class ConnectivityService method setAirplaneMode.
@Override
public void setAirplaneMode(boolean enable) {
enforceConnectivityInternalPermission();
final long ident = Binder.clearCallingIdentity();
try {
final ContentResolver cr = mContext.getContentResolver();
Settings.Global.putInt(cr, Settings.Global.AIRPLANE_MODE_ON, enable ? 1 : 0);
Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
intent.putExtra("state", enable);
mContext.sendBroadcastAsUser(intent, UserHandle.ALL);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
use of android.content.ContentResolver in project platform_frameworks_base by android.
the class BatteryService method updateBatteryWarningLevelLocked.
private void updateBatteryWarningLevelLocked() {
final ContentResolver resolver = mContext.getContentResolver();
int defWarnLevel = mContext.getResources().getInteger(com.android.internal.R.integer.config_lowBatteryWarningLevel);
mLowBatteryWarningLevel = Settings.Global.getInt(resolver, Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, defWarnLevel);
if (mLowBatteryWarningLevel == 0) {
mLowBatteryWarningLevel = defWarnLevel;
}
if (mLowBatteryWarningLevel < mCriticalBatteryLevel) {
mLowBatteryWarningLevel = mCriticalBatteryLevel;
}
mLowBatteryCloseWarningLevel = mLowBatteryWarningLevel + mContext.getResources().getInteger(com.android.internal.R.integer.config_lowBatteryCloseWarningBump);
processValuesLocked(true);
}
Aggregations