Loading core/java/android/service/dreams/DreamManagerInternal.java +11 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.service.dreams; import android.content.ComponentName; /** * Dream manager local system service interface. * Loading @@ -42,4 +44,13 @@ public abstract class DreamManagerInternal { * Called by the power manager to determine whether a dream is running. */ public abstract boolean isDreaming(); /** * Called by the ActivityTaskManagerService to verify that the startDreamActivity * request comes from the current active dream component. * * @param doze If true returns the current active doze component. Otherwise, returns the * active dream component. */ public abstract ComponentName getActiveDreamComponent(boolean doze); } core/java/android/service/dreams/DreamService.java +7 −7 Original line number Diff line number Diff line Loading @@ -608,6 +608,8 @@ public class DreamService extends Service implements Window.Callback { * Marks this dream as windowless. Only available to doze dreams. * * @hide * * TODO: Remove @UnsupportedAppUsage. */ @UnsupportedAppUsage public void setWindowless(boolean windowless) { Loading Loading @@ -904,12 +906,9 @@ public class DreamService extends Service implements Window.Callback { if (mActivity == null) { Slog.w(TAG, "Finish was called before the dream was attached."); return; } } else if (!mActivity.isFinishing()) { // In case the activity is not finished yet, do it now. This can happen if someone calls // finish() directly, without going through wakeUp(). if (!mActivity.isFinishing()) { mActivity.finishAndRemoveTask(); return; } Loading @@ -924,7 +923,6 @@ public class DreamService extends Service implements Window.Callback { } catch (RemoteException ex) { // system server died } } } Loading Loading @@ -995,6 +993,8 @@ public class DreamService extends Service implements Window.Callback { if (mActivity != null && !mActivity.isFinishing()) { mActivity.finishAndRemoveTask(); } else { finish(); } mDreamToken = null; Loading services/core/java/com/android/server/dreams/DreamManagerService.java +9 −0 Original line number Diff line number Diff line Loading @@ -268,6 +268,10 @@ public final class DreamManagerService extends SystemService { } } private ComponentName getActiveDreamComponentInternal(boolean doze) { return chooseDreamForUser(doze, ActivityManager.getCurrentUser()); } private ComponentName chooseDreamForUser(boolean doze, int userId) { if (doze) { ComponentName dozeComponent = getDozeComponent(userId); Loading Loading @@ -671,6 +675,11 @@ public final class DreamManagerService extends SystemService { public boolean isDreaming() { return isDreamingInternal(); } @Override public ComponentName getActiveDreamComponent(boolean doze) { return getActiveDreamComponentInternal(doze); } } private final Runnable mSystemPropertiesChanged = new Runnable() { Loading services/core/java/com/android/server/wm/ActivityTaskManagerService.java +15 −2 Original line number Diff line number Diff line Loading @@ -213,6 +213,7 @@ import android.os.storage.IStorageManager; import android.os.storage.StorageManager; import android.provider.Settings; import android.service.dreams.DreamActivity; import android.service.dreams.DreamManagerInternal; import android.service.voice.IVoiceInteractionSession; import android.service.voice.VoiceInteractionManagerInternal; import android.sysprop.DisplayProperties; Loading Loading @@ -1233,12 +1234,25 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public boolean startDreamActivity(Intent intent) { final WindowProcessController process = mProcessMap.getProcess(Binder.getCallingPid()); final long origId = Binder.clearCallingIdentity(); // The dream activity is only called for non-doze dreams. final ComponentName currentDream = LocalServices.getService(DreamManagerInternal.class) .getActiveDreamComponent(/* doze= */ false); if (currentDream == null || currentDream.getPackageName() == null || !currentDream.getPackageName().equals(process.mInfo.packageName)) { Slog.e(TAG, "Calling package is not the current dream package. " + "Aborting startDreamActivity..."); return false; } final ActivityInfo a = new ActivityInfo(); a.theme = com.android.internal.R.style.Theme_Dream; a.exported = true; a.name = DreamActivity.class.getName(); final WindowProcessController process = mProcessMap.getProcess(Binder.getCallingPid()); a.packageName = process.mInfo.packageName; a.applicationInfo = process.mInfo; Loading @@ -1253,7 +1267,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { a.colorMode = ActivityInfo.COLOR_MODE_DEFAULT; a.flags |= ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS; final long origId = Binder.clearCallingIdentity(); try { getActivityStartController().obtainStarter(intent, "dream") .setActivityInfo(a) Loading Loading
core/java/android/service/dreams/DreamManagerInternal.java +11 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.service.dreams; import android.content.ComponentName; /** * Dream manager local system service interface. * Loading @@ -42,4 +44,13 @@ public abstract class DreamManagerInternal { * Called by the power manager to determine whether a dream is running. */ public abstract boolean isDreaming(); /** * Called by the ActivityTaskManagerService to verify that the startDreamActivity * request comes from the current active dream component. * * @param doze If true returns the current active doze component. Otherwise, returns the * active dream component. */ public abstract ComponentName getActiveDreamComponent(boolean doze); }
core/java/android/service/dreams/DreamService.java +7 −7 Original line number Diff line number Diff line Loading @@ -608,6 +608,8 @@ public class DreamService extends Service implements Window.Callback { * Marks this dream as windowless. Only available to doze dreams. * * @hide * * TODO: Remove @UnsupportedAppUsage. */ @UnsupportedAppUsage public void setWindowless(boolean windowless) { Loading Loading @@ -904,12 +906,9 @@ public class DreamService extends Service implements Window.Callback { if (mActivity == null) { Slog.w(TAG, "Finish was called before the dream was attached."); return; } } else if (!mActivity.isFinishing()) { // In case the activity is not finished yet, do it now. This can happen if someone calls // finish() directly, without going through wakeUp(). if (!mActivity.isFinishing()) { mActivity.finishAndRemoveTask(); return; } Loading @@ -924,7 +923,6 @@ public class DreamService extends Service implements Window.Callback { } catch (RemoteException ex) { // system server died } } } Loading Loading @@ -995,6 +993,8 @@ public class DreamService extends Service implements Window.Callback { if (mActivity != null && !mActivity.isFinishing()) { mActivity.finishAndRemoveTask(); } else { finish(); } mDreamToken = null; Loading
services/core/java/com/android/server/dreams/DreamManagerService.java +9 −0 Original line number Diff line number Diff line Loading @@ -268,6 +268,10 @@ public final class DreamManagerService extends SystemService { } } private ComponentName getActiveDreamComponentInternal(boolean doze) { return chooseDreamForUser(doze, ActivityManager.getCurrentUser()); } private ComponentName chooseDreamForUser(boolean doze, int userId) { if (doze) { ComponentName dozeComponent = getDozeComponent(userId); Loading Loading @@ -671,6 +675,11 @@ public final class DreamManagerService extends SystemService { public boolean isDreaming() { return isDreamingInternal(); } @Override public ComponentName getActiveDreamComponent(boolean doze) { return getActiveDreamComponentInternal(doze); } } private final Runnable mSystemPropertiesChanged = new Runnable() { Loading
services/core/java/com/android/server/wm/ActivityTaskManagerService.java +15 −2 Original line number Diff line number Diff line Loading @@ -213,6 +213,7 @@ import android.os.storage.IStorageManager; import android.os.storage.StorageManager; import android.provider.Settings; import android.service.dreams.DreamActivity; import android.service.dreams.DreamManagerInternal; import android.service.voice.IVoiceInteractionSession; import android.service.voice.VoiceInteractionManagerInternal; import android.sysprop.DisplayProperties; Loading Loading @@ -1233,12 +1234,25 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public boolean startDreamActivity(Intent intent) { final WindowProcessController process = mProcessMap.getProcess(Binder.getCallingPid()); final long origId = Binder.clearCallingIdentity(); // The dream activity is only called for non-doze dreams. final ComponentName currentDream = LocalServices.getService(DreamManagerInternal.class) .getActiveDreamComponent(/* doze= */ false); if (currentDream == null || currentDream.getPackageName() == null || !currentDream.getPackageName().equals(process.mInfo.packageName)) { Slog.e(TAG, "Calling package is not the current dream package. " + "Aborting startDreamActivity..."); return false; } final ActivityInfo a = new ActivityInfo(); a.theme = com.android.internal.R.style.Theme_Dream; a.exported = true; a.name = DreamActivity.class.getName(); final WindowProcessController process = mProcessMap.getProcess(Binder.getCallingPid()); a.packageName = process.mInfo.packageName; a.applicationInfo = process.mInfo; Loading @@ -1253,7 +1267,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { a.colorMode = ActivityInfo.COLOR_MODE_DEFAULT; a.flags |= ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS; final long origId = Binder.clearCallingIdentity(); try { getActivityStartController().obtainStarter(intent, "dream") .setActivityInfo(a) Loading