diff options
author | Zhizhi Liu <zhizhiliu@google.com> | 2021-10-21 22:17:29 +0000 |
---|---|---|
committer | Zhizhi Liu <zhizhiliu@google.com> | 2021-10-21 22:43:46 +0000 |
commit | 8d6a304f88bff206cc5753b631b324060b23c107 (patch) | |
tree | 66850dc02907096caa1a4ea3a4e75a2b93ee161d /SettingsAPI | |
parent | bc7318c318b446b51550ab3975dd8f72eced96d6 (diff) | |
download | TvSettings-8d6a304f88bff206cc5753b631b324060b23c107.tar.gz |
Add entry point to system component UI.
Bug: 202954572
Test: Test-in-1Panel: slice setting icon is correct. Use existing
sliceprovider to test functionality. Need end-to-end test when slice
implementation is finished.
Test-in-2Panel:same as above.
Change-Id: Ib8307e5f44e81ce400c8904a2877c430b906947c
Diffstat (limited to 'SettingsAPI')
-rw-r--r-- | SettingsAPI/java/com/android/tv/settings/library/util/SliceUtils.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/SettingsAPI/java/com/android/tv/settings/library/util/SliceUtils.java b/SettingsAPI/java/com/android/tv/settings/library/util/SliceUtils.java index 86d4a30c9..ef218f4d4 100644 --- a/SettingsAPI/java/com/android/tv/settings/library/util/SliceUtils.java +++ b/SettingsAPI/java/com/android/tv/settings/library/util/SliceUtils.java @@ -53,7 +53,8 @@ public final class SliceUtils { * * @param context Current context of the app * @param uri Settings slice uri - * @param topLevelSettingsSliceUri Top level settings slice uri + * @param topLevelSettingsSliceUri Top level settings slice uri, if null, use provided uri to + * deduce top level settings slice uri. * @return returns true if slice is enabled, false otherwise */ public static boolean isSettingsSliceEnabled(Context context, String uri, @@ -66,8 +67,11 @@ public final class SliceUtils { return false; } try { - final Collection<Uri> enabledSlicesUri = sliceManager.getSliceDescendants( - Uri.parse(ResourcesUtil.getString(context, topLevelSettingsSliceUri))); + Uri topLevelSettingsSlice = topLevelSettingsSliceUri == null + ? Uri.parse(uri).buildUpon().path("/").build() + : Uri.parse(ResourcesUtil.getString(context, topLevelSettingsSliceUri)); + final Collection<Uri> enabledSlicesUri = sliceManager + .getSliceDescendants(topLevelSettingsSlice); if (enabledSlicesUri != null) { for (final Uri sliceUri : enabledSlicesUri) { Log.i(TAG, "Enabled slice: " + sliceUri); |