Add isDreaming method to DreamManager
This CL adds isDreaming to DreamMaanger and changes the way it starts a dream to use IDreamManager.dream() DreamManager is only used for testing. So far it has been using the DreamManagerInternal.testDream() API to start the dream. This restricts the amount of verification that can be done in the dream tests because it doesn't put the device in a dreaming state - IDreamManager.isDreaming() is always false. IDreamManager.dream() puts the device in a dreaming state and enables better testing. Bug: 152994058 Test: atest DreamManagerServiceTests Change-Id: Id4d947e83eabcafa9724764b8d063357c5f2cb49
This commit is contained in:
@@ -431,6 +431,7 @@ package android.app {
|
||||
}
|
||||
|
||||
public class DreamManager {
|
||||
method @RequiresPermission("android.permission.READ_DREAM_STATE") public boolean isDreaming();
|
||||
method @RequiresPermission("android.permission.WRITE_DREAM_STATE") public void setActiveDream(@NonNull android.content.ComponentName);
|
||||
method @RequiresPermission("android.permission.WRITE_DREAM_STATE") public void startDream(@NonNull android.content.ComponentName);
|
||||
method @RequiresPermission("android.permission.WRITE_DREAM_STATE") public void stopDream();
|
||||
|
||||
@@ -58,7 +58,7 @@ public class DreamManager {
|
||||
@RequiresPermission(android.Manifest.permission.WRITE_DREAM_STATE)
|
||||
public void startDream(@NonNull ComponentName name) {
|
||||
try {
|
||||
mService.testDream(mContext.getUserId(), name);
|
||||
mService.dream();
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
}
|
||||
@@ -99,4 +99,22 @@ public class DreamManager {
|
||||
e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the device is Dreaming.
|
||||
*
|
||||
* <p> This is only used for testing the dream service APIs.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
@RequiresPermission(android.Manifest.permission.READ_DREAM_STATE)
|
||||
public boolean isDreaming() {
|
||||
try {
|
||||
return mService.isDreaming();
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user