Launch Camera --> check shutter sound default status is "OFF" --> set the shutter sound status to "ON" --> click the restore to default button --> the shutter sound status isn't the default value "OFF"java
As the customization and the value of SDMID isn't "on" or "off",so I must translate it in the java code. But the preference.xml has the definition (KEY_SHUTTER_SOUND),and the default value is this:app
<ListPreference camera:key = "pref_camera_shutter_sound" camera:defaultValue="@string/pref_camera_shutter_sound_default" ... />
If I don't deal with it,the default value isn't via customization butthis
camera:defaultValue="@string/pref_camera_shutter_sound_default"
So I set the shutter sound default value in the method restorePreferences() in the CameraSettings.java manually.I add a function:spa
private static void setShutterSoundDefault() { SharedPreferences.Editor editor = preferences.edit(); editor.putString(KEY_SHUTTER_SOUND,shutterValue); editor.apply(); }
and add it end of the restorePreference().The shutterValue is from SDM which you want to custom,not rest
camera:defaultValue="@string/pref_camera_shutter_sound_default"
OK,it can work now.code