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:
Steven Ng
2022-02-04 15:48:15 +00:00
parent 949ee0518c
commit 89f5e2e497
2 changed files with 10 additions and 0 deletions

View File

@@ -17,11 +17,13 @@
package com.android.settings.display.darkmode;
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.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.util.FeatureFlagUtils;
import androidx.annotation.Nullable;
@@ -44,6 +46,10 @@ public final class BedtimeSettings {
*/
@Nullable
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(
mWellbeingPackage);
ResolveInfo bedtimeSettingInfo = mPackageManager.resolveActivity(bedtimeSettingsIntent,