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

Commit e1119ae1 authored by James Lemieux's avatar James Lemieux
Browse files

Avoid NPE when Screensaver configuration changes

Bug: 22509958
Change-Id: I0ff41d5c02af1471e4510eee17600fb2cb746533
parent b2ea7132
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -115,10 +115,14 @@ public class Screensaver extends DreamService {
    public void onConfigurationChanged(Configuration newConfig) {
        if (DEBUG) Log.d(TAG, "Screensaver configuration changed");
        super.onConfigurationChanged(newConfig);

        // Ignore the configuration change if no window exists.
        if (getWindow() != null) {
            mHandler.removeCallbacks(mMoveSaverRunnable);
            layoutClockSaver();
            mHandler.postDelayed(mMoveSaverRunnable, ORIENTATION_CHANGE_DELAY_MS);
        }
    }

    @Override
    public void onAttachedToWindow() {
@@ -133,7 +137,7 @@ public class Screensaver extends DreamService {
        layoutClockSaver();

        // Setup handlers for time reference changes and date updates.
        IntentFilter filter = new IntentFilter();
        final IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_TIME_CHANGED);
        filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
        registerReceiver(mIntentReceiver, filter);