Search in sources :

Example 31 with ContentResolver

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();
}
Also used : ContentResolver(android.content.ContentResolver)

Example 32 with ContentResolver

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;
}
Also used : ArraySet(android.util.ArraySet) ComponentName(android.content.ComponentName) ContentResolver(android.content.ContentResolver) NonNull(android.annotation.NonNull)

Example 33 with ContentResolver

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);
}
Also used : MockContentResolver(android.test.mock.MockContentResolver) ContextWrapper(android.content.ContextWrapper) ContentResolver(android.content.ContentResolver) MockContentResolver(android.test.mock.MockContentResolver)

Example 34 with ContentResolver

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);
    }
}
Also used : PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) ContentResolver(android.content.ContentResolver)

Example 35 with ContentResolver

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);
}
Also used : ContentResolver(android.content.ContentResolver)

Aggregations

ContentResolver (android.content.ContentResolver)1198 Uri (android.net.Uri)243 Cursor (android.database.Cursor)196 ContentValues (android.content.ContentValues)116 Intent (android.content.Intent)94 RemoteException (android.os.RemoteException)67 IOException (java.io.IOException)62 Context (android.content.Context)58 ArrayList (java.util.ArrayList)50 File (java.io.File)48 Resources (android.content.res.Resources)46 ComponentName (android.content.ComponentName)44 MediumTest (android.test.suitebuilder.annotation.MediumTest)37 PreferenceScreen (android.support.v7.preference.PreferenceScreen)35 Bitmap (android.graphics.Bitmap)33 ContentObserver (android.database.ContentObserver)28 FileNotFoundException (java.io.FileNotFoundException)28 PendingIntent (android.app.PendingIntent)25 MockContentResolver (android.test.mock.MockContentResolver)25 AssetFileDescriptor (android.content.res.AssetFileDescriptor)24