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

Commit 1f42a3db authored by Daniel Sandler's avatar Daniel Sandler Committed by Android (Google) Code Review
Browse files

Merge "Bring back Android Dreams." into ics-mr1

parents cb1001b2 e5f2cfeb
Loading
Loading
Loading
Loading
+43 −55
Original line number Diff line number Diff line
@@ -389,8 +389,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    boolean mLockScreenTimerActive;

    // visual screen saver support
    int mScreenSaverTimeout;
    boolean mScreenSaverEnabled = false;
    int mScreenSaverTimeout = 0;
    boolean mScreenSaverEnabled = true;

    // Behavior of ENDCALL Button.  (See Settings.System.END_BUTTON_BEHAVIOR.)
    int mEndcallBehavior;
@@ -454,7 +454,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    Settings.Secure.DEFAULT_INPUT_METHOD), false, this);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    "fancy_rotation_anim"), false, this);
            resolver.registerContentObserver(Settings.System.getUriFor(
            resolver.registerContentObserver(Settings.Secure.getUriFor(
                    Settings.Secure.DREAM_TIMEOUT), false, this);
            updateSettings();
        }
@@ -909,9 +909,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                updateRotation = true;
            }

            mScreenSaverTimeout = Settings.System.getInt(resolver,
            mScreenSaverTimeout = Settings.Secure.getInt(resolver,
                    Settings.Secure.DREAM_TIMEOUT, 0);
            mScreenSaverEnabled = true;
            updateScreenSaverTimeoutLocked();
        }
        if (updateRotation) {
@@ -3417,26 +3416,22 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            }
        }

        // Turn this off for now, screen savers not currently enabled.
        if (false) {
        synchronized (mLock) {
            // Only posts messages; holds no additional locks.
            updateScreenSaverTimeoutLocked();
        }
    }
    }

    Runnable mScreenSaverActivator = null;
    /*new Runnable() {
    Runnable mScreenSaverActivator = new Runnable() {
        public void run() {
            synchronized (this) {
                if (!(mScreenSaverEnabled && mScreenOn)) {
            if (!(mScreenSaverEnabled && mScreenOnEarly)) {
                Log.w(TAG, "mScreenSaverActivator ran, but the screensaver should not be showing. Who's driving this thing?");
                return;
            }

            if (localLOGV) Log.v(TAG, "mScreenSaverActivator entering dreamland");
            try {
                    String component = Settings.System.getString(
                String component = Settings.Secure.getString(
                        mContext.getContentResolver(), Settings.Secure.DREAM_COMPONENT);
                if (component != null) {
                    ComponentName cn = ComponentName.unflattenFromString(component);
@@ -3445,7 +3440,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                            | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
                            | Intent.FLAG_ACTIVITY_NO_USER_ACTION
                                | Intent.FLAG_ACTIVITY_SINGLE_TOP);
                            );
                    mContext.startActivity(intent);
                } else {
                    Log.e(TAG, "Couldn't start screen saver: none selected");
@@ -3455,18 +3450,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                Log.e(TAG, "Couldn't start screen saver: none installed");
            }
        }
        }
    };
    */

    // Must call while holding mLock
    private void updateScreenSaverTimeoutLocked() {
        if (mScreenSaverActivator == null) return;

        // GAH...  acquiring a lock within a lock?  Please let's fix this.
        // (Also note this is called from userActivity, with the power manager
        // lock  held.  Not good.)
        synchronized (mScreenSaverActivator) {
        mHandler.removeCallbacks(mScreenSaverActivator);
        if (mScreenSaverEnabled && mScreenOnEarly && mScreenSaverTimeout > 0) {
            if (localLOGV)
@@ -3483,7 +3472,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            }
        }
    }
    }

    Runnable mScreenLockTimeout = new Runnable() {
        public void run() {