Package com.google.android.exoplayer2.ext.cronet

## Class CronetEngineWrapper

- java.lang.Object
- - com.google.android.exoplayer2.ext.cronet.CronetEngineWrapper

-     public final class CronetEngineWrapper
      extends Object

  A wrapper class for a `CronetEngine`.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static interface` | `CronetEngineWrapper.CronetEngineSource` | Source of `CronetEngine`.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `SOURCE_GMS` | Cronet implementation from GMSCore.
    `static int` | `SOURCE_NATIVE` | Natively bundled Cronet implementation.
    `static int` | `SOURCE_UNAVAILABLE` | No Cronet implementation available.
    `static int` | `SOURCE_UNKNOWN` | Other (unknown) Cronet implementation.
    `static int` | `SOURCE_USER_PROVIDED` | User-provided Cronet engine.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CronetEngineWrapper​(Context context)` | Creates a wrapper for a `CronetEngine` built using the most suitable `CronetProvider`.
    `CronetEngineWrapper​(Context context, String userAgent, boolean preferGMSCoreCronet)` | Creates a wrapper for a `CronetEngine` built using the most suitable `CronetProvider`.
    `CronetEngineWrapper​(org.chromium.net.CronetEngine cronetEngine)` | Creates a wrapper for an existing `CronetEngine`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `getCronetEngineSource()` | Returns the source of the wrapped `CronetEngine`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### SOURCE_NATIVE

          public static final int SOURCE_NATIVE

      Natively bundled Cronet implementation.
      See Also:
        Constant Field Values

    - #### SOURCE_GMS

          public static final int SOURCE_GMS

      Cronet implementation from GMSCore.
      See Also:
        Constant Field Values

    - #### SOURCE_UNKNOWN

          public static final int SOURCE_UNKNOWN

      Other (unknown) Cronet implementation.
      See Also:
        Constant Field Values

    - #### SOURCE_USER_PROVIDED

          public static final int SOURCE_USER_PROVIDED

      User-provided Cronet engine.
      See Also:
        Constant Field Values

    - #### SOURCE_UNAVAILABLE

          public static final int SOURCE_UNAVAILABLE

      No Cronet implementation available. Fallback Http provider is used if possible.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CronetEngineWrapper

          public CronetEngineWrapper​(Context context)

      Creates a wrapper for a `CronetEngine` built using the most suitable `CronetProvider`. When natively bundled Cronet and GMSCore Cronet are both available, the natively bundled provider is preferred.
      Parameters:
        `context` - A context.

    - #### CronetEngineWrapper

          public CronetEngineWrapper​(Context context,
                                     @Nullable
                                     String userAgent,
                                     boolean preferGMSCoreCronet)

      Creates a wrapper for a `CronetEngine` built using the most suitable `CronetProvider`. When natively bundled Cronet and GMSCore Cronet are both available, `preferGMSCoreCronet` determines which is preferred.
      Parameters:
        `context` - A context.
        `userAgent` - A default user agent, or `null` to use a default user agent of the `CronetEngine`.
        `preferGMSCoreCronet` - Whether Cronet from GMSCore should be preferred over natively bundled Cronet if both are available.

    - #### CronetEngineWrapper

          public CronetEngineWrapper​(org.chromium.net.CronetEngine cronetEngine)

      Creates a wrapper for an existing `CronetEngine`.
      Parameters:
        `cronetEngine` - The CronetEngine to wrap.

  - ### Method Detail

    - #### getCronetEngineSource

          @CronetEngineSource
          public int getCronetEngineSource()

      Returns the source of the wrapped `CronetEngine`.
      Returns:
        A `CronetEngineWrapper.CronetEngineSource` value.