BackportedFixManager


public final 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 methods

final @NonNull Status

The status of a known issue on this device.

final boolean

Is the known issue fixed on this device.

Public constructors

BackportedFixManager

Added in 1.0.0-alpha01
public BackportedFixManager()

Creates a BackportedFixManager object using the default StatusResolver.

BackportedFixManager

Added in 1.0.0-alpha01
public BackportedFixManager(@NonNull StatusResolver resolver)
Parameters
@NonNull StatusResolver resolver

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 methods

getStatus

Added in 1.0.0-alpha01
public final @NonNull Status getStatus(@NonNull KnownIssue ki)

The status of a known issue on this device.

Parameters
@NonNull KnownIssue ki

The known issue to check.

isFixed

Added in 1.0.0-alpha01
public final boolean isFixed(@NonNull KnownIssue ki)

Is the known issue fixed on this device.

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

Parameters
@NonNull KnownIssue ki

The known issue to check.