Update NotificationChannelSettings Preferences in place to prevent re-layout.
(cherry picked from commit b409b64045)
Fixes: 110093185
Test: ChannelListPreferenceControllerTest
Change-Id: If6acf305c44085e502a3304ea57e409ce049b40f
Merged-In: If6acf305c44085e502a3304ea57e409ce049b40f
This commit is contained in:
@@ -23,6 +23,8 @@ import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Switch;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -101,6 +103,16 @@ public class MasterSwitchPreference extends RestrictedPreference {
|
||||
return mSwitch != null && mChecked;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to validate the state of mChecked and mCheckedSet when testing, without requiring
|
||||
* that a ViewHolder be bound to the object.
|
||||
*/
|
||||
@Keep
|
||||
@Nullable
|
||||
public Boolean getCheckedState() {
|
||||
return mCheckedSet ? mChecked : null;
|
||||
}
|
||||
|
||||
public void setChecked(boolean checked) {
|
||||
// Always set checked the first time; don't assume the field's default of false.
|
||||
final boolean changed = mChecked != checked;
|
||||
|
||||
Reference in New Issue
Block a user