diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index 64c54d9e9cd9b..eefb9fe696870 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -46,6 +46,16 @@ + + + + + + + + + diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 8108a90194a07..1a6cae2ec2f76 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -351,4 +351,7 @@ Clear all notifications. + + + Activate screen saver diff --git a/packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java b/packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java new file mode 100644 index 0000000000000..b8cdd73aa1d97 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java @@ -0,0 +1,39 @@ +package com.android.systemui; + +import android.app.Activity; +import android.content.BroadcastReceiver; +import android.content.ComponentName; +import android.content.ContentResolver; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.provider.Settings; +import android.util.Slog; + +public class DreamsDockLauncher extends Activity { + private static final String TAG = "DreamsDockLauncher"; + @Override + protected void onCreate (Bundle icicle) { + super.onCreate(icicle); + try { + String component = Settings.Secure.getString( + getContentResolver(), Settings.Secure.DREAM_COMPONENT); + if (component != null) { + ComponentName cn = ComponentName.unflattenFromString(component); + Intent zzz = new Intent(Intent.ACTION_MAIN) + .setComponent(cn) + .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK + | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS + | Intent.FLAG_ACTIVITY_NO_USER_ACTION + ); + startActivity(zzz); + } else { + Slog.e(TAG, "Couldn't start screen saver: none selected"); + } + } catch (android.content.ActivityNotFoundException exc) { + // no screensaver? give up + Slog.e(TAG, "Couldn't start screen saver: none installed"); + } + finish(); + } +}