Support slice deep links highlighting menu entries
- Add an interface to get highlight menu key resource in Sliceable - Force implementing the new interface in TogglePreferenceController and CustomSliceable at syntax level - Update the slice index db schema Bug: 204695404 Test: manual, robotest build pass, unit Change-Id: I0b5068bccd04f1590023de7f3385bc0a4c6fa47b
This commit is contained in:
@@ -19,6 +19,7 @@ package com.android.settings.slices;
|
||||
import android.annotation.IntDef;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -50,6 +51,8 @@ public class SliceData {
|
||||
int SLIDER = 2;
|
||||
}
|
||||
|
||||
private static final String TAG = "SliceData";
|
||||
|
||||
private final String mKey;
|
||||
|
||||
private final String mTitle;
|
||||
@@ -68,6 +71,8 @@ public class SliceData {
|
||||
|
||||
private final String mPreferenceController;
|
||||
|
||||
private final int mHighlightMenuRes;
|
||||
|
||||
@SliceType
|
||||
private final int mSliceType;
|
||||
|
||||
@@ -119,6 +124,10 @@ public class SliceData {
|
||||
return mUnavailableSliceSubtitle;
|
||||
}
|
||||
|
||||
public int getHighlightMenuRes() {
|
||||
return mHighlightMenuRes;
|
||||
}
|
||||
|
||||
public boolean isPublicSlice() {
|
||||
return mIsPublicSlice;
|
||||
}
|
||||
@@ -136,6 +145,7 @@ public class SliceData {
|
||||
mSliceType = builder.mSliceType;
|
||||
mUnavailableSliceSubtitle = builder.mUnavailableSliceSubtitle;
|
||||
mIsPublicSlice = builder.mIsPublicSlice;
|
||||
mHighlightMenuRes = builder.mHighlightMenuRes;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -175,6 +185,8 @@ public class SliceData {
|
||||
|
||||
private String mUnavailableSliceSubtitle;
|
||||
|
||||
private int mHighlightMenuRes;
|
||||
|
||||
private boolean mIsPublicSlice;
|
||||
|
||||
public Builder setKey(String key) {
|
||||
@@ -233,6 +245,11 @@ public class SliceData {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setHighlightMenuRes(int highlightMenuRes) {
|
||||
mHighlightMenuRes = highlightMenuRes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setIsPublicSlice(boolean isPublicSlice) {
|
||||
mIsPublicSlice = isPublicSlice;
|
||||
return this;
|
||||
@@ -255,6 +272,10 @@ public class SliceData {
|
||||
throw new InvalidSliceDataException("Preference Controller cannot be empty");
|
||||
}
|
||||
|
||||
if (mHighlightMenuRes == 0) {
|
||||
Log.w(TAG, "Highlight menu key res is empty: " + mPrefControllerClassName);
|
||||
}
|
||||
|
||||
return new SliceData(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user