Settings: Minimal refactor to support new dreams api.

Fix breaking changes to the dreams api.  Master toggle
and multiple dreams support in Settings will be done in
a subsequent change.

Bug:7028665
Change-Id: Ia56dd00ec50323fbba06473b1747e5015a3f1898
This commit is contained in:
John Spurlock
2012-08-22 09:59:44 -04:00
parent 395f5f7007
commit e5a84b2ea1
3 changed files with 21 additions and 7 deletions

View File

@@ -16,7 +16,7 @@
package com.android.settings;
import static android.provider.Settings.Secure.SCREENSAVER_COMPONENT;
import static android.provider.Settings.Secure.SCREENSAVER_COMPONENTS;
import android.app.AlertDialog;
import android.content.Context;
@@ -79,7 +79,9 @@ public class DreamComponentPreference extends Preference {
IDreamManager dm = IDreamManager.Stub.asInterface(
ServiceManager.getService("dreams"));
try {
cn = dm.getDreamComponent();
ComponentName[] dreams = dm.getDreamComponents();
if (dreams != null && dreams.length > 0)
cn = dreams[0];
} catch (RemoteException ex) { }
if (cn == null) {
@@ -226,7 +228,8 @@ public class DreamComponentPreference extends Preference {
IDreamManager dm = IDreamManager.Stub.asInterface(
ServiceManager.getService("dreams"));
try {
dm.setDreamComponent(cn);
ComponentName[] dreams = { cn };
dm.setDreamComponents(dreams);
} catch (RemoteException ex) {
// too bad, so sad, oh mom, oh dad
}