Java 类android.provider.Settings.System 实例源码

项目:lineagex86    文件:OtherSoundSettings.java   
private void launchNotificationSoundPicker(int code, String currentPowerRingtonePath) {
    final Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);

    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE,
            getString(R.string.power_notifications_ringtone_title));
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE,
            RingtoneManager.TYPE_NOTIFICATION);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI,
            System.DEFAULT_NOTIFICATION_URI);
    if (currentPowerRingtonePath != null &&
            !currentPowerRingtonePath.equals(POWER_NOTIFICATIONS_SILENT_URI)) {
        Uri uri = Uri.parse(currentPowerRingtonePath);
        if (uri != null) {
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, uri);
        }
    }
    startActivityForResult(intent, code);
}
项目:letv    文件:bt.java   
private static Locale y(Context context) {
    Locale locale = null;
    try {
        Configuration configuration = new Configuration();
        configuration.setToDefaults();
        System.getConfiguration(context.getContentResolver(), configuration);
        if (configuration != null) {
            locale = configuration.locale;
        }
    } catch (Exception e) {
        bv.c(a, "fail to read user config locale");
    }
    if (locale == null) {
        return Locale.getDefault();
    }
    return locale;
}
项目:letv    文件:UIsUtils.java   
@Nullable
private static int getMeizuNaviogationBarHeight(Context context) {
    int dimensionPixelSize;
    boolean autoHideSmartBar = true;
    boolean z = false;
    boolean isMeiZu = Build.MANUFACTURER.equals("Meizu");
    if (System.getInt(context.getContentResolver(), "mz_smartbar_auto_hide", z) != 1) {
        autoHideSmartBar = z;
    }
    if (isMeiZu && !autoHideSmartBar) {
        try {
            Class c = Class.forName("com.android.internal.R$dimen");
            dimensionPixelSize = context.getResources().getDimensionPixelSize(
                    Integer.parseInt(c.getField("mz_action_button_min_height")
                            .get(c.newInstance()).toString()));
        } catch (Throwable th) {
        }
    }
    return dimensionPixelSize;
}
项目:boohee_v5.6    文件:bt.java   
private static Locale A(Context context) {
    Locale locale = null;
    try {
        Configuration configuration = new Configuration();
        configuration.setToDefaults();
        System.getConfiguration(context.getContentResolver(), configuration);
        if (configuration != null) {
            locale = configuration.locale;
        }
    } catch (Exception e) {
        bv.c(a, "fail to read user config locale");
    }
    if (locale == null) {
        return Locale.getDefault();
    }
    return locale;
}
项目:GravityBox    文件:VolumePreference.java   
private void initSeekBar(SeekBar seekBar, Uri defaultUri) {
    seekBar.setMax(mAudioManager.getStreamMaxVolume(mStreamType));
    mOriginalStreamVolume = mAudioManager.getStreamVolume(mStreamType);
    seekBar.setProgress(mOriginalStreamVolume);
    seekBar.setOnSeekBarChangeListener(this);
    // TODO: removed in MM, find different approach
    mContext.getContentResolver().registerContentObserver(
            System.getUriFor("volume_ring"),
            false, mVolumeObserver);
    if (defaultUri == null) {
        if (mStreamType == AudioManager.STREAM_RING) {
            defaultUri = Settings.System.DEFAULT_RINGTONE_URI;
        } else if (mStreamType == AudioManager.STREAM_NOTIFICATION) {
            defaultUri = Settings.System.DEFAULT_NOTIFICATION_URI;
        } else {
            defaultUri = Settings.System.DEFAULT_ALARM_ALERT_URI;
        }
    }
    mRingtone = RingtoneManager.getRingtone(mContext, defaultUri);
    if (mRingtone != null) {
        mRingtone.setStreamType(mStreamType);
    }
}
项目:SimpleUILauncher    文件:SettingsActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getPreferenceManager().setSharedPreferencesName(LauncherFiles.SHARED_PREFERENCES_KEY);
    addPreferencesFromResource(R.xml.launcher_preferences);

    // Setup allow rotation preference
    Preference rotationPref = findPreference(Utilities.ALLOW_ROTATION_PREFERENCE_KEY);
    if (getResources().getBoolean(R.bool.allow_rotation)) {
        // Launcher supports rotation by default. No need to show this setting.
        getPreferenceScreen().removePreference(rotationPref);
    } else {
        ContentResolver resolver = getActivity().getContentResolver();
        mRotationLockObserver = new SystemDisplayRotationLockObserver(rotationPref, resolver);

        // Register a content observer to listen for system setting changes while
        // this UI is active.
        resolver.registerContentObserver(
                Settings.System.getUriFor(System.ACCELEROMETER_ROTATION),
                false, mRotationLockObserver);

        // Initialize the UI once
        mRotationLockObserver.onChange(true);
        rotationPref.setDefaultValue(Utilities.getAllowRotationDefaultValue(getActivity()));
    }
}
项目:cordova-volume    文件:Volume.java   
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    if ("getVolume".equals(action)) {
        triggerEvent(callbackContext, currentVolume(), false);
        return true;
    } else if ("setVolumenChangeCallback".equals(action)) {
        changedEventCallback = callbackContext;

        SettingsContentObserver observer = new SettingsContentObserver(new Handler());
        context.getContentResolver().registerContentObserver(System.CONTENT_URI, true, observer);

        return true;
    }

    return false;
}
项目:femtocatcher    文件:MainActivity.java   
@SuppressLint("InlinedApi")
public void toggleRadio(){
    /* If you can change the airplane mode, turn on the airplane mode and let the user know */
    if(ChangeAirplaneMode){

        System.putLong(getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1);
        long isEnabled = System.getLong(getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, -1);
        Log.v(TAG, "airplane mode now is: "+isEnabled);

        Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
        intent.putExtra("state", false);
        sendBroadcast(intent);
    }

    Intent myIntent = new Intent(MainActivity.this, DetectedFemtoActivity.class);
       Bundle b = new Bundle();
       b.putBoolean("ChangeAirplaneMode", ChangeAirplaneMode);
       myIntent.putExtras(b); 
       startActivity(myIntent);
}
项目:lineagex86    文件:SettingPref.java   
private static Uri getUriFor(int type, String setting) {
    switch(type) {
        case TYPE_GLOBAL:
            return Global.getUriFor(setting);
        case TYPE_SYSTEM:
            return System.getUriFor(setting);
    }
    throw new IllegalArgumentException();
}
项目:lineagex86    文件:SettingPref.java   
protected static boolean putInt(int type, ContentResolver cr, String setting, int value) {
    switch(type) {
        case TYPE_GLOBAL:
            return Global.putInt(cr, setting, value);
        case TYPE_SYSTEM:
            return System.putInt(cr, setting, value);
    }
    throw new IllegalArgumentException();
}
项目:lineagex86    文件:SettingPref.java   
protected static int getInt(int type, ContentResolver cr, String setting, int def) {
    switch(type) {
        case TYPE_GLOBAL:
            return Global.getInt(cr, setting, def);
        case TYPE_SYSTEM:
            return System.getInt(cr, setting, def);
    }
    throw new IllegalArgumentException();
}
项目:LaunchEnr    文件:SettingsActivity.java   
@Override
public void onChange(boolean selfChange) {
    boolean enabled = Settings.System.getInt(mResolver,
            Settings.System.ACCELEROMETER_ROTATION, 1) == 1;
    mRotationPref.setEnabled(enabled);
    mRotationPref.setSummary(enabled
            ? R.string.allow_rotation_desc : R.string.allow_rotation_blocked_desc);
}
项目:letv    文件:AlbumGestureController.java   
private int getScreenBrightness() {
    int screenBrightness = 255;
    try {
        screenBrightness = System.getInt(this.mActivity.getContentResolver(), "screen_brightness");
    } catch (Exception exception) {
        exception.printStackTrace();
    }
    return screenBrightness;
}
项目:letv    文件:BasePlayController.java   
public BasePlayController(Context context, PlayActivityCallback playCallback) {
    if (HotFix.PREVENT_VERIFY) {
        System.out.println(VerifyLoad.class);
    }
    this.mLaunchMode = 0;
    this.mLiveBarrageSentCallback = null;
    this.currentB = 0;
    this.mContext = context;
    this.mPlayCallback = playCallback;
}
项目:letv    文件:BasePlayController.java   
private int getScreenBrightness() {
    int screenBrightness = 255;
    try {
        screenBrightness = System.getInt(getActivity().getContentResolver(), "screen_brightness");
    } catch (SettingNotFoundException e) {
    }
    return screenBrightness;
}
项目:letv    文件:Device.java   
public static String getFreeCallDeviceId(Context context) {
    if (!TextUtils.isEmpty(m2)) {
        return m2;
    }
    String imei = getIMEI(context);
    String AndroidID = System.getString(context.getContentResolver(), "android_id");
    String _m2 = getMD5("" + imei + AndroidID + getDeviceSerialForMid2());
    m2 = _m2;
    return _m2;
}
项目:letv    文件:a.java   
public static void b(Context context, String str, String str2, int i) {
    Notification notification;
    Intent intent = new Intent(context, PushReceiver.class);
    intent.setAction(z[69]);
    intent.putExtra(z[70], true);
    intent.putExtra(z[96], str2);
    intent.putExtra(z[11], i);
    PendingIntent broadcast = PendingIntent.getBroadcast(context, 0, intent, 134217728);
    NotificationManager notificationManager = (NotificationManager) context.getSystemService(z[68]);
    int i2 = -1;
    try {
        i2 = context.getPackageManager().getPackageInfo(context.getPackageName(), 256).applicationInfo.icon;
    } catch (NameNotFoundException e) {
    }
    if (i2 < 0) {
        i2 = 17301586;
    }
    Object obj = z[95];
    Object obj2 = z[94];
    long currentTimeMillis = System.currentTimeMillis();
    if (VERSION.SDK_INT >= 11) {
        notification = new Builder(context.getApplicationContext()).setContentTitle(obj).setContentText(obj2).setContentIntent(broadcast).setSmallIcon(i2).setTicker(str).setWhen(currentTimeMillis).getNotification();
        notification.flags = 34;
    } else {
        Notification notification2 = new Notification(i2, str, currentTimeMillis);
        notification2.flags = 34;
        m.a(notification2, context, obj, obj2, broadcast);
        notification = notification2;
    }
    if (notification != null) {
        notificationManager.notify(str.hashCode(), notification);
    }
}
项目:letv    文件:a.java   
public static void c(Context context, String str, String str2) {
    if (g(context)) {
        Notification notification;
        z.b();
        Intent intent = new Intent(context, PushReceiver.class);
        intent.setAction(z[69]);
        intent.putExtra(z[70], true);
        intent.putExtra(z[71], str2);
        PendingIntent broadcast = PendingIntent.getBroadcast(context, 0, intent, 134217728);
        NotificationManager notificationManager = (NotificationManager) context.getSystemService(z[68]);
        int i = -1;
        try {
            i = context.getPackageManager().getPackageInfo(context.getPackageName(), 256).applicationInfo.icon;
        } catch (NameNotFoundException e) {
        }
        if (i < 0) {
            i = 17301586;
        }
        Object obj = z[67];
        Object obj2 = z[66];
        long currentTimeMillis = System.currentTimeMillis();
        if (VERSION.SDK_INT >= 11) {
            notification = new Builder(context.getApplicationContext()).setContentTitle(obj).setContentText(obj2).setContentIntent(broadcast).setSmallIcon(i).setTicker(str).setWhen(currentTimeMillis).getNotification();
            notification.flags = 34;
        } else {
            Notification notification2 = new Notification(i, str, currentTimeMillis);
            notification2.flags = 34;
            m.a(notification2, context, obj, obj2, broadcast);
            notification = notification2;
        }
        if (notification != null) {
            notificationManager.notify(str.hashCode(), notification);
        }
    }
}
项目:letv    文件:a.java   
private static String n(Context context, String str) {
    if (c(context, z[73])) {
        try {
            str = System.getString(context.getContentResolver(), z[72]);
        } catch (Exception e) {
            z.e();
        }
    }
    return str;
}
项目:letv    文件:a.java   
private static String o(Context context, String str) {
    if (c(context, z[73])) {
        try {
            if (System.putString(context.getContentResolver(), z[72], str)) {
                return str;
            }
        } catch (Exception e) {
            z.e();
        }
    }
    return null;
}
项目:boohee_v5.6    文件:a.java   
public boolean e(String str, String str2) {
    if (!this.e) {
        return false;
    }
    System.putString(this.f.getContentResolver(), str, str2);
    return true;
}
项目:boohee_v5.6    文件:e.java   
protected final String b() {
    String string;
    synchronized (this) {
        Log.i("MID", "read mid from Settings.System");
        string = System.getString(this.e.getContentResolver(), h.f
                ("4kU71lN96TJUomD1vOU9lgj9Tw=="));
    }
    return string;
}
项目:boohee_v5.6    文件:HapticFeedbackController.java   
public void start() {
    if (hasVibratePermission(this.mContext)) {
        this.mVibrator = (Vibrator) this.mContext.getSystemService("vibrator");
    }
    this.mIsGloballyEnabled = checkGlobalSetting(this.mContext);
    this.mContext.getContentResolver().registerContentObserver(System.getUriFor
            ("haptic_feedback_enabled"), false, this.mContentObserver);
}
项目:FlickLauncher    文件:SettingsActivity.java   
@Override
public void onChange(boolean selfChange) {
    boolean enabled = Settings.System.getInt(mResolver,
            Settings.System.ACCELEROMETER_ROTATION, 1) == 1;
    mRotationPref.setEnabled(enabled);
    mRotationPref.setSummary(enabled
            ? R.string.allow_rotation_desc : R.string.allow_rotation_blocked_desc);
}
项目:FloatingNew    文件:SystemOverlayMenuService.java   
private boolean isAutoBrightness() {
    try {
        return System.getInt(this.mContext.getContentResolver(), "screen_brightness_mode") == 1;
    } catch (SettingNotFoundException e) {
        e.printStackTrace();
        return false;
    }
}
项目:FloatingNew    文件:SystemOverlayMenuService.java   
private void setAutoBrightness(boolean value) {
    if (value) {
        System.putInt(this.mContext.getContentResolver(), "screen_brightness_mode", 1);
    } else {
        System.putInt(this.mContext.getContentResolver(), "screen_brightness_mode", 0);
    }
}
项目:FloatingNew    文件:SystemOverlayMenuService.java   
private int getBrightnessLevel() {
    try {
        return System.getInt(this.mContext.getContentResolver(), "screen_brightness");
    } catch (SettingNotFoundException e) {
        return 0;
    }
}
项目:SimpleUILauncher    文件:SettingsActivity.java   
@Override
public void onChange(boolean selfChange) {
    boolean enabled = Settings.System.getInt(mResolver,
            Settings.System.ACCELEROMETER_ROTATION, 1) == 1;
    mRotationPref.setEnabled(enabled);
    mRotationPref.setSummary(enabled
            ? R.string.allow_rotation_desc : R.string.allow_rotation_blocked_desc);
}
项目:AlwaysOnDisplayAmoled    文件:MainService.java   
public void handleUncaughtException(Throwable e) {
    int reportNotificationID = 53;
    Context context = getApplicationContext();
    e.printStackTrace();
    Toast.makeText(context, R.string.error_0_unknown_error + ": " + e.getMessage(), Toast.LENGTH_SHORT).show();
    Intent intent = new Intent(context, ReporterActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    e.printStackTrace();
    intent.putExtra("log", "Message: \n" + e.getMessage() + "\n\n" + "Error: \n" + e + "\n\n" + "Stack trace: \n" + Arrays.toString(e.getStackTrace()) + "\n\n" + "Cause: \n" + e.getCause() + "\n\n" + java.lang.System.err);
    PendingIntent reportIntent = PendingIntent.getActivity(context, 0, intent, 0);
    Utils.showErrorNotification(context, context.getString(R.string.error), context.getString(R.string.error_0_unknown_error_report_prompt), reportNotificationID, reportIntent);
    java.lang.System.exit(0);
    startService(new Intent(getApplicationContext(), StarterService.class));
    setLights(OFF, false, false);
}
项目:Android-Sensor-Programming-By-Example    文件:LightSensorActivity.java   
public void changeScreenBrightness(float brightness)
{
       //system setting brightness values ranges between 0 - 255
       //We scale up by multiplying by 255
       //This change the brightness for over all system settings
    System.putInt(mContentResolver, System.SCREEN_BRIGHTNESS, (int) (brightness*255));
       //screen brightness values ranges between 0 - 1
       //This only changes the brightness for the current window
       LayoutParams mLayoutParams = mWindow.getAttributes();
       mLayoutParams.screenBrightness = brightness;
    mWindow.setAttributes(mLayoutParams);
}
项目:CycleFrankfurtAndroid    文件:TripUploader.java   
public String getDeviceId() {
    String androidId = System.getString(this.mCtx.getContentResolver(), 
            Secure.ANDROID_ID);
    String androidBase = "androidDeviceId-";

    if (androidId == null) { // This happens when running in the Emulator
        final String emulatorId = "android-RunningAsTestingDeleteMe";
        return emulatorId;
    }

    String deviceId = androidBase.concat(androidId);
    return deviceId;
}
项目:AdvancedVideoView    文件:LightnessController.java   
public static boolean isAutoBrightness(Activity act) {
    boolean automicBrightness = false;
    ContentResolver aContentResolver = act.getContentResolver();
    try {
        automicBrightness = Settings.System.getInt(aContentResolver,
                Settings.System.SCREEN_BRIGHTNESS_MODE) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
    } catch (Exception e) {
        Toast.makeText(act, "Error auto lightness", Toast.LENGTH_SHORT).show();
    }
    return automicBrightness;
}
项目:AdvancedVideoView    文件:LightnessController.java   
public static void setLightness(Activity act, int value) {
    try {
        System.putInt(act.getContentResolver(), System.SCREEN_BRIGHTNESS, value);
        WindowManager.LayoutParams lp = act.getWindow().getAttributes();
        lp.screenBrightness = (value <= 0 ? 1 : value) / 255f;
        act.getWindow().setAttributes(lp);
    } catch (Exception e) {
        Toast.makeText(act, "Error set lightness", Toast.LENGTH_SHORT).show();
    }
}
项目:FMTech    文件:lwj.java   
public lwj(Context paramContext)
{
  this.e = paramContext;
  Resources localResources = paramContext.getResources();
  if (c == null)
  {
    c = new lwl(this, efj.m(), localResources);
    paramContext.getContentResolver().registerContentObserver(Settings.System.getUriFor("font_scale"), false, c);
  }
  if (Build.VERSION.SDK_INT >= 17) {
    d = localResources.getDimension(efj.Zt);
  }
}
项目:tinytimetracker    文件:TinyTimeTracker.java   
@SuppressLint("NewApi")
public static boolean isAirplaneModeOn(Context context) {
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) {
        return Global.getInt(context.getContentResolver(), Global.AIRPLANE_MODE_ON, 0) != 0;
    } else {
        return System.getInt(context.getContentResolver(), System.AIRPLANE_MODE_ON, 0) != 0;
    }
}
项目:dttv-android    文件:ControlLightness.java   
/**
 * judge if auto open brightness
 *
 * @param context
 * @return
 */
public boolean isAutoBrightness(Context context) {
    boolean automicBrightness = false;
    ContentResolver ctr = context.getContentResolver();
    try {
        automicBrightness = Settings.System.getInt(ctr,
                Settings.System.SCREEN_BRIGHTNESS_MODE) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
    } catch (SettingNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return automicBrightness;
}
项目:dttv-android    文件:ControlLightness.java   
/**
 * @param context
 * @param value
 */
public void setLightness(Activity act, int value) {
    System.putInt(act.getContentResolver(), System.SCREEN_BRIGHTNESS, value);
    try {
        WindowManager.LayoutParams lp = act.getWindow().getAttributes();
        lp.screenBrightness = (value < 0 ? 1 : value) / 255f;
        act.getWindow().setAttributes(lp);

        //saveBrightness(act,value);
    } catch (Exception e) {
        // TODO: handle exception
        e.printStackTrace();
    }
}
项目:dttv-android    文件:ControlLightness.java   
/**
 * just this method
 *
 * @param cr
 * @param value
 */
public void setBrightness(Activity cr, int value) {
    if (0 <= value && value <= 255) {
        Settings.System.putInt(cr.getContentResolver(),
                Settings.System.SCREEN_BRIGHTNESS, value); // 0-255
        value = Settings.System.getInt(cr.getContentResolver(),
                Settings.System.SCREEN_BRIGHTNESS, -1);
        // Cupcake way..... sucks
        WindowManager.LayoutParams lp = cr.getWindow().getAttributes();
        lp.screenBrightness = value;
        cr.getWindow().setAttributes(lp);
    }
}
项目:RenoTracks_Android    文件:Common.java   
public static String getDeviceId(ContentResolver contentResolver)
{
    String androidId = System.getString(contentResolver, System.ANDROID_ID);
    String androidBase = "androidDeviceId_";

    if (androidId == null) { // This happens when running in the Emulator
        final String emulatorId = "android-RunningAsTestingDeleteMe";
        return emulatorId;
    }
    String deviceId = androidBase.concat(androidId);
    return deviceId;
}
项目:trainingmode    文件:MainActivity.java   
public boolean getScreenBrightnessStatus() {
    int auto_screen_bright;
    int screen_bright_level;

    try {
        auto_screen_bright = System.getInt(getContentResolver(),
                System.SCREEN_BRIGHTNESS_MODE);
        screen_bright_level = System.getInt(getContentResolver(),
                System.SCREEN_BRIGHTNESS);
        if (auto_screen_bright == 1 || screen_bright_level > 10)
            return Boolean.TRUE;
        else
            return Boolean.FALSE;
    } catch(Settings.SettingNotFoundException e){
        Log.e("Can't get Setting: ", e.toString());
    }

    return Boolean.FALSE;
}