Loading core/java/android/service/dreams/DreamService.java +19 −8 Original line number Diff line number Diff line Loading @@ -1306,7 +1306,8 @@ public class DreamService extends Service implements Window.Callback { * @param dreamToken Token for this dream service. * @param started A callback that will be invoked once onDreamingStarted has completed. */ private void attach(IBinder dreamToken, boolean canDoze, IRemoteCallback started) { private void attach(IBinder dreamToken, boolean canDoze, boolean isPreviewMode, IRemoteCallback started) { if (mDreamToken != null) { Slog.e(mTag, "attach() called when dream with token=" + mDreamToken + " already attached"); Loading Loading @@ -1354,7 +1355,8 @@ public class DreamService extends Service implements Window.Callback { i.putExtra(DreamActivity.EXTRA_CALLBACK, new DreamActivityCallbacks(mDreamToken)); final ServiceInfo serviceInfo = fetchServiceInfo(this, new ComponentName(this, getClass())); i.putExtra(DreamActivity.EXTRA_DREAM_TITLE, fetchDreamLabel(this, serviceInfo)); i.putExtra(DreamActivity.EXTRA_DREAM_TITLE, fetchDreamLabel(this, serviceInfo, isPreviewMode)); try { if (!ActivityTaskManager.getService().startDreamActivity(i)) { Loading Loading @@ -1470,10 +1472,18 @@ public class DreamService extends Service implements Window.Callback { @Nullable private static CharSequence fetchDreamLabel(Context context, @Nullable ServiceInfo serviceInfo) { if (serviceInfo == null) return null; @Nullable ServiceInfo serviceInfo, boolean isPreviewMode) { if (serviceInfo == null) { return null; } final PackageManager pm = context.getPackageManager(); return serviceInfo.loadLabel(pm); final CharSequence dreamLabel = serviceInfo.loadLabel(pm); if (!isPreviewMode || dreamLabel == null) { return dreamLabel; } // When in preview mode, return a special label indicating the dream is in preview. return context.getResources().getString(R.string.dream_preview_title, dreamLabel); } @Nullable Loading Loading @@ -1529,8 +1539,9 @@ public class DreamService extends Service implements Window.Callback { final class DreamServiceWrapper extends IDreamService.Stub { @Override public void attach(final IBinder dreamToken, final boolean canDoze, IRemoteCallback started) { mHandler.post(() -> DreamService.this.attach(dreamToken, canDoze, started)); final boolean isPreviewMode, IRemoteCallback started) { mHandler.post( () -> DreamService.this.attach(dreamToken, canDoze, isPreviewMode, started)); } @Override Loading core/java/android/service/dreams/IDreamService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import android.os.IRemoteCallback; * @hide */ oneway interface IDreamService { void attach(IBinder windowToken, boolean canDoze, IRemoteCallback started); void attach(IBinder windowToken, boolean canDoze, boolean isPreviewMode, IRemoteCallback started); void detach(); void wakeUp(); } core/res/res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -975,6 +975,11 @@ <!-- Description for the capability of an accessibility service to take screenshot. [CHAR LIMIT=NONE] --> <string name="capability_desc_canTakeScreenshot">Can take a screenshot of the display.</string> <!-- Dream --> <!-- The title to use when a dream is opened in preview mode. [CHAR LIMIT=NONE] --> <string name="dream_preview_title">Preview, <xliff:g id="dream_name" example="Clock">%1$s</xliff:g></string> <!-- Permissions --> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> Loading core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -4285,6 +4285,8 @@ <java-symbol type="string" name="capability_desc_canTakeScreenshot" /> <java-symbol type="string" name="capability_title_canTakeScreenshot" /> <java-symbol type="string" name="dream_preview_title" /> <java-symbol type="string" name="config_servicesExtensionPackage" /> <!-- For app process exit info tracking --> Loading services/core/java/com/android/server/dreams/DreamController.java +1 −1 Original line number Diff line number Diff line Loading @@ -270,7 +270,7 @@ final class DreamController { try { service.asBinder().linkToDeath(mCurrentDream, 0); service.attach(mCurrentDream.mToken, mCurrentDream.mCanDoze, mCurrentDream.mDreamingStartedCallback); mCurrentDream.mIsPreviewMode, mCurrentDream.mDreamingStartedCallback); } catch (RemoteException ex) { Slog.e(TAG, "The dream service died unexpectedly.", ex); stopDream(true /*immediate*/, "attach failed"); Loading Loading
core/java/android/service/dreams/DreamService.java +19 −8 Original line number Diff line number Diff line Loading @@ -1306,7 +1306,8 @@ public class DreamService extends Service implements Window.Callback { * @param dreamToken Token for this dream service. * @param started A callback that will be invoked once onDreamingStarted has completed. */ private void attach(IBinder dreamToken, boolean canDoze, IRemoteCallback started) { private void attach(IBinder dreamToken, boolean canDoze, boolean isPreviewMode, IRemoteCallback started) { if (mDreamToken != null) { Slog.e(mTag, "attach() called when dream with token=" + mDreamToken + " already attached"); Loading Loading @@ -1354,7 +1355,8 @@ public class DreamService extends Service implements Window.Callback { i.putExtra(DreamActivity.EXTRA_CALLBACK, new DreamActivityCallbacks(mDreamToken)); final ServiceInfo serviceInfo = fetchServiceInfo(this, new ComponentName(this, getClass())); i.putExtra(DreamActivity.EXTRA_DREAM_TITLE, fetchDreamLabel(this, serviceInfo)); i.putExtra(DreamActivity.EXTRA_DREAM_TITLE, fetchDreamLabel(this, serviceInfo, isPreviewMode)); try { if (!ActivityTaskManager.getService().startDreamActivity(i)) { Loading Loading @@ -1470,10 +1472,18 @@ public class DreamService extends Service implements Window.Callback { @Nullable private static CharSequence fetchDreamLabel(Context context, @Nullable ServiceInfo serviceInfo) { if (serviceInfo == null) return null; @Nullable ServiceInfo serviceInfo, boolean isPreviewMode) { if (serviceInfo == null) { return null; } final PackageManager pm = context.getPackageManager(); return serviceInfo.loadLabel(pm); final CharSequence dreamLabel = serviceInfo.loadLabel(pm); if (!isPreviewMode || dreamLabel == null) { return dreamLabel; } // When in preview mode, return a special label indicating the dream is in preview. return context.getResources().getString(R.string.dream_preview_title, dreamLabel); } @Nullable Loading Loading @@ -1529,8 +1539,9 @@ public class DreamService extends Service implements Window.Callback { final class DreamServiceWrapper extends IDreamService.Stub { @Override public void attach(final IBinder dreamToken, final boolean canDoze, IRemoteCallback started) { mHandler.post(() -> DreamService.this.attach(dreamToken, canDoze, started)); final boolean isPreviewMode, IRemoteCallback started) { mHandler.post( () -> DreamService.this.attach(dreamToken, canDoze, isPreviewMode, started)); } @Override Loading
core/java/android/service/dreams/IDreamService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import android.os.IRemoteCallback; * @hide */ oneway interface IDreamService { void attach(IBinder windowToken, boolean canDoze, IRemoteCallback started); void attach(IBinder windowToken, boolean canDoze, boolean isPreviewMode, IRemoteCallback started); void detach(); void wakeUp(); }
core/res/res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -975,6 +975,11 @@ <!-- Description for the capability of an accessibility service to take screenshot. [CHAR LIMIT=NONE] --> <string name="capability_desc_canTakeScreenshot">Can take a screenshot of the display.</string> <!-- Dream --> <!-- The title to use when a dream is opened in preview mode. [CHAR LIMIT=NONE] --> <string name="dream_preview_title">Preview, <xliff:g id="dream_name" example="Clock">%1$s</xliff:g></string> <!-- Permissions --> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> Loading
core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -4285,6 +4285,8 @@ <java-symbol type="string" name="capability_desc_canTakeScreenshot" /> <java-symbol type="string" name="capability_title_canTakeScreenshot" /> <java-symbol type="string" name="dream_preview_title" /> <java-symbol type="string" name="config_servicesExtensionPackage" /> <!-- For app process exit info tracking --> Loading
services/core/java/com/android/server/dreams/DreamController.java +1 −1 Original line number Diff line number Diff line Loading @@ -270,7 +270,7 @@ final class DreamController { try { service.asBinder().linkToDeath(mCurrentDream, 0); service.attach(mCurrentDream.mToken, mCurrentDream.mCanDoze, mCurrentDream.mDreamingStartedCallback); mCurrentDream.mIsPreviewMode, mCurrentDream.mDreamingStartedCallback); } catch (RemoteException ex) { Slog.e(TAG, "The dream service died unexpectedly.", ex); stopDream(true /*immediate*/, "attach failed"); Loading