IMS-VT: Speaker icon is not highlighted sometimes for MO VT calls.
If speaker icon is checked before the background color is updated,
it displays as unchecked after background update. This causes
speaker to appear as not enabled in some MO VT call cases even
though actual speaker functionality is enabled.
To fix this, uncheck the button before applying background color
and re apply the saved checked state after background is updated.
Change-Id: I67a95c5b217941eb5c18a993f672d8f577a29e3a
CRs-Fixed: 1008869
diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java
index 3346984..d7289a2 100644
--- a/InCallUI/src/com/android/incallui/CallButtonFragment.java
+++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java
@@ -298,7 +298,7 @@
return;
}
- View[] compoundButtons = {
+ CompoundButton[] compoundButtons = {
mAudioButton,
mMuteButton,
mShowDialpadButton,
@@ -307,10 +307,17 @@
mPauseVideoButton
};
- for (View button : compoundButtons) {
+ for (CompoundButton button : compoundButtons) {
+ // Before applying background color, uncheck the button and re apply the
+ // saved checked state after background is changed. This is to fix
+ // an issue where button checked state is displayed wrongly after updating colors.
+ boolean isChecked = button.isChecked();
+ if (isChecked) Log.d(this, "updateColors: button:" + button + " is in checked state");
+ button.setChecked(false);
final LayerDrawable layers = (LayerDrawable) button.getBackground();
final RippleDrawable btnCompoundDrawable = compoundBackgroundDrawable(themeColors);
layers.setDrawableByLayerId(R.id.compoundBackgroundItem, btnCompoundDrawable);
+ button.setChecked(isChecked);
button.requestLayout();
}