Remove sub-text from slice builder

We would like to remove all sub-text from Settings Search. But slice
view does not support API to configure the sub-text visibility.
Therefore, the only way is to remove the sub-text from slices directly.

Since Settings slices are also invoked by other apps, we can not
directly remove the sub-text.

Finally, we decide to check the caller's uid. If it comes from Settings
Search, we will return the slice without the sub-text.

Bug: 143118037
Test: visual, robotests
Change-Id: Iac72f1683a2c930592634e0599058890d86f669d
This commit is contained in:
Yanting Yang
2020-03-20 12:04:09 +08:00
parent 5c3f71859e
commit 96127fe621
7 changed files with 101 additions and 77 deletions

View File

@@ -96,15 +96,18 @@ public class MobileDataSlice implements CustomSliceable {
ListBuilder.ICON_IMAGE, title);
final SliceAction toggleSliceAction = SliceAction.createToggle(toggleAction,
null /* actionTitle */, isMobileDataEnabled());
final ListBuilder.RowBuilder rowBuilder = new ListBuilder.RowBuilder()
.setTitle(title)
.addEndItem(toggleSliceAction)
.setPrimaryAction(primarySliceAction);
if (!Utils.isSettingsIntelligence(mContext)) {
rowBuilder.setSubtitle(summary);
}
final ListBuilder listBuilder = new ListBuilder(mContext, getUri(),
ListBuilder.INFINITY)
.setAccentColor(color)
.addRow(new ListBuilder.RowBuilder()
.setTitle(title)
.setSubtitle(summary)
.addEndItem(toggleSliceAction)
.setPrimaryAction(primarySliceAction));
.addRow(rowBuilder);
return listBuilder.build();
}