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

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

Merge changes from topic "dream-complications"

* changes:
  Fix DreamBackendTest
  Move dream complication config to framework.
parents f83bc67d 42e19912
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
@@ -2221,6 +2221,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)
+7 −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,10 +51,15 @@ 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);
        when(res.getStringArray(
                com.android.internal.R.array.config_disabledDreamComponents)).thenReturn(
                new String[]{});
        mBackend = new DreamBackend(mContext);
    }