Restrict toggle/slider slice when the preference restricted
Bug: 289980550 Test: robotest & manual Change-Id: Id87fbf12a2722344dd07886e810e7c61a9f401aa
This commit is contained in:
@@ -73,6 +73,8 @@ public class SliceData {
|
||||
|
||||
private final int mHighlightMenuRes;
|
||||
|
||||
private final String mUserRestriction;
|
||||
|
||||
@SliceType
|
||||
private final int mSliceType;
|
||||
|
||||
@@ -132,6 +134,10 @@ public class SliceData {
|
||||
return mIsPublicSlice;
|
||||
}
|
||||
|
||||
public String getUserRestriction() {
|
||||
return mUserRestriction;
|
||||
}
|
||||
|
||||
private SliceData(Builder builder) {
|
||||
mKey = builder.mKey;
|
||||
mTitle = builder.mTitle;
|
||||
@@ -146,6 +152,7 @@ public class SliceData {
|
||||
mUnavailableSliceSubtitle = builder.mUnavailableSliceSubtitle;
|
||||
mIsPublicSlice = builder.mIsPublicSlice;
|
||||
mHighlightMenuRes = builder.mHighlightMenuRes;
|
||||
mUserRestriction = builder.mUserRestriction;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -189,6 +196,8 @@ public class SliceData {
|
||||
|
||||
private boolean mIsPublicSlice;
|
||||
|
||||
private String mUserRestriction;
|
||||
|
||||
public Builder setKey(String key) {
|
||||
mKey = key;
|
||||
return this;
|
||||
@@ -255,6 +264,11 @@ public class SliceData {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setUserRestriction(String userRestriction) {
|
||||
mUserRestriction = userRestriction;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SliceData build() {
|
||||
if (TextUtils.isEmpty(mKey)) {
|
||||
throw new InvalidSliceDataException("Key cannot be empty");
|
||||
|
||||
Reference in New Issue
Block a user