diff options
-rw-r--r-- | src/com/android/contacts/common/CallUtil.java | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/com/android/contacts/common/CallUtil.java b/src/com/android/contacts/common/CallUtil.java index acbf6fb0..d253a4d0 100644 --- a/src/com/android/contacts/common/CallUtil.java +++ b/src/com/android/contacts/common/CallUtil.java @@ -200,12 +200,23 @@ public class CallUtil { public static boolean isVideoEnabled(Context context) { boolean hasVideoCap = ((getVideoCallingAvailability(context) & VIDEO_CALLING_ENABLED) != 0); - Settings.System.putInt(context.getContentResolver(), - CONFIG_VIDEO_CALLING,hasVideoCap?ENABLE_VIDEO_CALLING:DISABLE_VIDEO_CALLING); + saveVideoCallConfig(context,hasVideoCap); return hasVideoCap; } /** + * save the value of video call config. + * + * @param context The context, enable. + */ + public static void saveVideoCallConfig(Context context, boolean enable) { + if(Settings.System.canWrite(context)) { + Settings.System.putInt(context.getContentResolver(), + CONFIG_VIDEO_CALLING,enable?ENABLE_VIDEO_CALLING:DISABLE_VIDEO_CALLING); + } + } + + /** * Determines if one of the call capable phone accounts defined supports calling with a subject * specified. * @@ -295,8 +306,11 @@ public class CallUtil { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - Settings.System.putInt(context.getContentResolver(), - DIALOG_VIDEO_CALLING,isChecked?ENABLE_VIDEO_CALLING:DISABLE_VIDEO_CALLING); + if(Settings.System.canWrite(context)) { + Settings.System.putInt(context.getContentResolver(), + DIALOG_VIDEO_CALLING,isChecked? + ENABLE_VIDEO_CALLING:DISABLE_VIDEO_CALLING); + } } }); AlertDialog.Builder builder = new AlertDialog.Builder(context); |