Allow dream previews to be called with only the component name.

Bug: 217556080
Test: locally on device
Change-Id: If6ba2ecd4fb60b9a7e474338f4684bb7ef93392e
This commit is contained in:
Lucas Silva
2022-02-08 20:52:21 +00:00
parent 5479e1e07b
commit 705622a8be

View File

@@ -454,21 +454,26 @@ public class DreamBackend {
uiContext.startActivity(intent);
}
public void preview(DreamInfo dreamInfo) {
logd("preview(%s)", dreamInfo);
if (mDreamManager == null || dreamInfo == null || dreamInfo.componentName == null)
/**
* Preview a dream, given the component name.
*/
public void preview(ComponentName componentName) {
logd("preview(%s)", componentName);
if (mDreamManager == null || componentName == null) {
return;
}
try {
mDreamManager.testDream(mContext.getUserId(), dreamInfo.componentName);
mDreamManager.testDream(mContext.getUserId(), componentName);
} catch (RemoteException e) {
Log.w(TAG, "Failed to preview " + dreamInfo, e);
Log.w(TAG, "Failed to preview " + componentName, e);
}
}
public void startDreaming() {
logd("startDreaming()");
if (mDreamManager == null)
if (mDreamManager == null) {
return;
}
try {
mDreamManager.dream();
} catch (RemoteException e) {