Loading core/java/android/service/dreams/DreamService.java +14 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.service.dreams; import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.service.dreams.Flags.dreamHandlesConfirmKeys; import static android.service.dreams.Flags.dreamHandlesBeingObscured; import static android.service.dreams.Flags.startAndStopDozingInBackground; import android.annotation.FlaggedApi; import android.annotation.IdRes; Loading Loading @@ -923,9 +924,16 @@ public class DreamService extends Service implements Window.Callback { if (mDozing) { try { if (startAndStopDozingInBackground()) { mDreamManager.startDozingOneway( mDreamToken, mDozeScreenState, mDozeScreenStateReason, mDozeScreenBrightness); } else { mDreamManager.startDozing( mDreamToken, mDozeScreenState, mDozeScreenStateReason, mDozeScreenBrightness); } } catch (RemoteException ex) { // system server died } Loading Loading @@ -1250,7 +1258,11 @@ public class DreamService extends Service implements Window.Callback { try { // finishSelf will unbind the dream controller from the dream service. This will // trigger DreamService.this.onDestroy and DreamService.this will die. if (startAndStopDozingInBackground()) { mDreamManager.finishSelfOneway(mDreamToken, true /*immediate*/); } else { mDreamManager.finishSelf(mDreamToken, true /*immediate*/); } } catch (RemoteException ex) { // system server died } Loading core/java/android/service/dreams/IDreamManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -50,4 +50,6 @@ interface IDreamManager { void startDreamActivity(in Intent intent); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.WRITE_DREAM_STATE)") oneway void setDreamIsObscured(in boolean isObscured); oneway void startDozingOneway(in IBinder token, int screenState, int reason, int screenBrightness); oneway void finishSelfOneway(in IBinder token, boolean immediate); } core/java/android/service/dreams/flags.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -47,3 +47,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "start_and_stop_dozing_in_background" namespace: "systemui" description: "Move the start-dozing and stop-dozing operation to the background" bug: "330287187" metadata { purpose: PURPOSE_BUGFIX } } services/core/java/com/android/server/dreams/DreamManagerService.java +32 −0 Original line number Diff line number Diff line Loading @@ -1078,6 +1078,21 @@ public final class DreamManagerService extends SystemService { } } @Override // Binder call public void finishSelfOneway(IBinder token, boolean immediate) { // Requires no permission, called by Dream from an arbitrary process. if (token == null) { throw new IllegalArgumentException("token must not be null"); } final long ident = Binder.clearCallingIdentity(); try { finishSelfInternal(token, immediate); } finally { Binder.restoreCallingIdentity(ident); } } @Override // Binder call public void startDozing( IBinder token, int screenState, @Display.StateReason int reason, Loading @@ -1095,6 +1110,23 @@ public final class DreamManagerService extends SystemService { } } @Override // Binder call public void startDozingOneway( IBinder token, int screenState, @Display.StateReason int reason, int screenBrightness) { // Requires no permission, called by Dream from an arbitrary process. if (token == null) { throw new IllegalArgumentException("token must not be null"); } final long ident = Binder.clearCallingIdentity(); try { startDozingInternal(token, screenState, reason, screenBrightness); } finally { Binder.restoreCallingIdentity(ident); } } @Override // Binder call public void stopDozing(IBinder token) { // Requires no permission, called by Dream from an arbitrary process. Loading Loading
core/java/android/service/dreams/DreamService.java +14 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.service.dreams; import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.service.dreams.Flags.dreamHandlesConfirmKeys; import static android.service.dreams.Flags.dreamHandlesBeingObscured; import static android.service.dreams.Flags.startAndStopDozingInBackground; import android.annotation.FlaggedApi; import android.annotation.IdRes; Loading Loading @@ -923,9 +924,16 @@ public class DreamService extends Service implements Window.Callback { if (mDozing) { try { if (startAndStopDozingInBackground()) { mDreamManager.startDozingOneway( mDreamToken, mDozeScreenState, mDozeScreenStateReason, mDozeScreenBrightness); } else { mDreamManager.startDozing( mDreamToken, mDozeScreenState, mDozeScreenStateReason, mDozeScreenBrightness); } } catch (RemoteException ex) { // system server died } Loading Loading @@ -1250,7 +1258,11 @@ public class DreamService extends Service implements Window.Callback { try { // finishSelf will unbind the dream controller from the dream service. This will // trigger DreamService.this.onDestroy and DreamService.this will die. if (startAndStopDozingInBackground()) { mDreamManager.finishSelfOneway(mDreamToken, true /*immediate*/); } else { mDreamManager.finishSelf(mDreamToken, true /*immediate*/); } } catch (RemoteException ex) { // system server died } Loading
core/java/android/service/dreams/IDreamManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -50,4 +50,6 @@ interface IDreamManager { void startDreamActivity(in Intent intent); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.WRITE_DREAM_STATE)") oneway void setDreamIsObscured(in boolean isObscured); oneway void startDozingOneway(in IBinder token, int screenState, int reason, int screenBrightness); oneway void finishSelfOneway(in IBinder token, boolean immediate); }
core/java/android/service/dreams/flags.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -47,3 +47,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "start_and_stop_dozing_in_background" namespace: "systemui" description: "Move the start-dozing and stop-dozing operation to the background" bug: "330287187" metadata { purpose: PURPOSE_BUGFIX } }
services/core/java/com/android/server/dreams/DreamManagerService.java +32 −0 Original line number Diff line number Diff line Loading @@ -1078,6 +1078,21 @@ public final class DreamManagerService extends SystemService { } } @Override // Binder call public void finishSelfOneway(IBinder token, boolean immediate) { // Requires no permission, called by Dream from an arbitrary process. if (token == null) { throw new IllegalArgumentException("token must not be null"); } final long ident = Binder.clearCallingIdentity(); try { finishSelfInternal(token, immediate); } finally { Binder.restoreCallingIdentity(ident); } } @Override // Binder call public void startDozing( IBinder token, int screenState, @Display.StateReason int reason, Loading @@ -1095,6 +1110,23 @@ public final class DreamManagerService extends SystemService { } } @Override // Binder call public void startDozingOneway( IBinder token, int screenState, @Display.StateReason int reason, int screenBrightness) { // Requires no permission, called by Dream from an arbitrary process. if (token == null) { throw new IllegalArgumentException("token must not be null"); } final long ident = Binder.clearCallingIdentity(); try { startDozingInternal(token, screenState, reason, screenBrightness); } finally { Binder.restoreCallingIdentity(ident); } } @Override // Binder call public void stopDozing(IBinder token) { // Requires no permission, called by Dream from an arbitrary process. Loading