Add a method in IDreamManager to check if dreaming OR in dream preview
Currently there is no signal to identify that dreaming has started
from the 'preview' option in screen saver settings. This adds a
way to query IDreamManager for this state.
Bubbles needs a way to identify this so that they can hide when
the dream preview starts, otherwise it wouldn't be an accurate
preview.
Bug: 240510360
Test: manual - (with the CL on top of this), have some bubbles and
trigger dream preview, observe that the bubbles hide.
Change-Id: I5f67a8c793970ada05a010c8d36fd4a47b3f8565
This commit is contained in:
@@ -35,6 +35,8 @@ interface IDreamManager {
|
||||
void testDream(int userId, in ComponentName componentName);
|
||||
@UnsupportedAppUsage
|
||||
boolean isDreaming();
|
||||
@UnsupportedAppUsage
|
||||
boolean isDreamingOrInPreview();
|
||||
void finishSelf(in IBinder token, boolean immediate);
|
||||
void startDozing(in IBinder token, int screenState, int screenBrightness);
|
||||
void stopDozing(in IBinder token);
|
||||
|
||||
@@ -218,6 +218,7 @@ public final class DreamManagerService extends SystemService {
|
||||
}, pw, "", 200);
|
||||
}
|
||||
|
||||
/** Whether a real dream is occurring. */
|
||||
private boolean isDreamingInternal() {
|
||||
synchronized (mLock) {
|
||||
return mCurrentDreamToken != null && !mCurrentDreamIsPreview
|
||||
@@ -225,6 +226,13 @@ public final class DreamManagerService extends SystemService {
|
||||
}
|
||||
}
|
||||
|
||||
/** Whether a real dream, or a dream preview is occurring. */
|
||||
private boolean isDreamingOrInPreviewInternal() {
|
||||
synchronized (mLock) {
|
||||
return mCurrentDreamToken != null && !mCurrentDreamIsWaking;
|
||||
}
|
||||
}
|
||||
|
||||
protected void requestStartDreamFromShell() {
|
||||
requestDreamInternal();
|
||||
}
|
||||
@@ -694,6 +702,19 @@ public final class DreamManagerService extends SystemService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override // Binder call
|
||||
public boolean isDreamingOrInPreview() {
|
||||
checkPermission(android.Manifest.permission.READ_DREAM_STATE);
|
||||
|
||||
final long ident = Binder.clearCallingIdentity();
|
||||
try {
|
||||
return isDreamingOrInPreviewInternal();
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(ident);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override // Binder call
|
||||
public void dream() {
|
||||
checkPermission(android.Manifest.permission.WRITE_DREAM_STATE);
|
||||
|
||||
Reference in New Issue
Block a user