Skip to content

Commit d2b22a8

Browse files
committed
Put screensavers back in the icebox for now. DO NOT MERGE.
Bug: 5689684 Change-Id: I3a5291c3520bb43e35d55714f1522e4ae7f6e63c
1 parent 2f504d9 commit d2b22a8

File tree

7 files changed

+1
-269
lines changed

7 files changed

+1
-269
lines changed

core/java/android/provider/Settings.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4019,28 +4019,6 @@ public static final String getBluetoothInputDevicePriorityKey(String address) {
40194019
public static final String SETUP_PREPAID_DETECTION_REDIR_HOST =
40204020
"setup_prepaid_detection_redir_host";
40214021

4022-
/**
4023-
* Whether the screensaver is enabled.
4024-
* @hide
4025-
*/
4026-
public static final String SCREENSAVER_ENABLED = "screensaver_enabled";
4027-
4028-
/**
4029-
* The user's chosen screensaver component.
4030-
*
4031-
* This component will be launched by the PhoneWindowManager after a timeout when not on
4032-
* battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1).
4033-
* @hide
4034-
*/
4035-
public static final String SCREENSAVER_COMPONENT = "screensaver_component";
4036-
4037-
/**
4038-
* Whether the screensaver should be automatically launched when the device is inserted
4039-
* into a (desk) dock.
4040-
* @hide
4041-
*/
4042-
public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock";
4043-
40444022
/** {@hide} */
40454023
public static final String NETSTATS_ENABLED = "netstats_enabled";
40464024
/** {@hide} */

core/res/res/values/config.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,4 @@
741741
<string name="config_wimaxServiceClassname"></string>
742742
<!-- Name of the wimax state tracker clas -->
743743
<string name="config_wimaxStateTrackerClassname"></string>
744-
745-
<!-- Name of screensaver components to look for if none has been chosen by the user -->
746-
<string name="config_defaultDreamComponent">com.google.android.deskclock/com.android.deskclock.Screensaver</string>
747744
</resources>

packages/SystemUI/AndroidManifest.xml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,6 @@
4646
</intent-filter>
4747
</receiver>
4848

49-
<!-- should you need to launch the screensaver, this is a good way to do it -->
50-
<activity android:name=".DreamsDockLauncher"
51-
android:theme="@android:style/Theme.Dialog"
52-
android:label="@string/dreams_dock_launcher">
53-
<intent-filter>
54-
<action android:name="android.intent.action.MAIN" />
55-
<category android:name="android.intent.category.DEFAULT" />
56-
</intent-filter>
57-
</activity>
58-
59-
<!-- launch screensaver on (desk) dock event -->
60-
<receiver android:name=".DreamsDockLauncher$DockEventReceiver"
61-
android:exported="true"
62-
>
63-
<intent-filter>
64-
<action android:name="android.intent.action.DOCK_EVENT" />
65-
</intent-filter>
66-
</receiver>
67-
68-
6949
<activity android:name=".usb.UsbStorageActivity"
7050
android:label="@*android:string/usb_storage_activity_title"
7151
android:excludeFromRecents="true">

packages/SystemUI/res/values/strings.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,4 @@
362362

363363
<!-- Content description of the clear button in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
364364
<string name="accessibility_clear_all">Clear all notifications.</string>
365-
366-
<!-- Description of the desk dock action that invokes the Android Dreams screen saver feature -->
367-
<string name="dreams_dock_launcher">Activate screen saver</string>
368365
</resources>

packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java

Lines changed: 0 additions & 78 deletions
This file was deleted.

policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Lines changed: 0 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
164164
static final boolean ENABLE_CAR_DOCK_HOME_CAPTURE = true;
165165
static final boolean ENABLE_DESK_DOCK_HOME_CAPTURE = false;
166166

167-
// Should screen savers use their own timeout, or the SCREEN_OFF_TIMEOUT?
168-
static final boolean SEPARATE_TIMEOUT_FOR_SCREEN_SAVER = false;
169-
170167
static final int LONG_PRESS_POWER_NOTHING = 0;
171168
static final int LONG_PRESS_POWER_GLOBAL_ACTIONS = 1;
172169
static final int LONG_PRESS_POWER_SHUT_OFF = 2;
@@ -422,12 +419,6 @@ public void handleMotion(MotionEvent event, InputQueue.FinishedCallback finished
422419
int mLockScreenTimeout;
423420
boolean mLockScreenTimerActive;
424421

425-
// visual screen saver support
426-
int mScreenSaverTimeout = 0;
427-
boolean mScreenSaverEnabledByUser = false;
428-
boolean mScreenSaverMayRun = true; // false if a wakelock is held
429-
boolean mPluggedIn;
430-
431422
// Behavior of ENDCALL Button. (See Settings.System.END_BUTTON_BEHAVIOR.)
432423
int mEndcallBehavior;
433424

@@ -490,12 +481,6 @@ void observe() {
490481
Settings.Secure.DEFAULT_INPUT_METHOD), false, this);
491482
resolver.registerContentObserver(Settings.System.getUriFor(
492483
"fancy_rotation_anim"), false, this);
493-
resolver.registerContentObserver(Settings.Secure.getUriFor(
494-
Settings.Secure.SCREENSAVER_ENABLED), false, this);
495-
if (SEPARATE_TIMEOUT_FOR_SCREEN_SAVER) {
496-
resolver.registerContentObserver(Settings.Secure.getUriFor(
497-
"screensaver_timeout"), false, this);
498-
} // otherwise SCREEN_OFF_TIMEOUT will do nicely
499484
updateSettings();
500485
}
501486

@@ -803,14 +788,6 @@ public void init(Context context, IWindowManager windowManager,
803788
Intent.EXTRA_DOCK_STATE_UNDOCKED);
804789
}
805790

806-
// watch the plug to know whether to trigger the screen saver
807-
filter = new IntentFilter();
808-
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
809-
intent = context.registerReceiver(mPowerReceiver, filter);
810-
if (intent != null) {
811-
mPluggedIn = (0 != intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0));
812-
}
813-
814791
mVibrator = new Vibrator();
815792
mLongPressVibePattern = getLongIntArray(mContext.getResources(),
816793
com.android.internal.R.array.config_longPressVibePattern);
@@ -959,23 +936,6 @@ public void updateSettings() {
959936
mHasSoftInput = hasSoftInput;
960937
updateRotation = true;
961938
}
962-
963-
mScreenSaverEnabledByUser = 0 != Settings.Secure.getInt(resolver,
964-
Settings.Secure.SCREENSAVER_ENABLED, 1);
965-
966-
if (SEPARATE_TIMEOUT_FOR_SCREEN_SAVER) {
967-
mScreenSaverTimeout = Settings.Secure.getInt(resolver,
968-
"screensaver_timeout", 0);
969-
} else {
970-
mScreenSaverTimeout = Settings.System.getInt(resolver,
971-
Settings.System.SCREEN_OFF_TIMEOUT, 0);
972-
if (mScreenSaverTimeout > 0) {
973-
// We actually want to activate the screensaver just before the
974-
// power manager's screen timeout
975-
mScreenSaverTimeout -= 5000;
976-
}
977-
}
978-
updateScreenSaverTimeoutLocked();
979939
}
980940
if (updateRotation) {
981941
updateRotation(true);
@@ -3027,15 +2987,6 @@ public void onReceive(Context context, Intent intent) {
30272987
}
30282988
};
30292989

3030-
BroadcastReceiver mPowerReceiver = new BroadcastReceiver() {
3031-
public void onReceive(Context context, Intent intent) {
3032-
if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) {
3033-
mPluggedIn = (0 != intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0));
3034-
if (localLOGV) Log.v(TAG, "BATTERY_CHANGED: " + intent + " plugged=" + mPluggedIn);
3035-
}
3036-
}
3037-
};
3038-
30392990
/** {@inheritDoc} */
30402991
public void screenTurnedOff(int why) {
30412992
EventLog.writeEvent(70000, 0);
@@ -3047,7 +2998,6 @@ public void screenTurnedOff(int why) {
30472998
synchronized (mLock) {
30482999
updateOrientationListenerLp();
30493000
updateLockScreenTimeout();
3050-
updateScreenSaverTimeoutLocked();
30513001
}
30523002
}
30533003

@@ -3094,7 +3044,6 @@ public void screenTurningOn(final ScreenOnListener screenOnListener) {
30943044
mScreenOnEarly = true;
30953045
updateOrientationListenerLp();
30963046
updateLockScreenTimeout();
3097-
updateScreenSaverTimeoutLocked();
30983047
}
30993048
}
31003049

@@ -3489,85 +3438,6 @@ public void userActivity() {
34893438
mHandler.postDelayed(mScreenLockTimeout, mLockScreenTimeout);
34903439
}
34913440
}
3492-
3493-
synchronized (mLock) {
3494-
// Only posts messages; holds no additional locks.
3495-
updateScreenSaverTimeoutLocked();
3496-
}
3497-
}
3498-
3499-
Runnable mScreenSaverActivator = new Runnable() {
3500-
public void run() {
3501-
if (!(mScreenSaverMayRun && mScreenOnEarly)) {
3502-
Log.w(TAG, "mScreenSaverActivator ran, but the screensaver should not be showing. Who's driving this thing?");
3503-
return;
3504-
}
3505-
if (!mPluggedIn) {
3506-
if (localLOGV) Log.v(TAG, "mScreenSaverActivator: not running screen saver when not plugged in");
3507-
return;
3508-
}
3509-
// Quick fix for automation tests.
3510-
// The correct fix is to move this triggering logic to PowerManager, where more complete
3511-
// information about wakelocks (including StayOnWhilePluggedIn) is available.
3512-
if (Settings.System.getInt(mContext.getContentResolver(),
3513-
Settings.System.STAY_ON_WHILE_PLUGGED_IN,
3514-
BatteryManager.BATTERY_PLUGGED_AC) != 0) {
3515-
Log.v(TAG, "mScreenSaverActivator: not running screen saver when STAY_ON_WHILE_PLUGGED_IN");
3516-
return;
3517-
}
3518-
3519-
if (localLOGV) Log.v(TAG, "mScreenSaverActivator entering dreamland");
3520-
3521-
try {
3522-
String component = Settings.Secure.getString(
3523-
mContext.getContentResolver(), Settings.Secure.SCREENSAVER_COMPONENT);
3524-
if (component == null) {
3525-
component = mContext.getResources().getString(R.string.config_defaultDreamComponent);
3526-
}
3527-
if (component != null) {
3528-
// dismiss the notification shade, recents, etc.
3529-
mContext.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)
3530-
.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT));
3531-
3532-
ComponentName cn = ComponentName.unflattenFromString(component);
3533-
Intent intent = new Intent(Intent.ACTION_MAIN)
3534-
.setComponent(cn)
3535-
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
3536-
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
3537-
| Intent.FLAG_ACTIVITY_NO_USER_ACTION
3538-
| Intent.FLAG_FROM_BACKGROUND
3539-
| Intent.FLAG_ACTIVITY_NO_HISTORY
3540-
);
3541-
mContext.startActivity(intent);
3542-
} else {
3543-
Log.e(TAG, "Couldn't start screen saver: none selected");
3544-
}
3545-
} catch (android.content.ActivityNotFoundException exc) {
3546-
// no screensaver? give up
3547-
Log.e(TAG, "Couldn't start screen saver: none installed");
3548-
}
3549-
}
3550-
};
3551-
3552-
// Must call while holding mLock
3553-
private void updateScreenSaverTimeoutLocked() {
3554-
if (mScreenSaverActivator == null) return;
3555-
3556-
mHandler.removeCallbacks(mScreenSaverActivator);
3557-
if (mScreenSaverEnabledByUser && mScreenSaverMayRun && mScreenOnEarly && mScreenSaverTimeout > 0) {
3558-
if (localLOGV)
3559-
Log.v(TAG, "scheduling screensaver for " + mScreenSaverTimeout + "ms from now");
3560-
mHandler.postDelayed(mScreenSaverActivator, mScreenSaverTimeout);
3561-
} else {
3562-
if (localLOGV) {
3563-
if (!mScreenSaverEnabledByUser || mScreenSaverTimeout == 0)
3564-
Log.v(TAG, "screen saver disabled by user");
3565-
else if (!mScreenOnEarly)
3566-
Log.v(TAG, "screen saver disabled while screen off");
3567-
else
3568-
Log.v(TAG, "screen saver disabled by wakelock");
3569-
}
3570-
}
35713441
}
35723442

35733443
Runnable mScreenLockTimeout = new Runnable() {
@@ -3773,11 +3643,6 @@ public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean al
37733643
}
37743644

37753645
public void screenOnStartedLw() {
3776-
// The window manager has just grabbed a wake lock. This is our cue to disable the screen
3777-
// saver.
3778-
synchronized (mLock) {
3779-
mScreenSaverMayRun = false;
3780-
}
37813646
}
37823647

37833648
public void screenOnStoppedLw() {
@@ -3786,13 +3651,6 @@ public void screenOnStoppedLw() {
37863651
long curTime = SystemClock.uptimeMillis();
37873652
mPowerManager.userActivity(curTime, false, LocalPowerManager.OTHER_EVENT);
37883653
}
3789-
3790-
synchronized (mLock) {
3791-
// even if the keyguard is up, now that all the wakelocks have been released, we
3792-
// should re-enable the screen saver
3793-
mScreenSaverMayRun = true;
3794-
updateScreenSaverTimeoutLocked();
3795-
}
37963654
}
37973655
}
37983656

services/java/com/android/server/UiModeManagerService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class UiModeManagerService extends IUiModeManager.Stub {
6565

6666
// Enable launching of applications when entering the dock.
6767
private static final boolean ENABLE_LAUNCH_CAR_DOCK_APP = true;
68-
private static final boolean ENABLE_LAUNCH_DESK_DOCK_APP = false;
68+
private static final boolean ENABLE_LAUNCH_DESK_DOCK_APP = true;
6969

7070
private static final int MSG_UPDATE_TWILIGHT = 0;
7171
private static final int MSG_ENABLE_LOCATION_UPDATES = 1;

0 commit comments

Comments
 (0)