DOT Android Face Lite 9.0.0

This guide describes how to migrate DOT Android Face Lite version 8.x to version 9.0. Only the most important changes are highlighted in this guide. For more details, see the Android Samples.

Migration Steps

Compatibility with DIS

When utilizing DIS for server-side evaluation, ensure compatibility between your DIS version and the corresponding SDK version. Refer to the DIS vs SDKs compatibility table for detailed compatibility information.

SDK initialization

The way DOT SDK libraries are configured has changed.

  • Replace DotSdkConfiguration with DotSdk.Configuration class.
  • Update libraries property of DotSdk.Configuration class.

Before

Libraries were provided as a list of DotLibrary instances.

DotSdkConfiguration(
    //...
    libraries = listOf(
        DotFaceLiteLibrary(),
        //...
    ),
)

After

Libraries are now configured via a single Libraries object, with explicit configuration for each DOT SDK library.

DotSdk.Configuration(
    //...
    libraries = Libraries(
        faceLite = DotFaceLiteLibraryConfiguration,
        //...
    ),
)

UI Face Auto Capture component

The FaceAutoCaptureFragment class was moved to a new package, and both its API and configuration structure have changed. Existing configuration objects are not compatible with the new API and must be migrated to the new configuration model. Basic migration steps:

  • Replace import com.innovatrics.dot.face.lite.autocapture.FaceAutoCaptureFragment with import com.innovatrics.dot.face.lite.autocapture.ui.FaceAutoCaptureFragment.
  • Replace the method stopAsync(...) with the new method stop().
  • Remove the override of the onProcessed() method and override onUiStateUpdated(uiState: UiState) instead. UiState is a sealed interface, and its implementation UiState.Running replaces the data previously delivered via onProcessed() method.
  • Update configuration provided by provideConfiguration() method.
  • Replace onCaptured() method with onFinished() method.

Before

//...
import com.innovatrics.dot.face.lite.autocapture.FaceAutoCaptureFragment
//...

class BasicFaceAutoCaptureFragment: FaceAutoCaptureFragment {

    override fun provideConfiguration(): Configuration {
        return Configuration(
            cameraFacing = CameraFacing.FRONT,
            cameraPreviewScaleType = CameraPreviewScaleType.FILL,
            isTorchEnabled = false,
            isVideoCaptureEnabled = false,
            captureMode = CaptureMode.AUTO_CAPTURE,
            qualityAttributeThresholds = QualityAttributeThresholdPresets.standard,
            minValidFramesInRowToStartCandidateSelection = 2,
            candidateSelectionDurationMillis = 2000,
            isPlaceholderVisible = true,
            isDetectionLayerVisible = false,
            sessionToken = "...",
            isCameraPreviewVisible = true,
        )
    }

    override fun onProcessed(detection: FaceAutoCaptureDetection) {
        //...
    }

    override fun onCaptured(result: FaceAutoCaptureResult) {
        //...
    }
}

After

//...
import com.innovatrics.dot.face.lite.autocapture.ui.FaceAutoCaptureFragment
//...

class BasicFaceAutoCaptureFragment: FaceAutoCaptureFragment {
  
    override fun provideConfiguration(): Configuration {
        return Configuration(
            base = BaseFaceAutoCaptureFragment.Configuration(
                common = CommonConfiguration(
                    sessionToken = "..."
                ),
                camera = CameraConfiguration(
                    facing = CameraFacing.FRONT,
                    previewScaleType = CameraPreviewScaleType.FIT,
                    isTorchEnabled = false,
                    isVideoCaptureEnabled = false,
                    isPreviewVisible = false,
                ),
                autoCapture = AutoCaptureConfiguration(
                    minValidSamplesInRowToStartCandidateSelection = 2,
                    candidateSelectionDurationMillis = 2000,
                ),
                qualityAttributeThresholds = QualityAttributeThresholds.Presets.standard,
                captureMode = CaptureMode.AUTO_CAPTURE,
            ),
            placeholder = Placeholder.Visible(
                type = Placeholder.Visible.Type.CIRCLE,
            ),
            isDetectionLayerVisible = false,
        )
    }

    override fun onUiStateUpdated(uiState: UiState) {
        if (uiState is UiState.Running) {
            //...
        }
    }

    override fun onFinished(result: FaceAutoCaptureResult) {
        //...
    }
}

UI Multi-Range Liveness component

The configuration structure of the MultiRangeLivenessFragment has changed. Existing configuration objects are not compatible with the new API and must be migrated to the new configuration model. Basic migration steps:

  • Replace the method stopAsync(...) with the new method stop().
  • Update configuration provided by provideConfiguration() method.

Before

class BasicMultiRangeLivenessFragment: MultiRangeLivenessFragment {

    override fun provideConfiguration(): Configuration {
        return Configuration(
            challengeSequence = listOf(), // obtain challenge from DIS (Digital Identity Service)
            cameraFacing = CameraFacing.FRONT,
            cameraPreviewScaleType = CameraPreviewScaleType.FIT,
            isTorchEnabled = false,
            isVideoCaptureEnabled = false,
            isDetectionLayerVisible = true,
            sessionToken = "...",
            isCameraPreviewVisible = true,
        )
    }
}

After

class BasicMultiRangeLivenessFragment: MultiRangeLivenessFragment {
  
    override fun provideConfiguration(): Configuration {
        return Configuration(
            challengeSequence = listOf(), // obtain challenge from DIS (Digital Identity Service)
            common = CommonConfiguration(
                sessionToken = "...",
            ),
            camera = CameraConfiguration(
                facing = CameraFacing.FRONT,
                previewScaleType = CameraPreviewScaleType.FIT,
                isTorchEnabled = false,
                isVideoCaptureEnabled = false,
                isPreviewVisible = true,
            ),
            isDetectionLayerVisible = false,
        )
    }
}

UI MagnifEye Liveness component

WARNING: This component is deprecated in favour of UI Multi-Range Liveness.

The MagnifEyeLivenessFragment class was moved to a new package, and both its API and configuration structure have changed. Existing configuration objects are not compatible with the new API and must be migrated to the new configuration model. Basic migration steps:

  • Replace import com.innovatrics.dot.face.lite.liveness.magnifeye.MagnifEyeLivenessFragment with import com.innovatrics.dot.face.lite.liveness.magnifeye.ui.MagnifEyeLivenessFragment.
  • Replace the method stopAsync(...) with the new method stop().
  • Update configuration provided by provideConfiguration() method.

Before

//...
import com.innovatrics.dot.face.lite.liveness.magnifeye.MagnifEyeLivenessFragment
//...

class BasicMagnifEyeLivenessFragment: MagnifEyeLivenessFragment {

    override fun provideConfiguration(): Configuration {
        return Configuration(
            cameraFacing = CameraFacing.FRONT,
            cameraPreviewScaleType = CameraPreviewScaleType.FIT,
            isTorchEnabled = false,
            isVideoCaptureEnabled = false,
            isDetectionLayerVisible = false,
            sessionToken = "...",
            isCameraPreviewVisible = false,
        )
    }
}

After

//...
import com.innovatrics.dot.face.lite.liveness.magnifeye.ui.MagnifEyeLivenessFragment
//...

class BasicMagnifEyeLivenessFragment: MagnifEyeLivenessFragment {
  
    override fun provideConfiguration(): Configuration {
        return Configuration(
            common = CommonConfiguration(
                sessionToken = "...",
            ),
            camera = CameraConfiguration(
                facing = CameraFacing.FRONT,
                previewScaleType = CameraPreviewScaleType.FIT,
                isTorchEnabled = false,
                isVideoCaptureEnabled = false,
                isPreviewVisible = true,
            ),
            isDetectionLayerVisible = false,
        )
    }
}

Image

Several changes were applied to image-related functionality.

  • BgraRawImage has been replaced by the generic Image class.
  • BgraRawImageFactory has been replaced by ImageFactory.

Before

val image: BgraRawImage = BgraRawImageFactory.create(imageProxy)

After

val image: Image = ImageFactory.createBgraRawImage(imageProxy)