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

Commit deb4e778 authored by Lucas Silva's avatar Lucas Silva Committed by Android (Google) Code Review
Browse files

Merge "Don't start dreams immediately if keyguard is occluded when docked." into tm-qpr-dev

parents 45eb2870 1e16b3c2
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -45,6 +45,12 @@ public abstract class DreamManagerInternal {
     */
    public abstract boolean isDreaming();

    /**
     * Ask the power manager to nap.  It will eventually call back into startDream() if/when it is
     * appropriate to start dreaming.
     */
    public abstract void requestDream();

    /**
     * Called by the ActivityTaskManagerService to verify that the startDreamActivity
     * request comes from the current active dream component.
+22 −26
Original line number Diff line number Diff line
@@ -20,13 +20,13 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.Slog;

import com.android.server.LocalServices;

/**
 * Internal helper for launching dreams to ensure consistency between the
 * <code>UiModeManagerService</code> system service and the <code>Somnambulator</code> activity.
@@ -75,9 +75,8 @@ public final class Sandman {
    }

    private static void startDream(Context context, boolean docked) {
        try {
            IDreamManager dreamManagerService = IDreamManager.Stub.asInterface(
                    ServiceManager.getService(DreamService.DREAM_SERVICE));
        DreamManagerInternal dreamManagerService =
                LocalServices.getService(DreamManagerInternal.class);
        if (dreamManagerService != null && !dreamManagerService.isDreaming()) {
            if (docked) {
                Slog.i(TAG, "Activating dream while docked.");
@@ -97,10 +96,7 @@ public final class Sandman {
            }

            // Dream.
                dreamManagerService.dream();
            }
        } catch (RemoteException ex) {
            Slog.e(TAG, "Could not start dream when docked.", ex);
            dreamManagerService.requestDream();
        }
    }

+7 −1
Original line number Diff line number Diff line
@@ -359,6 +359,11 @@ final class UiModeManagerService extends SystemService {
        SystemProperties.set(SYSTEM_PROPERTY_DEVICE_THEME, Integer.toString(mode));
    }

    @VisibleForTesting
    void setStartDreamImmediatelyOnDock(boolean startDreamImmediatelyOnDock) {
        mStartDreamImmediatelyOnDock = startDreamImmediatelyOnDock;
    }

    @Override
    public void onUserSwitching(@Nullable TargetUser from, @NonNull TargetUser to) {
        mCurrentUser = to.getUserIdentifier();
@@ -1824,7 +1829,8 @@ final class UiModeManagerService extends SystemService {

        // If we did not start a dock app, then start dreaming if appropriate.
        if (category != null && !dockAppStarted && (mStartDreamImmediatelyOnDock
                || mKeyguardManager.isKeyguardLocked())) {
                || mWindowManager.isKeyguardShowingAndNotOccluded()
                || !mPowerManager.isInteractive())) {
            Sandman.startDreamWhenDockedIfAppropriate(getContext());
        }
    }
+5 −0
Original line number Diff line number Diff line
@@ -883,6 +883,11 @@ public final class DreamManagerService extends SystemService {
        public ComponentName getActiveDreamComponent(boolean doze) {
            return getActiveDreamComponentInternal(doze);
        }

        @Override
        public void requestDream() {
            requestDreamInternal();
        }
    }

    private final Runnable mSystemPropertiesChanged = new Runnable() {
+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ android_test {
    ],

    static_libs: [
        "frameworks-base-testutils",
        "services.accessibility",
        "services.core",
        "services.devicepolicy",
@@ -32,6 +33,7 @@ android_test {
        "platformprotosnano",
        "statsdprotolite",
        "hamcrest-library",
        "servicestests-utils",
        "testables",
        "truth-prebuilt",
        // TODO: remove once Android migrates to JUnit 4.12,
Loading