Fix a pseudo race condition in TtsEngineSettingsFragment.
The issue is that Fragment.setVoiceDataDetails can be called before Fragment.getView. We guard against this issue. No thread visibility issues here because both functions are called on the UI thread. bug:5884355 Change-Id: Iad91b91c58b04dcb9f34f6b5ff8752f2e8295423
This commit is contained in:
@@ -155,13 +155,22 @@ public class TtsEnginePreference extends Preference {
|
||||
}
|
||||
});
|
||||
|
||||
if (mVoiceCheckData != null) {
|
||||
mSettingsIcon.setEnabled(mRadioButton.isChecked());
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
public void setVoiceDataDetails(Intent data) {
|
||||
mVoiceCheckData = data;
|
||||
// This might end up running before getView aboive, in which
|
||||
// case mSettingsIcon && mRadioButton will be null. In this case
|
||||
// getView will set the right values.
|
||||
if (mSettingsIcon != null && mRadioButton != null) {
|
||||
mSettingsIcon.setEnabled(mRadioButton.isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
private void onRadioButtonClicked(CompoundButton buttonView, boolean isChecked) {
|
||||
if (mPreventRadioButtonCallbacks) {
|
||||
|
Reference in New Issue
Block a user