Merge "Add isDreaming method to DreamManager" into rvc-dev

This commit is contained in:
Galia Peycheva
2020-05-06 08:18:19 +00:00
committed by Android (Google) Code Review
2 changed files with 20 additions and 1 deletions

View File

@@ -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();

View File

@@ -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;
}
}