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

Commit 21476529 authored by Lucas Silva's avatar Lucas Silva Committed by Android (Google) Code Review
Browse files

Merge "Add new config to hide certain dreams."

parents d378d627 8632b920
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2373,6 +2373,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
@@ -2211,6 +2211,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);