android.provider.Settings.SettingNotFoundException#printStackTrace ( )源码实例Demo

下面列出了android.provider.Settings.SettingNotFoundException#printStackTrace ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: FimiX8-RE   文件: PermissionManager.java
public static boolean isLocationEnabled(Context context) {
    if (VERSION.SDK_INT >= 19) {
        try {
            if (Secure.getInt(context.getContentResolver(), "location_mode") != 0) {
                return true;
            }
            return false;
        } catch (SettingNotFoundException e) {
            e.printStackTrace();
            return false;
        }
    } else if (TextUtils.isEmpty(Secure.getString(context.getContentResolver(), "location_providers_allowed"))) {
        return false;
    } else {
        return true;
    }
}
 
源代码2 项目: Learning-Resources   文件: Helper.java
/**
 * Is Roaming enabled.
 *
 * @return
 */
@SuppressWarnings("deprecation")
private static boolean isRoamingEnabled(Context ctx) {
    ContentResolver cr = ctx.getContentResolver();
    int result = 0; // 0 is false
    boolean check = false;

    try {
        result = Settings.Secure.getInt(cr, Settings.Secure.DATA_ROAMING);
    } catch (SettingNotFoundException e) {
        e.printStackTrace();
    }

    if (result == 1) {
        check = true;
    }

    return check;
}
 
源代码3 项目: VCL-Android   文件: VideoPlayerActivity.java
@TargetApi(android.os.Build.VERSION_CODES.FROYO)
private void initBrightnessTouch() {
    float brightnesstemp = 0.6f;
    // Initialize the layoutParams screen brightness
    try {
        if (AndroidUtil.isFroyoOrLater() &&
                Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
            Settings.System.putInt(getContentResolver(),
                    Settings.System.SCREEN_BRIGHTNESS_MODE,
                    Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
            mRestoreAutoBrightness = android.provider.Settings.System.getInt(getContentResolver(),
                    android.provider.Settings.System.SCREEN_BRIGHTNESS) / 255.0f;
        } else {
            brightnesstemp = android.provider.Settings.System.getInt(getContentResolver(),
                android.provider.Settings.System.SCREEN_BRIGHTNESS) / 255.0f;
        }
    } catch (SettingNotFoundException e) {
        e.printStackTrace();
    }
    WindowManager.LayoutParams lp = getWindow().getAttributes();
    lp.screenBrightness = brightnesstemp;
    getWindow().setAttributes(lp);
    mIsFirstBrightnessGesture = false;
}
 
源代码4 项目: android_9.0.0_r45   文件: ConfirmationPrompt.java
private static boolean isAccessibilityServiceRunning(Context context) {
    boolean serviceRunning = false;
    try {
        ContentResolver contentResolver = context.getContentResolver();
        int a11yEnabled = Settings.Secure.getInt(contentResolver,
                Settings.Secure.ACCESSIBILITY_ENABLED);
        if (a11yEnabled == 1) {
            serviceRunning = true;
        }
    } catch (SettingNotFoundException e) {
        Log.w(TAG, "Unexpected SettingNotFoundException");
        e.printStackTrace();
    }
    return serviceRunning;
}
 
源代码5 项目: oversec   文件: AndroidIntegration.java
private static boolean isAccessibilitySettingsOn(Context ctx) {
    int accessibilityEnabled = 0;
    final String service = ctx.getPackageName() + "/"
            + OversecAccessibilityService_1.class.getName();
    boolean accessibilityFound = false;
    try {
        accessibilityEnabled = Settings.Secure.getInt(ctx
                        .getApplicationContext().getContentResolver(),
                Settings.Secure.ACCESSIBILITY_ENABLED);
    } catch (SettingNotFoundException e) {
        e.printStackTrace();
    }

    if (accessibilityEnabled == 1) {
        String settingValue = Settings.Secure.getString(ctx
                        .getApplicationContext().getContentResolver(),
                Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
        if (settingValue != null) {
            String[] values = settingValue.split("\\:");
            for (String string : values) {

                if (string.equalsIgnoreCase(service)) {
                    return true;
                }
            }
        }
    }
    return accessibilityFound;
}
 
源代码6 项目: NewsMe   文件: AndroidUtil.java
/**
 * 获取当前屏幕亮度,范围0-255
 * 
 * @param context
 * @return 屏幕当前亮度值
 */
public static int getScreenBrightness(Context context) {
	int rightnessValue = 0;
	try {
		rightnessValue = Settings.System.getInt(
				context.getContentResolver(),
				Settings.System.SCREEN_BRIGHTNESS);
	} catch (SettingNotFoundException e) {
		e.printStackTrace();
	}
	return rightnessValue;
}
 
源代码7 项目: NewsMe   文件: AndroidUtil.java
/**
 * 判断是否开启了自动亮度调节
 * 
 * @param context
 * @return
 */
public static boolean isAutomicBrightness(Context context) {
	boolean automicBrightness = false;
	try {
		automicBrightness = Settings.System.getInt(
				context.getContentResolver(),
				Settings.System.SCREEN_BRIGHTNESS_MODE) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
	} catch (SettingNotFoundException e) {
		e.printStackTrace();
	}
	return automicBrightness;
}
 
源代码8 项目: 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;
}
 
源代码9 项目: LiveBlurListView   文件: Utilities.java
public static boolean isAutoBrightness(ContentResolver aContentResolver) {
    boolean automicBrightness = false;
    try {
        automicBrightness = Settings.System.getInt(aContentResolver,
                Settings.System.SCREEN_BRIGHTNESS_MODE) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
    } catch (SettingNotFoundException e) {
        e.printStackTrace();
    }
    return automicBrightness;
}