Merge changes from topic "dream-complications"

* changes:
  Fix DreamBackendTest
  Move dream complication config to framework.
This commit is contained in:
Lucas Silva
2022-02-02 16:09:27 +00:00
committed by Android (Google) Code Review
5 changed files with 21 additions and 15 deletions

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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>

View File

@@ -151,13 +151,13 @@ public class DreamBackend {
.map(ComponentName::unflattenFromString)
.collect(Collectors.toSet());
mSupportedComplications =
Arrays.stream(resources.getIntArray(R.array.config_supportedDreamComplications))
.boxed()
.collect(Collectors.toSet());
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)

View File

@@ -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);
}