Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8632b920 authored by Lucas Silva's avatar Lucas Silva
Browse files

Add new config to hide certain dreams.

On titan devices, we will hide some dreams such as the default clock and
photos, and introduce newer alternatives.

Test: locally on device
Bug: 215726665
Change-Id: I990010dd04486f7d57d895f04228a85293d44ef3
parent 71cadb94
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2399,6 +2399,9 @@
    <bool name="config_dreamsActivatedOnSleepByDefault">false</bool>
    <!-- ComponentName of the default dream (Settings.Secure.DEFAULT_SCREENSAVER_COMPONENT) -->
    <string name="config_dreamsDefaultComponent" translatable="false">com.android.deskclock/com.android.deskclock.Screensaver</string>
    <!-- ComponentNames of the dreams that we should hide -->
    <string-array name="config_disabledDreamComponents" translatable="false">
    </string-array>

    <!-- Are we allowed to dream while not plugged in? -->
    <bool name="config_dreamsEnabledOnBattery">false</bool>
+1 −0
Original line number Diff line number Diff line
@@ -2222,6 +2222,7 @@
  <java-symbol type="integer" name="config_dreamsBatteryLevelDrainCutoff" />
  <java-symbol type="string" name="config_dreamsDefaultComponent" />
  <java-symbol type="drawable" name="default_dream_preview" />
  <java-symbol type="array" name="config_disabledDreamComponents" />
  <java-symbol type="string" name="config_dozeComponent" />
  <java-symbol type="string" name="enable_explore_by_touch_warning_title" />
  <java-symbol type="string" name="enable_explore_by_touch_warning_message" />
+9 −2
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ public class DreamBackend {
    private final boolean mDreamsEnabledByDefault;
    private final boolean mDreamsActivatedOnSleepByDefault;
    private final boolean mDreamsActivatedOnDockByDefault;
    private final Set<ComponentName> mDisabledDreams;
    private final Set<Integer> mSupportedComplications;
    private final Set<Integer> mDefaultEnabledComplications;

@@ -143,6 +144,10 @@ public class DreamBackend {
                com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault);
        mDreamPreviewDefault = resources.getDrawable(
                com.android.internal.R.drawable.default_dream_preview);
        mDisabledDreams = Arrays.stream(resources.getStringArray(
                        com.android.internal.R.array.config_disabledDreamComponents))
                .map(ComponentName::unflattenFromString)
                .collect(Collectors.toSet());

        mSupportedComplications =
                Arrays.stream(resources.getIntArray(R.array.config_supportedDreamComplications))
@@ -166,14 +171,16 @@ public class DreamBackend {
                PackageManager.GET_META_DATA);
        List<DreamInfo> dreamInfos = new ArrayList<>(resolveInfos.size());
        for (ResolveInfo resolveInfo : resolveInfos) {
            if (resolveInfo.serviceInfo == null) {
            final ComponentName componentName = getDreamComponentName(resolveInfo);
            if (componentName == null || mDisabledDreams.contains(componentName)) {
                continue;
            }

            DreamInfo dreamInfo = new DreamInfo();
            dreamInfo.caption = resolveInfo.loadLabel(pm);
            dreamInfo.icon = resolveInfo.loadIcon(pm);
            dreamInfo.description = getDescription(resolveInfo, pm);
            dreamInfo.componentName = getDreamComponentName(resolveInfo);
            dreamInfo.componentName = componentName;
            dreamInfo.isActive = dreamInfo.componentName.equals(activeDream);

            final DreamMetadata dreamMetadata = getDreamMetadata(pm, resolveInfo);