Merge "Add a method in IDreamManager to check if dreaming OR in dream preview" into tm-qpr-dev
This commit is contained in:
@@ -35,6 +35,8 @@ interface IDreamManager {
|
|||||||
void testDream(int userId, in ComponentName componentName);
|
void testDream(int userId, in ComponentName componentName);
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
boolean isDreaming();
|
boolean isDreaming();
|
||||||
|
@UnsupportedAppUsage
|
||||||
|
boolean isDreamingOrInPreview();
|
||||||
void finishSelf(in IBinder token, boolean immediate);
|
void finishSelf(in IBinder token, boolean immediate);
|
||||||
void startDozing(in IBinder token, int screenState, int screenBrightness);
|
void startDozing(in IBinder token, int screenState, int screenBrightness);
|
||||||
void stopDozing(in IBinder token);
|
void stopDozing(in IBinder token);
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ public final class DreamManagerService extends SystemService {
|
|||||||
}, pw, "", 200);
|
}, pw, "", 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Whether a real dream is occurring. */
|
||||||
private boolean isDreamingInternal() {
|
private boolean isDreamingInternal() {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
return mCurrentDreamToken != null && !mCurrentDreamIsPreview
|
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() {
|
protected void requestStartDreamFromShell() {
|
||||||
requestDreamInternal();
|
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
|
@Override // Binder call
|
||||||
public void dream() {
|
public void dream() {
|
||||||
checkPermission(android.Manifest.permission.WRITE_DREAM_STATE);
|
checkPermission(android.Manifest.permission.WRITE_DREAM_STATE);
|
||||||
|
|||||||
Reference in New Issue
Block a user