diff --git a/src/com/android/settings/biometrics2/ui/model/CredentialModel.java b/src/com/android/settings/biometrics2/ui/model/CredentialModel.java
deleted file mode 100644
index caff80a..0000000
--- a/src/com/android/settings/biometrics2/ui/model/CredentialModel.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.biometrics2.ui.model;
-
-import static com.android.settings.biometrics.BiometricEnrollBase.EXTRA_KEY_CHALLENGE;
-import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN;
-import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.UserHandle;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.annotation.VisibleForTesting;
-
-import java.time.Clock;
-
-/**
- * Secret credential data including
- * 1. userId
- * 2. challenge
- * 3. token
- * 4. gkPwHandle
- */
-public final class CredentialModel {
-
-    /**
-     * Default value for an invalid challenge
-     */
-    @VisibleForTesting
-    public static final long INVALID_CHALLENGE = -1L;
-
-    /**
-     * Default value if GkPwHandle is invalid.
-     */
-    @VisibleForTesting
-    public static final long INVALID_GK_PW_HANDLE = 0L;
-
-    private final Clock mClock;
-
-    private final long mInitMillis;
-
-    private final int mUserId;
-
-    private long mChallenge;
-    @Nullable
-    private Long mUpdateChallengeMillis = null;
-
-    @Nullable
-    private byte[] mToken;
-    @Nullable
-    private Long mUpdateTokenMillis = null;
-
-    private long mGkPwHandle;
-    @Nullable
-    private Long mClearGkPwHandleMillis = null;
-
-    public CredentialModel(@Nullable Bundle bundle, @NonNull Clock clock) {
-        if (bundle == null) {
-            bundle = new Bundle();
-        }
-        mUserId = bundle.getInt(Intent.EXTRA_USER_ID, UserHandle.myUserId());
-        mChallenge = bundle.getLong(EXTRA_KEY_CHALLENGE, INVALID_CHALLENGE);
-        mToken = bundle.getByteArray(EXTRA_KEY_CHALLENGE_TOKEN);
-        mGkPwHandle = bundle.getLong(EXTRA_KEY_GK_PW_HANDLE, INVALID_GK_PW_HANDLE);
-        mClock = clock;
-        mInitMillis = mClock.millis();
-    }
-
-    /**
-     * Get a bundle which can be used to recreate CredentialModel
-     */
-    @NonNull
-    public Bundle getBundle() {
-        final Bundle bundle = new Bundle();
-        bundle.putInt(Intent.EXTRA_USER_ID, mUserId);
-        bundle.putLong(EXTRA_KEY_CHALLENGE, mChallenge);
-        bundle.putByteArray(EXTRA_KEY_CHALLENGE_TOKEN, mToken);
-        bundle.putLong(EXTRA_KEY_GK_PW_HANDLE, mGkPwHandle);
-        return bundle;
-    }
-
-    /**
-     * Get userId for this credential
-     */
-    public int getUserId() {
-        return mUserId;
-    }
-
-    /**
-     * Check user id is valid or not
-     */
-    public boolean isValidUserId() {
-        return mUserId != UserHandle.USER_NULL;
-    }
-
-    /**
-     * Get challenge
-     */
-    public long getChallenge() {
-        return mChallenge;
-    }
-
-    /**
-     * Set challenge
-     */
-    public void setChallenge(long value) {
-        mUpdateChallengeMillis = mClock.millis();
-        mChallenge = value;
-    }
-
-    /**
-     * Check challenge is valid or not
-     */
-    public boolean isValidChallenge() {
-        return mChallenge != INVALID_CHALLENGE;
-    }
-
-    /**
-     * Get challenge token
-     */
-    @Nullable
-    public byte[] getToken() {
-        return mToken;
-    }
-
-    /**
-     * Set challenge token
-     */
-    public void setToken(@Nullable byte[] value) {
-        mUpdateTokenMillis = mClock.millis();
-        mToken = value;
-    }
-
-    /**
-     * Check challengeToken is valid or not
-     */
-    public boolean isValidToken() {
-        return mToken != null;
-    }
-
-    /**
-     * Get gatekeeper password handle
-     */
-    public long getGkPwHandle() {
-        return mGkPwHandle;
-    }
-
-    /**
-     * Clear gatekeeper password handle data
-     */
-    public void clearGkPwHandle() {
-        mClearGkPwHandleMillis = mClock.millis();
-        mGkPwHandle = INVALID_GK_PW_HANDLE;
-    }
-
-    /**
-     * Check gkPwHandle is valid or not
-     */
-    public boolean isValidGkPwHandle() {
-        return mGkPwHandle != INVALID_GK_PW_HANDLE;
-    }
-
-    /**
-     * Returns a string representation of the object
-     */
-    @Override
-    public String toString() {
-        final int gkPwHandleLen = ("" + mGkPwHandle).length();
-        final int tokenLen = mToken == null ? 0 : mToken.length;
-        final int challengeLen = ("" + mChallenge).length();
-        return getClass().getSimpleName() + ":{initMillis:" + mInitMillis
-                + ", userId:" + mUserId
-                + ", challenge:{len:" + challengeLen
-                + ", updateMillis:" + mUpdateChallengeMillis + "}"
-                + ", token:{len:" + tokenLen + ", isValid:" + isValidToken()
-                + ", updateMillis:" + mUpdateTokenMillis + "}"
-                + ", gkPwHandle:{len:" + gkPwHandleLen + ", isValid:" + isValidGkPwHandle()
-                + ", clearMillis:" + mClearGkPwHandleMillis + "}"
-                + " }";
-    }
-}
diff --git a/src/com/android/settings/biometrics2/ui/model/CredentialModel.kt b/src/com/android/settings/biometrics2/ui/model/CredentialModel.kt
new file mode 100644
index 0000000..7999ab8
--- /dev/null
+++ b/src/com/android/settings/biometrics2/ui/model/CredentialModel.kt
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.settings.biometrics2.ui.model
+
+import android.content.Intent.EXTRA_USER_ID
+import android.os.Bundle
+import android.os.UserHandle
+import androidx.annotation.VisibleForTesting
+import com.android.settings.biometrics.BiometricEnrollBase.EXTRA_KEY_CHALLENGE
+import com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN
+import com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE
+import java.time.Clock
+
+/**
+ * Secret credential data including
+ * 1. userId
+ * 2. challenge
+ * 3. token
+ * 4. gkPwHandle
+ */
+class CredentialModel(bundle: Bundle?, private val clock: Clock) {
+
+    private val mInitMillis = clock.millis()
+
+    /** userId for this credential */
+    val userId: Int = (bundle ?: Bundle()).getInt(EXTRA_USER_ID, UserHandle.myUserId())
+
+    private var clearGkPwHandleMillis: Long? = null
+
+    /** Gatekeeper password handle */
+    var gkPwHandle: Long = (bundle ?: Bundle()).getLong(EXTRA_KEY_GK_PW_HANDLE, INVALID_GK_PW_HANDLE)
+        private set
+
+    val isValidGkPwHandle: Boolean
+        get() = gkPwHandle != INVALID_GK_PW_HANDLE
+
+    /** Clear gatekeeper password handle data */
+    fun clearGkPwHandle() {
+        clearGkPwHandleMillis = clock.millis()
+        gkPwHandle = INVALID_GK_PW_HANDLE
+    }
+
+    /** Check user id is valid or not */
+    val isValidUserId: Boolean
+        get() = userId != UserHandle.USER_NULL
+
+    private var updateChallengeMillis: Long? = null
+
+    var challenge: Long = (bundle ?: Bundle()).getLong(EXTRA_KEY_CHALLENGE, INVALID_CHALLENGE)
+        set(value) {
+            updateChallengeMillis = clock.millis()
+            field = value
+        }
+
+    val isValidChallenge: Boolean
+        get() = challenge != INVALID_CHALLENGE
+
+    private var updateTokenMillis: Long? = null
+
+    /** Challenge token */
+    var token: ByteArray? = (bundle ?: Bundle()).getByteArray(EXTRA_KEY_CHALLENGE_TOKEN)
+        set(value) {
+            updateTokenMillis = clock.millis()
+            field = value
+        }
+
+    val isValidToken: Boolean
+        get() = token != null
+
+    val bundle: Bundle
+        /**
+         * Get a bundle which can be used to recreate CredentialModel
+         */
+        get() {
+            val bundle = Bundle()
+            bundle.putInt(EXTRA_USER_ID, userId)
+            bundle.putLong(EXTRA_KEY_CHALLENGE, challenge)
+            bundle.putByteArray(EXTRA_KEY_CHALLENGE_TOKEN, token)
+            bundle.putLong(EXTRA_KEY_GK_PW_HANDLE, gkPwHandle)
+            return bundle
+        }
+
+
+    /** Returns a string representation of the object */
+    override fun toString(): String {
+        val gkPwHandleLen = "$gkPwHandle".length
+        val tokenLen = token?.size ?: 0
+        val challengeLen = "$challenge".length
+        return (javaClass.simpleName + ":{initMillis:$mInitMillis"
+                + ", userId:$userId"
+                + ", challenge:{len:$challengeLen"
+                + ", updateMillis:$updateChallengeMillis}"
+                + ", token:{len:$tokenLen, isValid:$isValidToken"
+                + ", updateMillis:$updateTokenMillis}"
+                + ", gkPwHandle:{len:$gkPwHandleLen, isValid:$isValidGkPwHandle"
+                + ", clearMillis:$clearGkPwHandleMillis}"
+                + " }")
+    }
+
+    companion object {
+        /** Default value for an invalid challenge */
+        @VisibleForTesting
+        const val INVALID_CHALLENGE = -1L
+
+        /** Default value if GkPwHandle is invalid */
+        @VisibleForTesting
+        const val INVALID_GK_PW_HANDLE = 0L
+    }
+}
diff --git a/src/com/android/settings/biometrics2/ui/model/EnrollmentProgress.java b/src/com/android/settings/biometrics2/ui/model/EnrollmentProgress.java
deleted file mode 100644
index c62d670..0000000
--- a/src/com/android/settings/biometrics2/ui/model/EnrollmentProgress.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.biometrics2.ui.model;
-
-/**
- * Biometric Enrollment progress
- */
-public final class EnrollmentProgress {
-
-    public static final int INITIAL_STEPS = -1;
-    public static final int INITIAL_REMAINING = 0;
-
-    private final int mSteps;
-    private final int mRemaining;
-
-    public EnrollmentProgress(int steps, int remaining) {
-        mSteps = steps;
-        mRemaining = remaining;
-    }
-
-    public int getSteps() {
-        return mSteps;
-    }
-
-    public int getRemaining() {
-        return mRemaining;
-    }
-
-    public boolean isInitialStep() {
-        return mSteps == INITIAL_STEPS;
-    }
-
-    @Override
-    public String toString() {
-        return getClass().getSimpleName() + "@" + Integer.toHexString(hashCode())
-                + "{steps:" + mSteps + ", remaining:" + mRemaining + "}";
-    }
-}
diff --git a/src/com/android/settings/biometrics2/ui/model/EnrollmentProgress.kt b/src/com/android/settings/biometrics2/ui/model/EnrollmentProgress.kt
new file mode 100644
index 0000000..7b35a68
--- /dev/null
+++ b/src/com/android/settings/biometrics2/ui/model/EnrollmentProgress.kt
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.settings.biometrics2.ui.model
+
+/** Biometric Enrollment progress */
+class EnrollmentProgress(val steps: Int, val remaining: Int) {
+
+    val isInitialStep: Boolean
+        get() = steps == INITIAL_STEPS
+
+    override fun toString(): String {
+        return ("${javaClass.simpleName}@${Integer.toHexString(hashCode())}"
+                + "{steps:$steps, remaining:$remaining}")
+    }
+
+    companion object {
+        const val INITIAL_STEPS = -1
+        const val INITIAL_REMAINING = 0
+    }
+}
diff --git a/src/com/android/settings/biometrics2/ui/model/EnrollmentRequest.java b/src/com/android/settings/biometrics2/ui/model/EnrollmentRequest.java
deleted file mode 100644
index 0c3f08d..0000000
--- a/src/com/android/settings/biometrics2/ui/model/EnrollmentRequest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.biometrics2.ui.model;
-
-import static com.google.android.setupcompat.util.WizardManagerHelper.EXTRA_IS_SUW_SUGGESTED_ACTION_FLOW;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-
-import com.android.settings.SetupWizardUtils;
-import com.android.settings.biometrics.BiometricEnrollActivity;
-
-import com.google.android.setupcompat.util.WizardManagerHelper;
-
-/**
- * Biometric enrollment generic intent data, which includes
- * 1. isSuw
- * 2. isAfterSuwOrSuwSuggestedAction
- * 3. theme
- * 4. isFromSettingsSummery
- * 5. isSkipIntro
- * 6. isSkipFindSensor
- * 7. a helper method, getSetupWizardExtras
- */
-public final class EnrollmentRequest {
-
-    public static final String EXTRA_SKIP_FIND_SENSOR = "skip_find_sensor";
-
-    private final boolean mIsSuw;
-    private final boolean mIsAfterSuwOrSuwSuggestedAction;
-    private final boolean mIsSkipIntro;
-    private final boolean mIsSkipFindSensor;
-    private final int mTheme;
-    private final Bundle mSuwExtras;
-
-    public EnrollmentRequest(@NonNull Intent intent, @NonNull Context context,
-                             boolean isSetupActivity) {
-        // Only allow mIsSuw to be enabled through SetupActivity for security reason
-        mIsSuw = isSetupActivity && WizardManagerHelper.isAnySetupWizard(intent);
-        mIsAfterSuwOrSuwSuggestedAction = isSetupActivity
-                && (WizardManagerHelper.isDeferredSetupWizard(intent)
-                || WizardManagerHelper.isPortalSetupWizard(intent)
-                || intent.getBooleanExtra(EXTRA_IS_SUW_SUGGESTED_ACTION_FLOW, false));
-        mSuwExtras = getSuwExtras(mIsSuw, intent);
-        mIsSkipIntro = intent.getBooleanExtra(BiometricEnrollActivity.EXTRA_SKIP_INTRO, false);
-        mIsSkipFindSensor = intent.getBooleanExtra(EXTRA_SKIP_FIND_SENSOR, false);
-        mTheme = SetupWizardUtils.getTheme(context, intent);
-    }
-
-    public boolean isSuw() {
-        return mIsSuw;
-    }
-
-    public boolean isAfterSuwOrSuwSuggestedAction() {
-        return mIsAfterSuwOrSuwSuggestedAction;
-    }
-
-    public boolean isSkipIntro() {
-        return mIsSkipIntro;
-    }
-
-    public boolean isSkipFindSensor() {
-        return mIsSkipFindSensor;
-    }
-
-    public int getTheme() {
-        return mTheme;
-    }
-
-    @NonNull
-    public Bundle getSuwExtras() {
-        return new Bundle(mSuwExtras);
-    }
-
-    /**
-     * Returns a string representation of the object
-     */
-    @Override
-    public String toString() {
-        return getClass().getSimpleName() + ":{isSuw:" + mIsSuw
-                + ", isAfterSuwOrSuwSuggestedAction:" + mIsAfterSuwOrSuwSuggestedAction
-                + "}";
-    }
-
-    @NonNull
-    private static Bundle getSuwExtras(boolean isSuw, @NonNull Intent intent) {
-        final Intent toIntent = new Intent();
-        if (isSuw) {
-            SetupWizardUtils.copySetupExtras(intent, toIntent);
-        }
-        return toIntent.getExtras() != null ? toIntent.getExtras() : new Bundle();
-    }
-}
diff --git a/src/com/android/settings/biometrics2/ui/model/EnrollmentRequest.kt b/src/com/android/settings/biometrics2/ui/model/EnrollmentRequest.kt
new file mode 100644
index 0000000..4696c62
--- /dev/null
+++ b/src/com/android/settings/biometrics2/ui/model/EnrollmentRequest.kt
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.settings.biometrics2.ui.model
+
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import com.android.settings.SetupWizardUtils
+import com.android.settings.biometrics.BiometricEnrollActivity.EXTRA_SKIP_INTRO
+import com.google.android.setupcompat.util.WizardManagerHelper
+import com.google.android.setupcompat.util.WizardManagerHelper.EXTRA_IS_SUW_SUGGESTED_ACTION_FLOW
+
+/**
+ * Biometric enrollment generic intent data, which includes
+ * 1. isSuw
+ * 2. isAfterSuwOrSuwSuggestedAction
+ * 3. theme
+ * 4. isFromSettingsSummery
+ * 5. isSkipIntro
+ * 6. isSkipFindSensor
+ * 7. a helper method, getSetupWizardExtras
+ */
+class EnrollmentRequest(
+    intent: Intent,
+    context: Context,
+    isSetupActivity: Boolean
+) {
+    val isSuw: Boolean = isSetupActivity && WizardManagerHelper.isAnySetupWizard(intent)
+
+    val isAfterSuwOrSuwSuggestedAction = (isSetupActivity
+            && (WizardManagerHelper.isDeferredSetupWizard(intent)
+            || WizardManagerHelper.isPortalSetupWizard(intent)
+            || intent.getBooleanExtra(EXTRA_IS_SUW_SUGGESTED_ACTION_FLOW, false)))
+
+    private val _suwExtras = getSuwExtras(isSuw, intent)
+
+    val isSkipIntro = intent.getBooleanExtra(EXTRA_SKIP_INTRO, false)
+
+    val isSkipFindSensor = intent.getBooleanExtra(EXTRA_SKIP_FIND_SENSOR, false)
+
+    val theme = SetupWizardUtils.getTheme(context, intent)
+
+    val suwExtras: Bundle
+        get() = Bundle(_suwExtras)
+
+    /**
+     * Returns a string representation of the object
+     */
+    override fun toString(): String {
+        return (javaClass.simpleName + ":{isSuw:" + isSuw
+                + ", isAfterSuwOrSuwSuggestedAction:" + isAfterSuwOrSuwSuggestedAction
+                + "}")
+    }
+
+    companion object {
+        const val EXTRA_SKIP_FIND_SENSOR = "skip_find_sensor"
+        private fun getSuwExtras(isSuw: Boolean, intent: Intent): Bundle {
+            val toIntent = Intent()
+            if (isSuw) {
+                SetupWizardUtils.copySetupExtras(intent, toIntent)
+            }
+            return toIntent.extras ?: Bundle()
+        }
+    }
+}
diff --git a/src/com/android/settings/biometrics2/ui/model/EnrollmentStatusMessage.java b/src/com/android/settings/biometrics2/ui/model/EnrollmentStatusMessage.java
deleted file mode 100644
index 184e1d1..0000000
--- a/src/com/android/settings/biometrics2/ui/model/EnrollmentStatusMessage.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.biometrics2.ui.model;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-
-/**
- * Enrolling status message (help or error)
- */
-public final class EnrollmentStatusMessage {
-
-    private final int mMsgId;
-    @NonNull private final CharSequence mStr;
-
-    public EnrollmentStatusMessage(int msgId, @Nullable CharSequence str) {
-        mMsgId = msgId;
-        mStr = str != null ? str : "";
-    }
-
-    public int getMsgId() {
-        return mMsgId;
-    }
-
-    @Override
-    public String toString() {
-        return getClass().getSimpleName() + "@" + Integer.toHexString(hashCode())
-                + "{id:" + mMsgId + ", str:" + mStr + "}";
-    }
-
-    /**
-     * Gets status string
-     */
-    @NonNull
-    public CharSequence getStr() {
-        return mStr;
-    }
-}
diff --git a/src/com/android/settings/biometrics2/ui/model/EnrollmentStatusMessage.kt b/src/com/android/settings/biometrics2/ui/model/EnrollmentStatusMessage.kt
new file mode 100644
index 0000000..6dd0c5c
--- /dev/null
+++ b/src/com/android/settings/biometrics2/ui/model/EnrollmentStatusMessage.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.settings.biometrics2.ui.model
+
+/** Enrolling status message (help or error) */
+class EnrollmentStatusMessage(val msgId: Int, string: CharSequence?) {
+
+    /** Status string */
+    val str: CharSequence = string ?: ""
+
+    override fun toString(): String {
+        return "${javaClass.simpleName}@${Integer.toHexString(hashCode())}{id:$msgId, str:$str}"
+    }
+}
diff --git a/src/com/android/settings/biometrics2/ui/model/FingerprintEnrollIntroStatus.java b/src/com/android/settings/biometrics2/ui/model/FingerprintEnrollIntroStatus.java
deleted file mode 100644
index cbfacee..0000000
--- a/src/com/android/settings/biometrics2/ui/model/FingerprintEnrollIntroStatus.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.biometrics2.ui.model;
-
-import android.annotation.IntDef;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Fingerprint onboarding introduction page data, it contains following information which needs
- * to be passed from view model to view.
- * 1. mEnrollableStatus: User is allowed to enroll a new fingerprint or not.
- * 2. mHasScrollToBottom: User has scrolled to the bottom of this page or not.
- */
-public final class FingerprintEnrollIntroStatus {
-
-    /**
-     * Unconfirmed case, it means that this value is invalid, and view shall bypass this value.
-     */
-    public static final int FINGERPRINT_ENROLLABLE_UNKNOWN = -1;
-
-    /**
-     * User is allowed to enrolled a new fingerprint.
-     */
-    public static final int FINGERPRINT_ENROLLABLE_OK = 0;
-
-    /**
-     * User is not allowed to enrolled a new fingerprint because the number of enrolled fingerprint
-     * has reached maximum.
-     */
-    public static final int FINGERPRINT_ENROLLABLE_ERROR_REACH_MAX = 1;
-
-    @IntDef(prefix = {"FINGERPRINT_ENROLLABLE_"}, value = {
-            FINGERPRINT_ENROLLABLE_UNKNOWN,
-            FINGERPRINT_ENROLLABLE_OK,
-            FINGERPRINT_ENROLLABLE_ERROR_REACH_MAX
-    })
-    @Retention(RetentionPolicy.SOURCE)
-    public @interface FingerprintEnrollableStatus {
-    }
-
-    private final boolean mHasScrollToBottom;
-
-    @FingerprintEnrollableStatus
-    private final int mEnrollableStatus;
-
-    public FingerprintEnrollIntroStatus(boolean hasScrollToBottom, int enrollableStatus) {
-        mEnrollableStatus = enrollableStatus;
-        mHasScrollToBottom = hasScrollToBottom;
-    }
-
-    /**
-     * Get enrollable status. It means that user is allowed to enroll a new fingerprint or not.
-     */
-    @FingerprintEnrollableStatus
-    public int getEnrollableStatus() {
-        return mEnrollableStatus;
-    }
-
-    /**
-     * Get info for this onboarding introduction page has scrolled to bottom or not
-     */
-    public boolean hasScrollToBottom() {
-        return mHasScrollToBottom;
-    }
-
-    @Override
-    public String toString() {
-        return getClass().getSimpleName() + "@" + Integer.toHexString(hashCode())
-                + "{scrollToBottom:" + mHasScrollToBottom
-                + ", enrollableStatus:" + mEnrollableStatus + "}";
-    }
-}
diff --git a/src/com/android/settings/biometrics2/ui/model/FingerprintEnrollIntroStatus.kt b/src/com/android/settings/biometrics2/ui/model/FingerprintEnrollIntroStatus.kt
new file mode 100644
index 0000000..4cbaffa
--- /dev/null
+++ b/src/com/android/settings/biometrics2/ui/model/FingerprintEnrollIntroStatus.kt
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.settings.biometrics2.ui.model
+
+
+enum class FingerprintEnrollable {
+    // Unconfirmed case, this value is invalid, and view shall bypass this value
+    FINGERPRINT_ENROLLABLE_UNKNOWN,
+    // User is allowed to enrolled a new fingerprint
+    FINGERPRINT_ENROLLABLE_OK,
+    // User is not allowed to enroll because the number has reached maximum
+    FINGERPRINT_ENROLLABLE_ERROR_REACH_MAX
+}
+
+/**
+ * Fingerprint onboarding introduction page data, it contains following information which needs
+ * to be passed from view model to view.
+ * 1. mEnrollableStatus: User is allowed to enroll a new fingerprint or not.
+ * 2. mHasScrollToBottom: User has scrolled to the bottom of this page or not.
+ */
+class FingerprintEnrollIntroStatus(
+    private val mHasScrollToBottom: Boolean,
+    /** Enrollable status. It means that user is allowed to enroll a new fingerprint or not. */
+    val enrollableStatus: FingerprintEnrollable
+) {
+    /** Get info for this onboarding introduction page has scrolled to bottom or not */
+    fun hasScrollToBottom(): Boolean {
+        return mHasScrollToBottom
+    }
+
+    override fun toString(): String {
+        return ("${javaClass.simpleName}@${Integer.toHexString(hashCode())}"
+                + "{scrollToBottom:$mHasScrollToBottom"
+                + ", enrollableStatus:$enrollableStatus}")
+    }
+}
diff --git a/src/com/android/settings/biometrics2/ui/view/FingerprintEnrollIntroFragment.java b/src/com/android/settings/biometrics2/ui/view/FingerprintEnrollIntroFragment.java
index b151e1a..9cafdae 100644
--- a/src/com/android/settings/biometrics2/ui/view/FingerprintEnrollIntroFragment.java
+++ b/src/com/android/settings/biometrics2/ui/view/FingerprintEnrollIntroFragment.java
@@ -18,9 +18,7 @@
 
 import static android.app.admin.DevicePolicyResources.Strings.Settings.FINGERPRINT_UNLOCK_DISABLED;
 
-import static com.android.settings.biometrics2.ui.model.FingerprintEnrollIntroStatus.FINGERPRINT_ENROLLABLE_ERROR_REACH_MAX;
-import static com.android.settings.biometrics2.ui.model.FingerprintEnrollIntroStatus.FINGERPRINT_ENROLLABLE_OK;
-import static com.android.settings.biometrics2.ui.model.FingerprintEnrollIntroStatus.FINGERPRINT_ENROLLABLE_UNKNOWN;
+import static com.android.settings.biometrics2.ui.model.FingerprintEnrollable.FINGERPRINT_ENROLLABLE_ERROR_REACH_MAX;
 
 import static com.google.android.setupdesign.util.DynamicColorPalette.ColorType.ACCENT;
 
diff --git a/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollIntroViewModel.java b/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollIntroViewModel.java
index 5e8a807..5e9085a 100644
--- a/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollIntroViewModel.java
+++ b/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollIntroViewModel.java
@@ -16,9 +16,9 @@
 
 package com.android.settings.biometrics2.ui.viewmodel;
 
-import static com.android.settings.biometrics2.ui.model.FingerprintEnrollIntroStatus.FINGERPRINT_ENROLLABLE_ERROR_REACH_MAX;
-import static com.android.settings.biometrics2.ui.model.FingerprintEnrollIntroStatus.FINGERPRINT_ENROLLABLE_OK;
-import static com.android.settings.biometrics2.ui.model.FingerprintEnrollIntroStatus.FINGERPRINT_ENROLLABLE_UNKNOWN;
+import static com.android.settings.biometrics2.ui.model.FingerprintEnrollable.FINGERPRINT_ENROLLABLE_ERROR_REACH_MAX;
+import static com.android.settings.biometrics2.ui.model.FingerprintEnrollable.FINGERPRINT_ENROLLABLE_OK;
+import static com.android.settings.biometrics2.ui.model.FingerprintEnrollable.FINGERPRINT_ENROLLABLE_UNKNOWN;
 
 import android.annotation.IntDef;
 import android.app.Application;
@@ -33,6 +33,7 @@
 import com.android.settings.biometrics2.data.repository.FingerprintRepository;
 import com.android.settings.biometrics2.ui.model.EnrollmentRequest;
 import com.android.settings.biometrics2.ui.model.FingerprintEnrollIntroStatus;
+import com.android.settings.biometrics2.ui.model.FingerprintEnrollable;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -44,7 +45,8 @@
 
     private static final String TAG = "FingerprintEnrollIntroViewModel";
     private static final boolean HAS_SCROLLED_TO_BOTTOM_DEFAULT = false;
-    private static final int ENROLLABLE_STATUS_DEFAULT = FINGERPRINT_ENROLLABLE_UNKNOWN;
+    private static final FingerprintEnrollable ENROLLABLE_STATUS_DEFAULT =
+            FINGERPRINT_ENROLLABLE_UNKNOWN;
 
     /**
      * User clicks 'Done' button on this page
@@ -73,7 +75,7 @@
 
     private final MutableLiveData<Boolean> mHasScrolledToBottomLiveData =
             new MutableLiveData<>(HAS_SCROLLED_TO_BOTTOM_DEFAULT);
-    private final MutableLiveData<Integer> mEnrollableStatusLiveData =
+    private final MutableLiveData<FingerprintEnrollable> mEnrollableStatusLiveData =
             new MutableLiveData<>(ENROLLABLE_STATUS_DEFAULT);
     private final MediatorLiveData<FingerprintEnrollIntroStatus> mPageStatusLiveData =
             new MediatorLiveData<>();
@@ -101,7 +103,8 @@
         mPageStatusLiveData.addSource(
                 mHasScrolledToBottomLiveData,
                 hasScrolledToBottom -> {
-                    final Integer enrollableValue = mEnrollableStatusLiveData.getValue();
+                    final FingerprintEnrollable enrollableValue =
+                            mEnrollableStatusLiveData.getValue();
                     final FingerprintEnrollIntroStatus status = new FingerprintEnrollIntroStatus(
                             hasScrolledToBottom,
                             enrollableValue != null ? enrollableValue : ENROLLABLE_STATUS_DEFAULT);
@@ -181,7 +184,7 @@
      * User clicks next button
      */
     public void onNextButtonClick() {
-        final Integer status = mEnrollableStatusLiveData.getValue();
+        final FingerprintEnrollable status = mEnrollableStatusLiveData.getValue();
         switch (status != null ? status : ENROLLABLE_STATUS_DEFAULT) {
             case FINGERPRINT_ENROLLABLE_ERROR_REACH_MAX:
                 mActionLiveData.postValue(FINGERPRINT_ENROLL_INTRO_ACTION_DONE_AND_FINISH);
diff --git a/tests/unit/Android.bp b/tests/unit/Android.bp
index 8e81218..8dfb52e 100644
--- a/tests/unit/Android.bp
+++ b/tests/unit/Android.bp
@@ -41,7 +41,10 @@
     },
 
     // Include all test java files.
-    srcs: ["src/**/*.java"],
+    srcs: [
+        "src/**/*.java",
+        "src/**/*.kt",
+    ],
 
     platform_apis: true,
     test_suites: ["device-tests"],
diff --git a/tests/unit/src/com/android/settings/biometrics2/ui/model/CredentialModelTest.java b/tests/unit/src/com/android/settings/biometrics2/ui/model/CredentialModelTest.java
deleted file mode 100644
index 8dfca01..0000000
--- a/tests/unit/src/com/android/settings/biometrics2/ui/model/CredentialModelTest.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.biometrics2.ui.model;
-
-import static com.android.settings.biometrics.BiometricEnrollBase.EXTRA_KEY_CHALLENGE;
-import static com.android.settings.biometrics.BiometricEnrollBase.EXTRA_KEY_SENSOR_ID;
-import static com.android.settings.biometrics2.ui.model.CredentialModel.INVALID_CHALLENGE;
-import static com.android.settings.biometrics2.ui.model.CredentialModel.INVALID_GK_PW_HANDLE;
-import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE;
-
-import static com.google.common.truth.Truth.assertThat;
-import static com.google.common.truth.Truth.assertWithMessage;
-
-import android.annotation.NonNull;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.SystemClock;
-import android.os.UserHandle;
-
-import androidx.annotation.Nullable;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import com.android.settings.password.ChooseLockSettingsHelper;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.time.Clock;
-import java.util.Arrays;
-import java.util.Set;
-
-@RunWith(AndroidJUnit4.class)
-public class CredentialModelTest {
-
-    private final Clock mClock = SystemClock.elapsedRealtimeClock();
-
-    public static Bundle newCredentialModelIntentExtras(int userId, long challenge,
-            @Nullable byte[] token, long gkPwHandle) {
-        final Bundle bundle = new Bundle();
-        bundle.putInt(Intent.EXTRA_USER_ID, userId);
-        bundle.putLong(EXTRA_KEY_CHALLENGE, challenge);
-        bundle.putByteArray(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
-        bundle.putLong(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, gkPwHandle);
-        return bundle;
-    }
-
-    public static Bundle newValidTokenCredentialIntentExtras(int userId) {
-        return newCredentialModelIntentExtras(userId, 1L, new byte[] { 0, 1, 2 },
-                INVALID_GK_PW_HANDLE);
-    }
-
-    public static Bundle newOnlySensorValidCredentialIntentExtras(int userId) {
-        return newCredentialModelIntentExtras(userId, INVALID_CHALLENGE, null,
-                INVALID_GK_PW_HANDLE);
-    }
-
-    public static Bundle newGkPwHandleCredentialIntentExtras(int userId, long gkPwHandle) {
-        return newCredentialModelIntentExtras(userId, INVALID_CHALLENGE, null, gkPwHandle);
-    }
-
-    private static void checkBundleLongValue(@NonNull Bundle bundle1, @NonNull Bundle bundle2,
-            @NonNull String key) {
-        if (!bundle1.containsKey(key)) {
-            return;
-        }
-        final int value1 = bundle1.getInt(key);
-        final int value2 = bundle2.getInt(key);
-        assertWithMessage("bundle not match, key:" + key + ", value1:" + value1 + ", value2:"
-                + value2).that(value1).isEqualTo(value2);
-    }
-
-    private static void checkBundleIntValue(@NonNull Bundle bundle1, @NonNull Bundle bundle2,
-            @NonNull String key) {
-        if (!bundle1.containsKey(key)) {
-            return;
-        }
-        final long value1 = bundle1.getLong(key);
-        final long value2 = bundle2.getLong(key);
-        assertWithMessage("bundle not match, key:" + key + ", value1:" + value1 + ", value2:"
-                + value2).that(value1).isEqualTo(value2);
-    }
-
-    private static void checkBundleByteArrayValue(@NonNull Bundle bundle1, @NonNull Bundle bundle2,
-            @NonNull String key) {
-        if (!bundle1.containsKey(key)) {
-            return;
-        }
-        final byte[] value1 = bundle1.getByteArray(key);
-        final byte[] value2 = bundle2.getByteArray(key);
-        final String errMsg = "bundle not match, key:" + key + ", value1:" + Arrays.toString(value1)
-                + ", value2:" + Arrays.toString(value2);
-        if (value1 == null) {
-            assertWithMessage(errMsg).that(value2).isNull();
-        } else {
-            assertWithMessage(errMsg).that(value1.length).isEqualTo(value2.length);
-            for (int i = 0; i < value1.length; ++i) {
-                assertWithMessage(errMsg).that(value1[i]).isEqualTo(value2[i]);
-            }
-        }
-    }
-
-    public static void verifySameCredentialModels(@NonNull CredentialModel model1,
-            @NonNull CredentialModel model2) {
-
-        assertThat(model1.getUserId()).isEqualTo(model2.getUserId());
-        assertThat(model1.getChallenge()).isEqualTo(model2.getChallenge());
-        assertThat(model1.getGkPwHandle()).isEqualTo(model2.getGkPwHandle());
-
-        final byte[] token1 = model1.getToken();
-        final byte[] token2 = model2.getToken();
-        if (token1 == null) {
-            assertThat(token2).isNull();
-        } else {
-            assertThat(token2).isNotNull();
-            assertThat(token1.length).isEqualTo(token2.length);
-            for (int i = 0; i < token1.length; ++i) {
-                assertThat(token1[i]).isEqualTo(token2[i]);
-            }
-        }
-
-        final Bundle bundle1 = model1.getBundle();
-        final Bundle bundle2 = model2.getBundle();
-        final Set<String> keySet1 = bundle1.keySet();
-        assertThat(keySet1.equals(bundle2.keySet())).isTrue();
-        checkBundleIntValue(bundle1, bundle2, Intent.EXTRA_USER_ID);
-        checkBundleIntValue(bundle1, bundle2, EXTRA_KEY_SENSOR_ID);
-        checkBundleLongValue(bundle1, bundle2, EXTRA_KEY_CHALLENGE);
-        checkBundleByteArrayValue(bundle1, bundle2, EXTRA_KEY_CHALLENGE);
-        checkBundleLongValue(bundle1, bundle2, EXTRA_KEY_GK_PW_HANDLE);
-    }
-
-    @Test
-    public void testNullBundle() {
-        final CredentialModel credentialModel = new CredentialModel(null, mClock);
-
-        assertThat(credentialModel.getUserId()).isEqualTo(UserHandle.myUserId());
-    }
-
-    @Test
-    public void testSameValueFromBundle() {
-        final Bundle bundle = newCredentialModelIntentExtras(1234, 6677L,
-                new byte[] { 33, 44, 55 }, 987654321);
-
-        final CredentialModel model1 = new CredentialModel(bundle, mClock);
-        final CredentialModel model2 = new CredentialModel(model1.getBundle(), mClock);
-
-        verifySameCredentialModels(model1, model2);
-    }
-
-    @Test
-    public void testSameValueFromBundle_nullToken() {
-        final Bundle bundle = newCredentialModelIntentExtras(22, 33L, null, 21L);
-
-        final CredentialModel model1 = new CredentialModel(bundle, mClock);
-        final CredentialModel model2 = new CredentialModel(model1.getBundle(), mClock);
-
-        verifySameCredentialModels(model1, model2);
-    }
-}
diff --git a/tests/unit/src/com/android/settings/biometrics2/ui/model/CredentialModelTest.kt b/tests/unit/src/com/android/settings/biometrics2/ui/model/CredentialModelTest.kt
new file mode 100644
index 0000000..d718db6
--- /dev/null
+++ b/tests/unit/src/com/android/settings/biometrics2/ui/model/CredentialModelTest.kt
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.settings.biometrics2.ui.model
+
+import android.content.Intent
+import android.os.Bundle
+import android.os.SystemClock
+import android.os.UserHandle
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.android.settings.biometrics.BiometricEnrollBase
+import com.android.settings.password.ChooseLockSettingsHelper
+import com.google.common.truth.Truth
+import org.junit.Test
+import org.junit.runner.RunWith
+import java.util.Arrays
+
+@RunWith(AndroidJUnit4::class)
+class CredentialModelTest {
+
+    private val clock = SystemClock.elapsedRealtimeClock()
+
+    @Test
+    fun testNullBundle() {
+        val credentialModel = CredentialModel(null, clock)
+        Truth.assertThat(credentialModel.userId).isEqualTo(UserHandle.myUserId())
+    }
+
+    @Test
+    fun testSameValueFromBundle() {
+        val bundle = newCredentialModelIntentExtras(1234, 6677L, byteArrayOf(33, 44, 55), 987654321)
+        val model1 = CredentialModel(bundle, clock)
+        val model2 = CredentialModel(model1.bundle, clock)
+        verifySameCredentialModels(model1, model2)
+    }
+
+    @Test
+    fun testSameValueFromBundle_nullToken() {
+        val bundle = newCredentialModelIntentExtras(22, 33L, null, 21L)
+        val model1 = CredentialModel(bundle, clock)
+        val model2 = CredentialModel(model1.bundle, clock)
+        verifySameCredentialModels(model1, model2)
+    }
+
+    companion object {
+        @JvmStatic
+        fun newCredentialModelIntentExtras(
+            userId: Int, challenge: Long,
+            token: ByteArray?, gkPwHandle: Long
+        ): Bundle {
+            val bundle = Bundle()
+            bundle.putInt(Intent.EXTRA_USER_ID, userId)
+            bundle.putLong(BiometricEnrollBase.EXTRA_KEY_CHALLENGE, challenge)
+            bundle.putByteArray(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token)
+            bundle.putLong(ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE, gkPwHandle)
+            return bundle
+        }
+
+        @JvmStatic
+        fun newValidTokenCredentialIntentExtras(userId: Int): Bundle {
+            return newCredentialModelIntentExtras(
+                userId, 1L, byteArrayOf(0, 1, 2),
+                CredentialModel.INVALID_GK_PW_HANDLE
+            )
+        }
+
+        @JvmStatic
+        fun newOnlySensorValidCredentialIntentExtras(userId: Int): Bundle {
+            return newCredentialModelIntentExtras(
+                userId, CredentialModel.INVALID_CHALLENGE, null,
+                CredentialModel.INVALID_GK_PW_HANDLE
+            )
+        }
+
+        @JvmStatic
+        fun newGkPwHandleCredentialIntentExtras(userId: Int, gkPwHandle: Long): Bundle {
+            return newCredentialModelIntentExtras(
+                userId,
+                CredentialModel.INVALID_CHALLENGE,
+                null,
+                gkPwHandle
+            )
+        }
+
+        private fun checkBundleLongValue(
+            bundle1: Bundle, bundle2: Bundle,
+            key: String
+        ) {
+            if (!bundle1.containsKey(key)) {
+                return
+            }
+            val value1 = bundle1.getInt(key)
+            val value2 = bundle2.getInt(key)
+            Truth.assertWithMessage(
+                "bundle not match, key:" + key + ", value1:" + value1 + ", value2:"
+                        + value2
+            ).that(value1).isEqualTo(value2)
+        }
+
+        private fun checkBundleIntValue(
+            bundle1: Bundle, bundle2: Bundle,
+            key: String
+        ) {
+            if (!bundle1.containsKey(key)) {
+                return
+            }
+            val value1 = bundle1.getLong(key)
+            val value2 = bundle2.getLong(key)
+            Truth.assertWithMessage(
+                "bundle not match, key:" + key + ", value1:" + value1 + ", value2:"
+                        + value2
+            ).that(value1).isEqualTo(value2)
+        }
+
+        private fun checkBundleByteArrayValue(
+            bundle1: Bundle, bundle2: Bundle,
+            key: String
+        ) {
+            if (!bundle1.containsKey(key)) {
+                return
+            }
+            val value1 = bundle1.getByteArray(key)
+            val value2 = bundle2.getByteArray(key)
+            val errMsg = ("bundle not match, key:" + key + ", value1:" + Arrays.toString(value1)
+                    + ", value2:" + Arrays.toString(value2))
+            if (value1 == null) {
+                Truth.assertWithMessage(errMsg).that(value2).isNull()
+            } else {
+                Truth.assertWithMessage(errMsg).that(value1.size).isEqualTo(
+                    value2!!.size
+                )
+                for (i in value1.indices) {
+                    Truth.assertWithMessage(errMsg).that(value1[i]).isEqualTo(
+                        value2[i]
+                    )
+                }
+            }
+        }
+
+        fun verifySameCredentialModels(
+            model1: CredentialModel,
+            model2: CredentialModel
+        ) {
+            Truth.assertThat(model1.userId).isEqualTo(model2.userId)
+            Truth.assertThat(model1.challenge).isEqualTo(model2.challenge)
+            Truth.assertThat(model1.gkPwHandle).isEqualTo(model2.gkPwHandle)
+            val token1 = model1.token
+            val token2 = model2.token
+            if (token1 == null) {
+                Truth.assertThat(token2).isNull()
+            } else {
+                Truth.assertThat(token2).isNotNull()
+                Truth.assertThat(token1.size).isEqualTo(token2!!.size)
+                for (i in token1.indices) {
+                    Truth.assertThat(token1[i]).isEqualTo(
+                        token2[i]
+                    )
+                }
+            }
+            val bundle1 = model1.bundle
+            val bundle2 = model2.bundle
+            val keySet1 = bundle1.keySet()
+            Truth.assertThat(keySet1 == bundle2.keySet()).isTrue()
+            checkBundleIntValue(bundle1, bundle2, Intent.EXTRA_USER_ID)
+            checkBundleIntValue(bundle1, bundle2, BiometricEnrollBase.EXTRA_KEY_SENSOR_ID)
+            checkBundleLongValue(bundle1, bundle2, BiometricEnrollBase.EXTRA_KEY_CHALLENGE)
+            checkBundleByteArrayValue(bundle1, bundle2, BiometricEnrollBase.EXTRA_KEY_CHALLENGE)
+            checkBundleLongValue(bundle1, bundle2, ChooseLockSettingsHelper.EXTRA_KEY_GK_PW_HANDLE)
+        }
+    }
+}
diff --git a/tests/unit/src/com/android/settings/biometrics2/ui/model/EnrollmentRequestTest.java b/tests/unit/src/com/android/settings/biometrics2/ui/model/EnrollmentRequestTest.java
deleted file mode 100644
index f060815..0000000
--- a/tests/unit/src/com/android/settings/biometrics2/ui/model/EnrollmentRequestTest.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.biometrics2.ui.model;
-
-import static com.android.settings.biometrics.BiometricEnrollActivity.EXTRA_SKIP_INTRO;
-import static com.android.settings.biometrics2.ui.model.EnrollmentRequest.EXTRA_SKIP_FIND_SENSOR;
-
-import static com.google.android.setupcompat.util.WizardManagerHelper.EXTRA_IS_DEFERRED_SETUP;
-import static com.google.android.setupcompat.util.WizardManagerHelper.EXTRA_IS_PORTAL_SETUP;
-import static com.google.android.setupcompat.util.WizardManagerHelper.EXTRA_IS_SETUP_FLOW;
-import static com.google.android.setupcompat.util.WizardManagerHelper.EXTRA_IS_SUW_SUGGESTED_ACTION_FLOW;
-import static com.google.common.truth.Truth.assertThat;
-
-import android.annotation.NonNull;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-
-import androidx.test.core.app.ApplicationProvider;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-public class EnrollmentRequestTest {
-
-    @NonNull
-    private final Context mContext = ApplicationProvider.getApplicationContext();
-
-    @Test
-    public void testIsSuw() {
-        // Default false
-        assertThat(new EnrollmentRequest(new Intent(), mContext, true).isSuw()).isFalse();
-        assertThat(new EnrollmentRequest(new Intent(), mContext, false).isSuw()).isFalse();
-
-        final Intent trueIntent = new Intent();
-        trueIntent.putExtra(EXTRA_IS_SETUP_FLOW, true);
-        assertThat(new EnrollmentRequest(trueIntent, mContext, true).isSuw()).isTrue();
-        assertThat(new EnrollmentRequest(trueIntent, mContext, false).isSuw()).isFalse();
-
-        final Intent falseIntent = new Intent();
-        trueIntent.putExtra(EXTRA_IS_SETUP_FLOW, false);
-        assertThat(new EnrollmentRequest(falseIntent, mContext, true).isSuw()).isFalse();
-        assertThat(new EnrollmentRequest(falseIntent, mContext, false).isSuw()).isFalse();
-    }
-
-    @Test
-    public void testIsAfterSuwOrSuwSuggestedAction() {
-        // Default false
-        assertThat(new EnrollmentRequest(new Intent(), mContext, true)
-                .isAfterSuwOrSuwSuggestedAction()).isFalse();
-        assertThat(new EnrollmentRequest(new Intent(), mContext, false)
-                .isAfterSuwOrSuwSuggestedAction()).isFalse();
-
-        final Intent deferredTrueIntent = new Intent();
-        deferredTrueIntent.putExtra(EXTRA_IS_DEFERRED_SETUP, true);
-        assertThat(new EnrollmentRequest(deferredTrueIntent, mContext, true)
-                .isAfterSuwOrSuwSuggestedAction()).isTrue();
-        assertThat(new EnrollmentRequest(deferredTrueIntent, mContext, false)
-                .isAfterSuwOrSuwSuggestedAction()).isFalse();
-
-        final Intent deferredFalseIntent = new Intent();
-        deferredFalseIntent.putExtra(EXTRA_IS_DEFERRED_SETUP, false);
-        assertThat(new EnrollmentRequest(deferredFalseIntent, mContext, false)
-                .isAfterSuwOrSuwSuggestedAction()).isFalse();
-        assertThat(new EnrollmentRequest(deferredFalseIntent, mContext, false)
-                .isAfterSuwOrSuwSuggestedAction()).isFalse();
-
-        final Intent portalTrueIntent = new Intent();
-        portalTrueIntent.putExtra(EXTRA_IS_PORTAL_SETUP, true);
-        assertThat(new EnrollmentRequest(portalTrueIntent, mContext, true)
-                .isAfterSuwOrSuwSuggestedAction()).isTrue();
-        assertThat(new EnrollmentRequest(portalTrueIntent, mContext, false)
-                .isAfterSuwOrSuwSuggestedAction()).isFalse();
-
-        final Intent portalFalseIntent = new Intent();
-        portalFalseIntent.putExtra(EXTRA_IS_PORTAL_SETUP, false);
-        assertThat(new EnrollmentRequest(portalFalseIntent, mContext, false)
-                .isAfterSuwOrSuwSuggestedAction()).isFalse();
-        assertThat(new EnrollmentRequest(portalFalseIntent, mContext, false)
-                .isAfterSuwOrSuwSuggestedAction()).isFalse();
-
-        final Intent suggestedTrueIntent = new Intent();
-        suggestedTrueIntent.putExtra(EXTRA_IS_SUW_SUGGESTED_ACTION_FLOW, true);
-        assertThat(new EnrollmentRequest(suggestedTrueIntent, mContext, true)
-                .isAfterSuwOrSuwSuggestedAction()).isTrue();
-        assertThat(new EnrollmentRequest(suggestedTrueIntent, mContext, false)
-                .isAfterSuwOrSuwSuggestedAction()).isFalse();
-
-        final Intent suggestedFalseIntent = new Intent();
-        suggestedFalseIntent.putExtra(EXTRA_IS_SUW_SUGGESTED_ACTION_FLOW, false);
-        assertThat(new EnrollmentRequest(suggestedFalseIntent, mContext, false)
-                .isAfterSuwOrSuwSuggestedAction()).isFalse();
-        assertThat(new EnrollmentRequest(suggestedFalseIntent, mContext, false)
-                .isAfterSuwOrSuwSuggestedAction()).isFalse();
-    }
-
-    @Test
-    public void testGetSuwExtras_inSuw() {
-        final Intent suwIntent = new Intent();
-        suwIntent.putExtra(EXTRA_IS_SETUP_FLOW, true);
-        final EnrollmentRequest setupRequest = new EnrollmentRequest(suwIntent, mContext, true);
-
-        final Bundle bundle = setupRequest.getSuwExtras();
-        assertThat(bundle).isNotNull();
-        assertThat(bundle.size()).isAtLeast(1);
-        assertThat(bundle.getBoolean(EXTRA_IS_SETUP_FLOW)).isTrue();
-    }
-
-    @Test
-    public void testGetSuwExtras_notInSuw() {
-        final Intent suwIntent = new Intent();
-        suwIntent.putExtra(EXTRA_IS_SETUP_FLOW, true);
-        final EnrollmentRequest setupRequest = new EnrollmentRequest(suwIntent, mContext, false);
-
-        final Bundle bundle = setupRequest.getSuwExtras();
-        assertThat(bundle).isNotNull();
-        assertThat(bundle.size()).isEqualTo(0);
-    }
-
-    @Test
-    public void testIsSkipIntro() {
-        // Default false
-        assertThat(new EnrollmentRequest(new Intent(), mContext, true).isSkipIntro()).isFalse();
-        assertThat(new EnrollmentRequest(new Intent(), mContext, false).isSkipIntro()).isFalse();
-
-        final Intent trueIntent = new Intent();
-        trueIntent.putExtra(EXTRA_SKIP_INTRO, true);
-        assertThat(new EnrollmentRequest(trueIntent, mContext, true).isSkipIntro()).isTrue();
-        assertThat(new EnrollmentRequest(trueIntent, mContext, false).isSkipIntro()).isTrue();
-
-        final Intent falseIntent = new Intent();
-        falseIntent.putExtra(EXTRA_SKIP_INTRO, false);
-        assertThat(new EnrollmentRequest(falseIntent, mContext, false).isSkipIntro()).isFalse();
-        assertThat(new EnrollmentRequest(falseIntent, mContext, false).isSkipIntro()).isFalse();
-    }
-
-    @Test
-    public void testIsSkipFindSensor() {
-        // Default false
-        assertThat(new EnrollmentRequest(new Intent(), mContext, true).isSkipFindSensor())
-                .isFalse();
-        assertThat(new EnrollmentRequest(new Intent(), mContext, false).isSkipFindSensor())
-                .isFalse();
-
-        final Intent trueIntent = new Intent();
-        trueIntent.putExtra(EXTRA_SKIP_FIND_SENSOR, true);
-        assertThat(new EnrollmentRequest(trueIntent, mContext, true).isSkipFindSensor()).isTrue();
-        assertThat(new EnrollmentRequest(trueIntent, mContext, false).isSkipFindSensor()).isTrue();
-
-        final Intent falseIntent = new Intent();
-        falseIntent.putExtra(EXTRA_SKIP_FIND_SENSOR, false);
-        assertThat(new EnrollmentRequest(falseIntent, mContext, false).isSkipFindSensor())
-                .isFalse();
-        assertThat(new EnrollmentRequest(falseIntent, mContext, false).isSkipFindSensor())
-                .isFalse();
-    }
-
-}
diff --git a/tests/unit/src/com/android/settings/biometrics2/ui/model/EnrollmentRequestTest.kt b/tests/unit/src/com/android/settings/biometrics2/ui/model/EnrollmentRequestTest.kt
new file mode 100644
index 0000000..b301433
--- /dev/null
+++ b/tests/unit/src/com/android/settings/biometrics2/ui/model/EnrollmentRequestTest.kt
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.settings.biometrics2.ui.model
+
+import android.content.Context
+import android.content.Intent
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.android.settings.biometrics.BiometricEnrollActivity
+import com.google.android.setupcompat.util.WizardManagerHelper
+import com.google.common.truth.Truth
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@RunWith(AndroidJUnit4::class)
+class EnrollmentRequestTest {
+
+    private val context = ApplicationProvider.getApplicationContext<Context>()
+
+    @Test
+    fun testIsSuw() {
+        // Default false
+        Truth.assertThat(EnrollmentRequest(Intent(), context, true).isSuw).isFalse()
+        Truth.assertThat(EnrollmentRequest(Intent(), context, false).isSuw).isFalse()
+        val trueIntent = Intent()
+        trueIntent.putExtra(WizardManagerHelper.EXTRA_IS_SETUP_FLOW, true)
+        Truth.assertThat(EnrollmentRequest(trueIntent, context, true).isSuw).isTrue()
+        Truth.assertThat(EnrollmentRequest(trueIntent, context, false).isSuw).isFalse()
+        val falseIntent = Intent()
+        trueIntent.putExtra(WizardManagerHelper.EXTRA_IS_SETUP_FLOW, false)
+        Truth.assertThat(EnrollmentRequest(falseIntent, context, true).isSuw).isFalse()
+        Truth.assertThat(EnrollmentRequest(falseIntent, context, false).isSuw).isFalse()
+    }
+
+    @Test
+    fun testIsAfterSuwOrSuwSuggestedAction() {
+        // Default false
+        Truth.assertThat(
+            EnrollmentRequest(Intent(), context, true)
+                .isAfterSuwOrSuwSuggestedAction
+        ).isFalse()
+        Truth.assertThat(
+            EnrollmentRequest(Intent(), context, false)
+                .isAfterSuwOrSuwSuggestedAction
+        ).isFalse()
+        val deferredTrueIntent = Intent()
+        deferredTrueIntent.putExtra(WizardManagerHelper.EXTRA_IS_DEFERRED_SETUP, true)
+        Truth.assertThat(
+            EnrollmentRequest(deferredTrueIntent, context, true)
+                .isAfterSuwOrSuwSuggestedAction
+        ).isTrue()
+        Truth.assertThat(
+            EnrollmentRequest(deferredTrueIntent, context, false)
+                .isAfterSuwOrSuwSuggestedAction
+        ).isFalse()
+        val deferredFalseIntent = Intent()
+        deferredFalseIntent.putExtra(WizardManagerHelper.EXTRA_IS_DEFERRED_SETUP, false)
+        Truth.assertThat(
+            EnrollmentRequest(deferredFalseIntent, context, false)
+                .isAfterSuwOrSuwSuggestedAction
+        ).isFalse()
+        Truth.assertThat(
+            EnrollmentRequest(deferredFalseIntent, context, false)
+                .isAfterSuwOrSuwSuggestedAction
+        ).isFalse()
+        val portalTrueIntent = Intent()
+        portalTrueIntent.putExtra(WizardManagerHelper.EXTRA_IS_PORTAL_SETUP, true)
+        Truth.assertThat(
+            EnrollmentRequest(portalTrueIntent, context, true)
+                .isAfterSuwOrSuwSuggestedAction
+        ).isTrue()
+        Truth.assertThat(
+            EnrollmentRequest(portalTrueIntent, context, false)
+                .isAfterSuwOrSuwSuggestedAction
+        ).isFalse()
+        val portalFalseIntent = Intent()
+        portalFalseIntent.putExtra(WizardManagerHelper.EXTRA_IS_PORTAL_SETUP, false)
+        Truth.assertThat(
+            EnrollmentRequest(portalFalseIntent, context, false)
+                .isAfterSuwOrSuwSuggestedAction
+        ).isFalse()
+        Truth.assertThat(
+            EnrollmentRequest(portalFalseIntent, context, false)
+                .isAfterSuwOrSuwSuggestedAction
+        ).isFalse()
+        val suggestedTrueIntent = Intent()
+        suggestedTrueIntent.putExtra(WizardManagerHelper.EXTRA_IS_SUW_SUGGESTED_ACTION_FLOW, true)
+        Truth.assertThat(
+            EnrollmentRequest(suggestedTrueIntent, context, true)
+                .isAfterSuwOrSuwSuggestedAction
+        ).isTrue()
+        Truth.assertThat(
+            EnrollmentRequest(suggestedTrueIntent, context, false)
+                .isAfterSuwOrSuwSuggestedAction
+        ).isFalse()
+        val suggestedFalseIntent = Intent()
+        suggestedFalseIntent.putExtra(WizardManagerHelper.EXTRA_IS_SUW_SUGGESTED_ACTION_FLOW, false)
+        Truth.assertThat(
+            EnrollmentRequest(suggestedFalseIntent, context, false)
+                .isAfterSuwOrSuwSuggestedAction
+        ).isFalse()
+        Truth.assertThat(
+            EnrollmentRequest(suggestedFalseIntent, context, false)
+                .isAfterSuwOrSuwSuggestedAction
+        ).isFalse()
+    }
+
+    @Test
+    fun testGetSuwExtras_inSuw() {
+        val suwIntent = Intent()
+        suwIntent.putExtra(WizardManagerHelper.EXTRA_IS_SETUP_FLOW, true)
+        val setupRequest = EnrollmentRequest(suwIntent, context, true)
+        val bundle = setupRequest.suwExtras
+        Truth.assertThat(bundle).isNotNull()
+        Truth.assertThat(bundle.size()).isAtLeast(1)
+        Truth.assertThat(bundle.getBoolean(WizardManagerHelper.EXTRA_IS_SETUP_FLOW)).isTrue()
+    }
+
+    @Test
+    fun testGetSuwExtras_notInSuw() {
+        val suwIntent = Intent()
+        suwIntent.putExtra(WizardManagerHelper.EXTRA_IS_SETUP_FLOW, true)
+        val setupRequest = EnrollmentRequest(suwIntent, context, false)
+        val bundle = setupRequest.suwExtras
+        Truth.assertThat(bundle).isNotNull()
+        Truth.assertThat(bundle.size()).isEqualTo(0)
+    }
+
+    @Test
+    fun testIsSkipIntro() {
+        // Default false
+        Truth.assertThat(EnrollmentRequest(Intent(), context, true).isSkipIntro).isFalse()
+        Truth.assertThat(EnrollmentRequest(Intent(), context, false).isSkipIntro).isFalse()
+        val trueIntent = Intent()
+        trueIntent.putExtra(BiometricEnrollActivity.EXTRA_SKIP_INTRO, true)
+        Truth.assertThat(EnrollmentRequest(trueIntent, context, true).isSkipIntro).isTrue()
+        Truth.assertThat(EnrollmentRequest(trueIntent, context, false).isSkipIntro).isTrue()
+        val falseIntent = Intent()
+        falseIntent.putExtra(BiometricEnrollActivity.EXTRA_SKIP_INTRO, false)
+        Truth.assertThat(EnrollmentRequest(falseIntent, context, false).isSkipIntro).isFalse()
+        Truth.assertThat(EnrollmentRequest(falseIntent, context, false).isSkipIntro).isFalse()
+    }
+
+    @Test
+    fun testIsSkipFindSensor() {
+        // Default false
+        Truth.assertThat(EnrollmentRequest(Intent(), context, true).isSkipFindSensor)
+            .isFalse()
+        Truth.assertThat(EnrollmentRequest(Intent(), context, false).isSkipFindSensor)
+            .isFalse()
+        val trueIntent = Intent()
+        trueIntent.putExtra(EnrollmentRequest.EXTRA_SKIP_FIND_SENSOR, true)
+        Truth.assertThat(EnrollmentRequest(trueIntent, context, true).isSkipFindSensor).isTrue()
+        Truth.assertThat(EnrollmentRequest(trueIntent, context, false).isSkipFindSensor).isTrue()
+        val falseIntent = Intent()
+        falseIntent.putExtra(EnrollmentRequest.EXTRA_SKIP_FIND_SENSOR, false)
+        Truth.assertThat(EnrollmentRequest(falseIntent, context, false).isSkipFindSensor)
+            .isFalse()
+        Truth.assertThat(EnrollmentRequest(falseIntent, context, false).isSkipFindSensor)
+            .isFalse()
+    }
+}
diff --git a/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollIntroViewModelTest.java b/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollIntroViewModelTest.java
index 73ff2e2..12b860b 100644
--- a/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollIntroViewModelTest.java
+++ b/tests/unit/src/com/android/settings/biometrics2/ui/viewmodel/FingerprintEnrollIntroViewModelTest.java
@@ -18,8 +18,8 @@
 
 import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UDFPS_OPTICAL;
 
-import static com.android.settings.biometrics2.ui.model.FingerprintEnrollIntroStatus.FINGERPRINT_ENROLLABLE_ERROR_REACH_MAX;
-import static com.android.settings.biometrics2.ui.model.FingerprintEnrollIntroStatus.FINGERPRINT_ENROLLABLE_OK;
+import static com.android.settings.biometrics2.ui.model.FingerprintEnrollable.FINGERPRINT_ENROLLABLE_ERROR_REACH_MAX;
+import static com.android.settings.biometrics2.ui.model.FingerprintEnrollable.FINGERPRINT_ENROLLABLE_OK;
 import static com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollIntroViewModel.FINGERPRINT_ENROLL_INTRO_ACTION_CONTINUE_ENROLL;
 import static com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollIntroViewModel.FINGERPRINT_ENROLL_INTRO_ACTION_DONE_AND_FINISH;
 import static com.android.settings.biometrics2.ui.viewmodel.FingerprintEnrollIntroViewModel.FINGERPRINT_ENROLL_INTRO_ACTION_SKIP_OR_CANCEL;
diff --git a/tests/unit/src/com/android/settings/biometrics2/utils/EnrollmentRequestUtils.java b/tests/unit/src/com/android/settings/biometrics2/utils/EnrollmentRequestUtils.java
deleted file mode 100644
index a97f223..0000000
--- a/tests/unit/src/com/android/settings/biometrics2/utils/EnrollmentRequestUtils.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.biometrics2.utils;
-
-import static com.android.settings.biometrics.BiometricEnrollBase.EXTRA_FROM_SETTINGS_SUMMARY;
-
-import static com.google.android.setupcompat.util.WizardManagerHelper.EXTRA_IS_DEFERRED_SETUP;
-import static com.google.android.setupcompat.util.WizardManagerHelper.EXTRA_IS_FIRST_RUN;
-import static com.google.android.setupcompat.util.WizardManagerHelper.EXTRA_IS_PORTAL_SETUP;
-import static com.google.android.setupcompat.util.WizardManagerHelper.EXTRA_IS_SETUP_FLOW;
-import static com.google.android.setupcompat.util.WizardManagerHelper.EXTRA_IS_SUW_SUGGESTED_ACTION_FLOW;
-import static com.google.android.setupcompat.util.WizardManagerHelper.EXTRA_THEME;
-
-import android.content.Context;
-import android.content.Intent;
-import android.text.TextUtils;
-
-import androidx.annotation.NonNull;
-
-import com.android.settings.biometrics2.ui.model.EnrollmentRequest;
-
-public class EnrollmentRequestUtils {
-
-    @NonNull
-    public static EnrollmentRequest newAllFalseRequest(@NonNull Context context) {
-        return newRequest(context, false, false, false, false, false, false, null);
-    }
-
-    @NonNull
-    public static EnrollmentRequest newIsSuwRequest(@NonNull Context context) {
-        return newRequest(context, true, false, false, false, false, false, null);
-    }
-
-    @NonNull
-    public static EnrollmentRequest newIsSuwDeferredRequest(@NonNull Context context) {
-        return newRequest(context, true, true, false, false, false, false, null);
-    }
-
-    @NonNull
-    public static EnrollmentRequest newIsSuwPortalRequest(@NonNull Context context) {
-        return newRequest(context, true, false, true, false, false, false, null);
-    }
-
-    @NonNull
-    public static EnrollmentRequest newIsSuwSuggestedActionFlowRequest(
-            @NonNull Context context) {
-        return newRequest(context, true, false, false, true, false, false, null);
-    }
-
-    @NonNull
-    public static EnrollmentRequest newRequest(@NonNull Context context, boolean isSuw,
-            boolean isSuwDeferred, boolean isSuwPortal, boolean isSuwSuggestedActionFlow,
-            boolean isSuwFirstRun, boolean isFromSettingsSummery, String theme) {
-        Intent i = new Intent();
-        i.putExtra(EXTRA_IS_SETUP_FLOW, isSuw);
-        i.putExtra(EXTRA_IS_DEFERRED_SETUP, isSuwDeferred);
-        i.putExtra(EXTRA_IS_PORTAL_SETUP, isSuwPortal);
-        i.putExtra(EXTRA_IS_SUW_SUGGESTED_ACTION_FLOW, isSuwSuggestedActionFlow);
-        i.putExtra(EXTRA_IS_FIRST_RUN, isSuwFirstRun);
-        i.putExtra(EXTRA_FROM_SETTINGS_SUMMARY, isFromSettingsSummery);
-        if (!TextUtils.isEmpty(theme)) {
-            i.putExtra(EXTRA_THEME, theme);
-        }
-        return new EnrollmentRequest(i, context, true);
-    }
-
-}
diff --git a/tests/unit/src/com/android/settings/biometrics2/utils/EnrollmentRequestUtils.kt b/tests/unit/src/com/android/settings/biometrics2/utils/EnrollmentRequestUtils.kt
new file mode 100644
index 0000000..755f6d0
--- /dev/null
+++ b/tests/unit/src/com/android/settings/biometrics2/utils/EnrollmentRequestUtils.kt
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.settings.biometrics2.utils
+
+import android.content.Context
+import android.content.Intent
+import android.text.TextUtils
+import com.android.settings.biometrics.BiometricEnrollBase
+import com.android.settings.biometrics2.ui.model.EnrollmentRequest
+import com.google.android.setupcompat.util.WizardManagerHelper
+
+object EnrollmentRequestUtils {
+    @JvmStatic
+    fun newAllFalseRequest(context: Context): EnrollmentRequest {
+        return newRequest(
+            context = context,
+            isSuw = false,
+            isSuwDeferred = false,
+            isSuwPortal = false,
+            isSuwSuggestedActionFlow = false,
+            isSuwFirstRun = false,
+            isFromSettingsSummery = false)
+    }
+
+    @JvmStatic
+    fun newIsSuwRequest(context: Context): EnrollmentRequest {
+        return newRequest(
+            context = context,
+            isSuw = true,
+            isSuwDeferred = false,
+            isSuwPortal = false,
+            isSuwSuggestedActionFlow = false,
+            isSuwFirstRun = false,
+            isFromSettingsSummery = false)
+    }
+
+    @JvmStatic
+    fun newIsSuwDeferredRequest(context: Context): EnrollmentRequest {
+        return newRequest(
+            context = context,
+            isSuw = true,
+            isSuwDeferred = true,
+            isSuwPortal = false,
+            isSuwSuggestedActionFlow = false,
+            isSuwFirstRun = false,
+            isFromSettingsSummery = false, null)
+    }
+
+    @JvmStatic
+    fun newIsSuwPortalRequest(context: Context): EnrollmentRequest {
+        return newRequest(
+            context = context,
+            isSuw = true,
+            isSuwDeferred = false,
+            isSuwPortal = true,
+            isSuwSuggestedActionFlow = false,
+            isSuwFirstRun = false,
+            isFromSettingsSummery = false)
+    }
+
+    @JvmStatic
+    fun newIsSuwSuggestedActionFlowRequest(
+        context: Context
+    ): EnrollmentRequest {
+        return newRequest(
+            context = context,
+            isSuw = true,
+            isSuwDeferred = false,
+            isSuwPortal = false,
+            isSuwSuggestedActionFlow = true,
+            isSuwFirstRun = false,
+            isFromSettingsSummery = false)
+    }
+
+    fun newRequest(
+        context: Context,
+        isSuw: Boolean,
+        isSuwDeferred: Boolean,
+        isSuwPortal: Boolean,
+        isSuwSuggestedActionFlow: Boolean,
+        isSuwFirstRun: Boolean,
+        isFromSettingsSummery: Boolean,
+        theme: String? = null
+    ): EnrollmentRequest {
+        val i = Intent()
+        i.putExtra(WizardManagerHelper.EXTRA_IS_SETUP_FLOW, isSuw)
+        i.putExtra(WizardManagerHelper.EXTRA_IS_DEFERRED_SETUP, isSuwDeferred)
+        i.putExtra(WizardManagerHelper.EXTRA_IS_PORTAL_SETUP, isSuwPortal)
+        i.putExtra(WizardManagerHelper.EXTRA_IS_SUW_SUGGESTED_ACTION_FLOW, isSuwSuggestedActionFlow)
+        i.putExtra(WizardManagerHelper.EXTRA_IS_FIRST_RUN, isSuwFirstRun)
+        i.putExtra(BiometricEnrollBase.EXTRA_FROM_SETTINGS_SUMMARY, isFromSettingsSummery)
+        if (!TextUtils.isEmpty(theme)) {
+            i.putExtra(WizardManagerHelper.EXTRA_THEME, theme)
+        }
+        return EnrollmentRequest(i, context, true)
+    }
+}
