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
This commit is contained in:
Lucas Silva
2022-01-31 21:49:24 +00:00
parent e63c1ae566
commit 9b0862f268
5 changed files with 18 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

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

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