Loading res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -73,4 +73,8 @@ <!-- When set, Telecom will attempt to bind to the {@link CallDiagnosticService} implementation defined by the app with this package name. --> <string name="call_diagnostic_service_package_name"></string> <!-- When true, the options in the call blocking settings to block unavailable and unknown callers are combined into a single toggle. --> <bool name="combine_options_to_block_unavailable_and_unknown_callers">true</bool> </resources> src/com/android/server/telecom/settings/EnhancedCallBlockingFragment.java +23 −10 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ public class EnhancedCallBlockingFragment extends PreferenceFragment private static final String BLOCK_UNAVAILABLE_NUMBERS_KEY = "block_unavailable_calls_setting"; private boolean mIsCombiningRestrictedAndUnknownOption = false; private boolean mIsCombiningUnavailableAndUnknownOption = false; @Override public void onCreate(Bundle savedInstanceState) { Loading Loading @@ -94,11 +95,17 @@ public class EnhancedCallBlockingFragment extends PreferenceFragment R.bool.combine_options_to_block_restricted_and_unknown_callers); if (mIsCombiningRestrictedAndUnknownOption) { Preference restricted_pref = findPreference(BLOCK_RESTRICTED_NUMBERS_KEY); Preference unavailable_pref = findPreference(BLOCK_UNAVAILABLE_NUMBERS_KEY); screen.removePreference(restricted_pref); screen.removePreference(unavailable_pref); Log.i(this, "onCreate: removed block restricted preference."); } mIsCombiningUnavailableAndUnknownOption = getResources().getBoolean( R.bool.combine_options_to_block_unavailable_and_unknown_callers); if (mIsCombiningUnavailableAndUnknownOption) { Preference unavailable_pref = findPreference(BLOCK_UNAVAILABLE_NUMBERS_KEY); screen.removePreference(unavailable_pref); Log.i(this, "onCreate: removed block unavailable preference."); } } /** Loading Loading @@ -136,15 +143,21 @@ public class EnhancedCallBlockingFragment extends PreferenceFragment @Override public boolean onPreferenceChange(Preference preference, Object objValue) { if (mIsCombiningRestrictedAndUnknownOption && preference.getKey().equals(BLOCK_UNKNOWN_NUMBERS_KEY)) { if (preference.getKey().equals(BLOCK_UNKNOWN_NUMBERS_KEY)) { if (mIsCombiningRestrictedAndUnknownOption) { Log.i(this, "onPreferenceChange: changing %s and %s to %b", preference.getKey(), BLOCK_RESTRICTED_NUMBERS_KEY, (boolean) objValue); BlockedNumbersUtil.setEnhancedBlockSetting(getActivity(), BLOCK_RESTRICTED_NUMBERS_KEY, (boolean) objValue); BlockedNumbersUtil.setEnhancedBlockSetting(getActivity(), BLOCK_RESTRICTED_NUMBERS_KEY, (boolean) objValue); } if (mIsCombiningUnavailableAndUnknownOption) { Log.i(this, "onPreferenceChange: changing %s and %s to %b", preference.getKey(), BLOCK_UNAVAILABLE_NUMBERS_KEY, (boolean) objValue); BlockedNumbersUtil.setEnhancedBlockSetting(getActivity(), BLOCK_UNAVAILABLE_NUMBERS_KEY, (boolean) objValue); } } BlockedNumbersUtil.setEnhancedBlockSetting(getActivity(), preference.getKey(), (boolean) objValue); return true; Loading Loading
res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -73,4 +73,8 @@ <!-- When set, Telecom will attempt to bind to the {@link CallDiagnosticService} implementation defined by the app with this package name. --> <string name="call_diagnostic_service_package_name"></string> <!-- When true, the options in the call blocking settings to block unavailable and unknown callers are combined into a single toggle. --> <bool name="combine_options_to_block_unavailable_and_unknown_callers">true</bool> </resources>
src/com/android/server/telecom/settings/EnhancedCallBlockingFragment.java +23 −10 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ public class EnhancedCallBlockingFragment extends PreferenceFragment private static final String BLOCK_UNAVAILABLE_NUMBERS_KEY = "block_unavailable_calls_setting"; private boolean mIsCombiningRestrictedAndUnknownOption = false; private boolean mIsCombiningUnavailableAndUnknownOption = false; @Override public void onCreate(Bundle savedInstanceState) { Loading Loading @@ -94,11 +95,17 @@ public class EnhancedCallBlockingFragment extends PreferenceFragment R.bool.combine_options_to_block_restricted_and_unknown_callers); if (mIsCombiningRestrictedAndUnknownOption) { Preference restricted_pref = findPreference(BLOCK_RESTRICTED_NUMBERS_KEY); Preference unavailable_pref = findPreference(BLOCK_UNAVAILABLE_NUMBERS_KEY); screen.removePreference(restricted_pref); screen.removePreference(unavailable_pref); Log.i(this, "onCreate: removed block restricted preference."); } mIsCombiningUnavailableAndUnknownOption = getResources().getBoolean( R.bool.combine_options_to_block_unavailable_and_unknown_callers); if (mIsCombiningUnavailableAndUnknownOption) { Preference unavailable_pref = findPreference(BLOCK_UNAVAILABLE_NUMBERS_KEY); screen.removePreference(unavailable_pref); Log.i(this, "onCreate: removed block unavailable preference."); } } /** Loading Loading @@ -136,15 +143,21 @@ public class EnhancedCallBlockingFragment extends PreferenceFragment @Override public boolean onPreferenceChange(Preference preference, Object objValue) { if (mIsCombiningRestrictedAndUnknownOption && preference.getKey().equals(BLOCK_UNKNOWN_NUMBERS_KEY)) { if (preference.getKey().equals(BLOCK_UNKNOWN_NUMBERS_KEY)) { if (mIsCombiningRestrictedAndUnknownOption) { Log.i(this, "onPreferenceChange: changing %s and %s to %b", preference.getKey(), BLOCK_RESTRICTED_NUMBERS_KEY, (boolean) objValue); BlockedNumbersUtil.setEnhancedBlockSetting(getActivity(), BLOCK_RESTRICTED_NUMBERS_KEY, (boolean) objValue); BlockedNumbersUtil.setEnhancedBlockSetting(getActivity(), BLOCK_RESTRICTED_NUMBERS_KEY, (boolean) objValue); } if (mIsCombiningUnavailableAndUnknownOption) { Log.i(this, "onPreferenceChange: changing %s and %s to %b", preference.getKey(), BLOCK_UNAVAILABLE_NUMBERS_KEY, (boolean) objValue); BlockedNumbersUtil.setEnhancedBlockSetting(getActivity(), BLOCK_UNAVAILABLE_NUMBERS_KEY, (boolean) objValue); } } BlockedNumbersUtil.setEnhancedBlockSetting(getActivity(), preference.getKey(), (boolean) objValue); return true; Loading