class MraidNativeCommandHandler {

    @TargetApi(11)
    boolean isInlineVideoAvailable(@NonNull Activity activity, @NonNull View view) {
        // In addition to potential hardware acceleration problems, there is a problem in the WebKit
        // HTML5VideoView implementation pre-Gingerbread that would result in HTML5VideoViewProxy
        // holding on to an instance of the WebView even after the WebView is destroyed. For
        // this reason, we never allow inline video on Gingerbread devices.
        if (VersionCode.currentApiLevel().isBelow(VersionCode.HONEYCOMB_MR1)) {
            return false;
        }

        // Hardware Acceleration
        // Hardware acceleration for the application and activity is enabled by default
        // in API >= 14 (Ice Cream Sandwich)
        // http://developer.android.com/reference/android/R.attr.html#hardwareAccelerated
        // http://developer.android.com/guide/topics/graphics/hardware-accel.html

        // HTML5 Inline Video
        // http://developer.android.com/about/versions/android-3.1.html

        // Traverse up the View tree to determine if any views are being software rendered
        // You can only disable hardware acceleration at the view level by setting the layer type
        View tempView = view;
        while (true) {
            // View#isHardwareAccelerated does not reflect the layer type used to render the view
            // therefore we have to check for both
            if (!tempView.isHardwareAccelerated()
                    || Utils.bitMaskContainsFlag(tempView.getLayerType(), View.LAYER_TYPE_SOFTWARE)) {
                return false;
            }

            // If parent is not a view or parent is null then break
            if (!(tempView.getParent() instanceof View)) {
                break;
            }

            tempView = (View)tempView.getParent();
        }

        // Has hardware acceleration been enabled in the current window?
        // Hardware acceleration can only be enabled for a window, not disabled
        // This flag is automatically set by the system if the android:hardwareAccelerated
        // XML attribute is set to true on an activity or on the application.
        // http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_HARDWARE_ACCELERATED
        Window window = activity.getWindow();
        if (window != null) {
            if (Utils.bitMaskContainsFlag(window.getAttributes().flags,
                    WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED)) {
                return true;
            }
        }

        return false;
    }

}