BackportedFixManager


class BackportedFixManager


Reports if a Known Issue is fixed on a device.

Use this class to guard code against a known issue when the issue is not fixed.

import androidx.core.backported.fixes.BackportedFixManager
import androidx.core.backported.fixes.KnownIssues

val bf = BackportedFixManager()
if (bf.isFixed(KnownIssues.KI_350037348)) {
    println("Hello world")
} else {
    // Since the known issue is not fixed
    println("Goodbye")
}

KnownIssues has the complete list of known issues, including sample code to guard against the issue.

Summary

Public constructors

Creates a BackportedFixManager object using the default StatusResolver.

Public functions

Status

The status of a known issue on this device.

Boolean

Is the known issue fixed on this device.

Public constructors

BackportedFixManager

Added in 1.0.0
BackportedFixManager()

Creates a BackportedFixManager object using the default StatusResolver.

BackportedFixManager

Added in 1.0.0
BackportedFixManager(resolver: StatusResolver)
Parameters
resolver: StatusResolver

a function that takes a KnownIssue and returns its Status on this device. This parameter is only used for testing. In normal flows, the empty constructor should be used.

Public functions

getStatus

Added in 1.0.0
fun getStatus(ki: KnownIssue): Status

The status of a known issue on this device.

Parameters
ki: KnownIssue

The known issue to check.

isFixed

Added in 1.0.0
fun isFixed(ki: KnownIssue): Boolean

Is the known issue fixed on this device.

An issue is fixed if its status is Status.Fixed or Status.NotApplicable.

Parameters
ki: KnownIssue

The known issue to check.