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

Commit 9ad7284d authored by Steven Ng's avatar Steven Ng
Browse files

Check if the bedtime settings intent is null before launch

Test: make RunSettingsRoboTests -j56 ROBOTEST_FILTER=com.android.settings.display.darkmode.*
Bug: 306060498
Change-Id: Iddaec94c3a4cba74841d83305e581605c030bf33
parent 9718ae0a
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.app.UiModeManager.MODE_NIGHT_CUSTOM_TYPE_BEDTIME;

import android.app.UiModeManager;
import android.content.Context;
import android.content.Intent;

import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
@@ -52,7 +53,12 @@ public class DarkModeCustomBedtimePreferenceController extends BasePreferenceCon
        super.displayPreference(screen);
        mFooterPreference = screen.findPreference(getPreferenceKey());
        mFooterPreference.setLearnMoreAction(
                v -> v.getContext().startActivity(mBedtimeSettings.getBedtimeSettingsIntent()));
                v -> {
                    Intent bedtimeSettingsIntent = mBedtimeSettings.getBedtimeSettingsIntent();
                    if (bedtimeSettingsIntent != null) {
                        v.getContext().startActivity(bedtimeSettingsIntent);
                    }
                });
        mFooterPreference.setLearnMoreText(
                mContext.getString(R.string.dark_ui_bedtime_footer_action));
    }