Show "Turns on at bedtime" in Dark theme setting based on feature flag
Test: atest SettingsRoboTests:com.android.settings.display.darkmode.* Bug: 217866453 Change-Id: Ic40975d4506f812790768339e48441a048529df3
This commit is contained in:
@@ -17,11 +17,13 @@
|
|||||||
package com.android.settings.display.darkmode;
|
package com.android.settings.display.darkmode;
|
||||||
|
|
||||||
import static android.provider.Settings.ACTION_BEDTIME_SETTINGS;
|
import static android.provider.Settings.ACTION_BEDTIME_SETTINGS;
|
||||||
|
import static android.util.FeatureFlagUtils.SETTINGS_APP_ALLOW_DARK_THEME_ACTIVATION_AT_BEDTIME;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
|
import android.util.FeatureFlagUtils;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
@@ -44,6 +46,10 @@ public final class BedtimeSettings {
|
|||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public Intent getBedtimeSettingsIntent() {
|
public Intent getBedtimeSettingsIntent() {
|
||||||
|
if (!FeatureFlagUtils.isEnabled(mContext,
|
||||||
|
SETTINGS_APP_ALLOW_DARK_THEME_ACTIVATION_AT_BEDTIME)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Intent bedtimeSettingsIntent = new Intent(ACTION_BEDTIME_SETTINGS).setPackage(
|
Intent bedtimeSettingsIntent = new Intent(ACTION_BEDTIME_SETTINGS).setPackage(
|
||||||
mWellbeingPackage);
|
mWellbeingPackage);
|
||||||
ResolveInfo bedtimeSettingInfo = mPackageManager.resolveActivity(bedtimeSettingsIntent,
|
ResolveInfo bedtimeSettingInfo = mPackageManager.resolveActivity(bedtimeSettingsIntent,
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package com.android.settings.testutils;
|
package com.android.settings.testutils;
|
||||||
|
|
||||||
import static android.provider.Settings.ACTION_BEDTIME_SETTINGS;
|
import static android.provider.Settings.ACTION_BEDTIME_SETTINGS;
|
||||||
|
import static android.util.FeatureFlagUtils.SETTINGS_APP_ALLOW_DARK_THEME_ACTIVATION_AT_BEDTIME;
|
||||||
|
|
||||||
import static org.robolectric.Shadows.shadowOf;
|
import static org.robolectric.Shadows.shadowOf;
|
||||||
|
|
||||||
@@ -25,6 +26,7 @@ import android.content.Intent;
|
|||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
|
import android.util.FeatureFlagUtils;
|
||||||
|
|
||||||
/** A helper class for installing bedtime settings activity. */
|
/** A helper class for installing bedtime settings activity. */
|
||||||
public final class BedtimeSettingsUtils {
|
public final class BedtimeSettingsUtils {
|
||||||
@@ -35,6 +37,8 @@ public final class BedtimeSettingsUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void installBedtimeSettings(String wellbeingPackage, boolean enabled) {
|
public void installBedtimeSettings(String wellbeingPackage, boolean enabled) {
|
||||||
|
FeatureFlagUtils.setEnabled(mContext, SETTINGS_APP_ALLOW_DARK_THEME_ACTIVATION_AT_BEDTIME,
|
||||||
|
true /* enabled */);
|
||||||
Intent bedtimeSettingsIntent = new Intent(ACTION_BEDTIME_SETTINGS)
|
Intent bedtimeSettingsIntent = new Intent(ACTION_BEDTIME_SETTINGS)
|
||||||
.setPackage(wellbeingPackage);
|
.setPackage(wellbeingPackage);
|
||||||
ResolveInfo bedtimeResolveInfo = new ResolveInfo();
|
ResolveInfo bedtimeResolveInfo = new ResolveInfo();
|
||||||
|
Reference in New Issue
Block a user