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

Commit 4922540a authored by William Leshner's avatar William Leshner Committed by Android (Google) Code Review
Browse files

Merge "Don't allow user to dream when not unlocked." into tm-qpr-dev

parents d8aadbd7 3cc877a2
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import android.os.ShellCallback;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.service.dreams.DreamManagerInternal;
import android.service.dreams.DreamService;
@@ -113,6 +114,7 @@ public final class DreamManagerService extends SystemService {
    private final PowerManagerInternal mPowerManagerInternal;
    private final PowerManager.WakeLock mDozeWakeLock;
    private final ActivityTaskManagerInternal mAtmInternal;
    private final UserManager mUserManager;
    private final UiEventLogger mUiEventLogger;
    private final DreamUiEventLogger mDreamUiEventLogger;
    private final ComponentName mAmbientDisplayComponent;
@@ -212,6 +214,7 @@ public final class DreamManagerService extends SystemService {
        mPowerManager = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
        mPowerManagerInternal = getLocalService(PowerManagerInternal.class);
        mAtmInternal = getLocalService(ActivityTaskManagerInternal.class);
        mUserManager = context.getSystemService(UserManager.class);
        mDozeWakeLock = mPowerManager.newWakeLock(PowerManager.DOZE_WAKE_LOCK, DOZE_WAKE_LOCK_TAG);
        mDozeConfig = new AmbientDisplayConfiguration(mContext);
        mUiEventLogger = new UiEventLoggerImpl();
@@ -383,6 +386,10 @@ public final class DreamManagerService extends SystemService {
                return false;
            }

            if (!mUserManager.isUserUnlocked()) {
                return false;
            }

            if ((mWhenToDream & DREAM_ON_CHARGE) == DREAM_ON_CHARGE) {
                return mIsCharging;
            }