Log switch toggle action whenever its status changes.
Bug: 30110675 onClick is only called when the switchbar is clicked. We also need to log when switch itself is clicked. Change-Id: I892b72daeefe0f36608a73fe509199e200376eb7
This commit is contained in:
@@ -45,7 +45,7 @@ import java.util.ArrayList;
|
||||
public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedChangeListener,
|
||||
View.OnClickListener {
|
||||
|
||||
public static interface OnSwitchChangeListener {
|
||||
public interface OnSwitchChangeListener {
|
||||
/**
|
||||
* Called when the checked state of the Switch has changed.
|
||||
*
|
||||
@@ -63,7 +63,8 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
||||
private String mLabel;
|
||||
private String mSummary;
|
||||
|
||||
private boolean mDisabledByAdmin = false;
|
||||
private boolean mLoggingIntialized;
|
||||
private boolean mDisabledByAdmin;
|
||||
private EnforcedAdmin mEnforcedAdmin = null;
|
||||
|
||||
private String mMetricsTag;
|
||||
@@ -233,7 +234,6 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
||||
RestrictedLockUtils.sendShowAdminSupportDetailsIntent(mContext, mEnforcedAdmin);
|
||||
} else {
|
||||
final boolean isChecked = !mSwitch.isChecked();
|
||||
MetricsLogger.count(mContext, mMetricsTag + "/switch_bar|" + isChecked, 1);
|
||||
setChecked(isChecked);
|
||||
}
|
||||
}
|
||||
@@ -247,6 +247,10 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (mLoggingIntialized) {
|
||||
MetricsLogger.count(mContext, mMetricsTag + "/switch_bar|" + isChecked, 1);
|
||||
}
|
||||
mLoggingIntialized = true;
|
||||
propagateChecked(isChecked);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user