private boolean retrieveBitmap(Uri uri) {
        try (ParcelFileDescriptor parcelFileDescriptor =
                     getContentResolver().openFileDescriptor(uri, "r")) {
            if (parcelFileDescriptor == null) return false;
            FileDescriptor fileDescriptor = parcelFileDescriptor.getFileDescriptor();
            if (fileDescriptor == null) return false;
            Bitmap bitmap = BitmapFactory.decodeFileDescriptor(fileDescriptor);
            return bitmap != null;
        } catch (IOException e) {
            return false;
        }
    }
Returns the instance of the Service. Returns null if it hasn't been bound yet.
customtabs/tests/src/android/support/customtabs/TestCustomTabsService.java