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

Commit 9b0862f2 authored by Lucas Silva's avatar Lucas Silva
Browse files

Move dream complication config to framework.

SettingsLib doesn't support runtime overlays well, see
http://b/33694217. Moving these to framework so they can be overlayed.

Test: locally on device
Bug: 217222711
Change-Id: I6a460086b0df92b1c22ac975e4c604878ab2016a
parent e63c1ae5
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2376,6 +2376,12 @@
    <!-- ComponentNames of the dreams that we should hide -->
    <string-array name="config_disabledDreamComponents" translatable="false">
    </string-array>
    <!-- The list of supported dream complications -->
    <integer-array name="config_supportedDreamComplications">
    </integer-array>
    <!-- The list of dream complications which should be enabled by default -->
    <integer-array name="config_dreamComplicationsEnabledByDefault">
    </integer-array>

    <!-- Are we allowed to dream while not plugged in? -->
    <bool name="config_dreamsEnabledOnBattery">false</bool>
+2 −0
Original line number Diff line number Diff line
@@ -2213,6 +2213,8 @@
  <java-symbol type="integer" name="config_dreamsBatteryLevelMinimumWhenNotPowered" />
  <java-symbol type="integer" name="config_dreamsBatteryLevelDrainCutoff" />
  <java-symbol type="string" name="config_dreamsDefaultComponent" />
  <java-symbol type="array" name="config_supportedDreamComplications" />
  <java-symbol type="array" name="config_dreamComplicationsEnabledByDefault" />
  <java-symbol type="drawable" name="default_dream_preview" />
  <java-symbol type="array" name="config_disabledDreamComponents" />
  <java-symbol type="string" name="config_dozeComponent" />
+0 −5
Original line number Diff line number Diff line
@@ -28,9 +28,4 @@
    <!-- Control whether status bar should distinguish HSPA data icon form UMTS
    data icon on devices -->
    <bool name="config_hspa_data_distinguishable">false</bool>

    <integer-array name="config_supportedDreamComplications">
    </integer-array>
    <integer-array name="config_dreamComplicationsEnabledByDefault">
    </integer-array>
</resources>
 No newline at end of file
+6 −6
Original line number Diff line number Diff line
@@ -151,13 +151,13 @@ public class DreamBackend {
                .map(ComponentName::unflattenFromString)
                .collect(Collectors.toSet());

        mSupportedComplications =
                Arrays.stream(resources.getIntArray(R.array.config_supportedDreamComplications))
        mSupportedComplications = Arrays.stream(resources.getIntArray(
                        com.android.internal.R.array.config_supportedDreamComplications))
                .boxed()
                .collect(Collectors.toSet());

        mDefaultEnabledComplications = Arrays.stream(
                        resources.getIntArray(R.array.config_dreamComplicationsEnabledByDefault))
        mDefaultEnabledComplications = Arrays.stream(resources.getIntArray(
                        com.android.internal.R.array.config_dreamComplicationsEnabledByDefault))
                .boxed()
                // A complication can only be enabled by default if it is also supported.
                .filter(mSupportedComplications::contains)
+4 −4
Original line number Diff line number Diff line
@@ -24,8 +24,6 @@ import static org.mockito.Mockito.when;
import android.content.Context;
import android.content.res.Resources;

import com.android.settingslib.R;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -53,9 +51,11 @@ public final class DreamBackendTest {

        final Resources res = mock(Resources.class);
        when(mContext.getResources()).thenReturn(res);
        when(res.getIntArray(R.array.config_supportedDreamComplications)).thenReturn(
        when(res.getIntArray(
                com.android.internal.R.array.config_supportedDreamComplications)).thenReturn(
                SUPPORTED_DREAM_COMPLICATIONS);
        when(res.getIntArray(R.array.config_dreamComplicationsEnabledByDefault)).thenReturn(
        when(res.getIntArray(
                com.android.internal.R.array.config_dreamComplicationsEnabledByDefault)).thenReturn(
                DEFAULT_DREAM_COMPLICATIONS);
        mBackend = new DreamBackend(mContext);
    }