ApiVersion
  public
  
  
  abstract
  class
  ApiVersion
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.car.ApiVersion<T extends android.car.ApiVersion<?>> | 
Abstraction of Android APIs.
This class is used to represent a pair of major / minor API versions: the "major" version represents a "traditional" Android SDK release, while the "minor" is used to indicate incremental releases for that major.
This class is needed because the standard Android SDK API versioning only supports major
 releases, but Car APIs can now (starting on
 Android 13) be updated on minor releases
 as well.
Summary
| Public methods | |
|---|---|
| 
        
        
        
        final
        
        int | 
      getMajorVersion()
      Gets the major version of the API represented by this object. | 
| 
        
        
        
        final
        
        int | 
      getMinorVersion()
      Gets the minor version change of API for the same  | 
| 
        
        
        
        final
        
        boolean | 
      isAtLeast(T requiredVersion)
      Checks if this API version meets the required version. | 
| Inherited methods | |
|---|---|
Public methods
getMajorVersion
public final int getMajorVersion ()
Gets the major version of the API represented by this object.
| Returns | |
|---|---|
| int | |
getMinorVersion
public final int getMinorVersion ()
Gets the minor version change of API for the same getMajorVersion().
 
It will reset to 0 whenever getMajorVersion() is updated
 and will increase by 1 if car builtin or other car platform part is changed with the
 same getMajorVersion().
 
Client should check this version to use APIs which were added in a minor-only version update.
| Returns | |
|---|---|
| int | |
isAtLeast
public final boolean isAtLeast (T requiredVersion)
Checks if this API version meets the required version.
| Parameters | |
|---|---|
| requiredVersion | T: required major and minor version number | 
| Returns | |
|---|---|
| boolean | trueif themajor versionis newer than therequiredVersion's major or if themajor versionis
         the same asrequiredVersion's major with theminor
         versionthe same or newer thanrequiredVersion's minor | 
| Throws | |
|---|---|
| IllegalArgumentException | if requiredVersionis not an instance of the same
         class as this object | 
