Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b22d1143 authored by Fan Zhang's avatar Fan Zhang Committed by android-build-merger
Browse files

Log switch toggle action whenever its status changes. am: 6d2a0c80

am: 181f2139

Change-Id: I16a34ea7636bf6ca015996e16ca554bc6f72c5aa
parents 7b8a73c2 181f2139
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -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);
    }