While I try to get new Android 8 (or P) Application Standby Bucket using UsageStatsManager.getAppStandbyBucket, I receive this error, gave every permission possible to app, but still crashes :
java.lang.SecurityException: MATCH_ANY_USER flag requires INTERACT_ACROSS_USERS permission at com.android.server.pm.PackageManagerService.getPackageUid:4959 com.android.server.pm.PackageManagerService$PackageManagerInternalImpl.getPackageUid:25142 com.android.server.usage.UsageStatsService$BinderService.getAppStandbyBucket:932 android.app.usage.IUsageStatsManager$Stub.onTransact:274 android.os.Binder.execTransact:731 : Neither user 10228 nor current process has android.permission.INTERACT_ACROSS_USERS.
I posted the same question some days ago, like chrispher said, it's a bug, two issues has been filled in :
I know that on the first developer preview, the function was working, so maybe you can download the factory image, put it on an emulator or a device and make your test, a bit of a trick but at least we can test this way...
Edit: Good news ! https://issuetracker.google.com/issues/111102580
We are good to test, the release is here !