summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2011-11-07 18:15:30 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2011-11-07 18:15:30 +0000
commit4f631bbf97fd02c9b33e5678149627ba2c9f1912 (patch)
tree0c69a8fd72c1dc869832ae5b6594f4e26e3b84dd /packages
parent9829cceca11a0fc92ab1318ce32b4d4dae8d347d (diff)
parent010bb273a58444f907bb82f62f8d7274f9637b49 (diff)
downloadframeworks_base-4f631bbf97fd02c9b33e5678149627ba2c9f1912.zip
frameworks_base-4f631bbf97fd02c9b33e5678149627ba2c9f1912.tar.gz
frameworks_base-4f631bbf97fd02c9b33e5678149627ba2c9f1912.tar.bz2
am 010bb273: Merge changes I0da0f04f,I93197665 into ics-mr1
* commit '010bb273a58444f907bb82f62f8d7274f9637b49': Offer the user an option to launch Dreams when docked. Teach UiModeMgr about high-end and low-end desk docks.
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/AndroidManifest.xml10
-rw-r--r--packages/SystemUI/res/values/strings.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java39
3 files changed, 52 insertions, 0 deletions
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 64c54d9..eefb9fe 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -46,6 +46,16 @@
</intent-filter>
</receiver>
+ <!-- handle dock insertion, launch screensaver instead -->
+ <activity android:name=".DreamsDockLauncher"
+ android:label="@string/dreams_dock_launcher">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.DESK_DOCK" />
+ </intent-filter>
+ </activity>
+
<activity android:name=".usb.UsbStorageActivity"
android:excludeFromRecents="true">
</activity>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 8108a90..1a6cae2 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -351,4 +351,7 @@
<!-- Content description of the clear button in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_clear_all">Clear all notifications.</string>
+
+ <!-- Description of the desk dock action that invokes the Android Dreams screen saver feature -->
+ <string name="dreams_dock_launcher">Activate screen saver</string>
</resources>
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 0000000..b8cdd73
--- /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();
+ }
+}