I'm using PIP mode on Android O phone (various Samsung versions) and it works fine. However, if I turn on accessibility mode I get
java.lang.IllegalStateException·enterPictureInPictureMode: Device doesn't support picture-in-picture mode
when entering PIP mode. Before entering PIP I do check PackageManager.FEATURE_PICTURE_IN_PICTURE and if AppOpsManager.OPSTR_PICTURE_IN_PICTURE is enabled (both return true). The message "Device doesn't support picture-in-picture mode" is obviously misleading and wrong but is there any way to check if PIP is available in this case?
Note that this appears to be Samsung only problem as I tried various Samsung phones and tablets (S8, Note 8, Tab S3, Tab S4) and they all crashed. Google Pixel 3 phone did not have this problem.