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

Commit 89ad2871 authored by Steven Ng's avatar Steven Ng Committed by Android (Google) Code Review
Browse files

Merge "Show "Turns on at bedtime" in Dark theme setting based on feature flag"

parents 78ce1be4 89f5e2e4
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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,
+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.settings.testutils;

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;

@@ -25,6 +26,7 @@ import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.ResolveInfo;
import android.util.FeatureFlagUtils;

/** A helper class for installing bedtime settings activity. */
public final class BedtimeSettingsUtils {
@@ -35,6 +37,8 @@ public final class BedtimeSettingsUtils {
    }

    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)
                .setPackage(wellbeingPackage);
        ResolveInfo bedtimeResolveInfo = new ResolveInfo();