Skip to content
Snippets Groups Projects
Commit 506f4e6d authored by Dhina17's avatar Dhina17
Browse files

applock: Handle null-safety errors for 14 QPR2

Change-Id: I668712bc9e0fe9faf068f756a15483a118fabe44
parent bfe1fae9
No related branches found
No related tags found
No related merge requests found
/*
* Copyright (C) 2022 FlamingoOS Project
* Copyright (C) 2024 The LibreMobileOS Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -55,7 +56,7 @@ class AppLockBiometricPreferenceController(
}
override fun getAvailabilityStatus(): Int {
val result = biometricManager.canAuthenticate(BIOMETRIC_STRONG)
val result = biometricManager?.canAuthenticate(BIOMETRIC_STRONG)
return if (result == BiometricManager.BIOMETRIC_SUCCESS) AVAILABLE else CONDITIONALLY_UNAVAILABLE
}
......
/*
* Copyright (C) 2014 The Android Open Source Project
* Copyright (C) 2022 FlamingoOS Project
* Copyright (C) 2024 The LibreMobileOS Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -75,7 +76,7 @@ class AppLockCredentialActivity : FragmentActivity() {
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
waitingForBiometricCallback = false
appLockManager.unlockPackage(packageName)
packageName?.let { appLockManager.unlockPackage(it) }
ConfirmDeviceCredentialUtils.checkForPendingIntent(this@AppLockCredentialActivity)
setResult(Activity.RESULT_OK)
finish()
......
/*
* Copyright (C) 2022 FlamingoOS Project
* Copyright (C) 2024 The LibreMobileOS Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -52,8 +53,7 @@ class AppLockPackageConfigFragment : DashboardFragment() {
requireActivity(),
this,
header?.findViewById(R.id.entity_header)
).setRecyclerView(listView, settingsLifecycle)
.setPackageName(packageInfo.packageName)
).setPackageName(packageInfo.packageName)
.setButtonActions(
EntityHeaderController.ActionType.ACTION_NONE,
EntityHeaderController.ActionType.ACTION_NONE
......@@ -61,7 +61,7 @@ class AppLockPackageConfigFragment : DashboardFragment() {
.bindHeaderButtons()
.setLabel(appEntry)
.setIcon(appEntry)
.done(requireActivity(), false /* rebindActions */)
.done(false /* rebindActions */)
}
override protected fun createPreferenceControllers(
......
/*
* Copyright (C) 2022 FlamingoOS Project
* Copyright (C) 2024 The LibreMobileOS Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -66,7 +67,8 @@ class AppLockPackageListFragment : DashboardFragment() {
pm.getInstalledPackages(
PackageInfoFlags.of(PackageManager.MATCH_ALL.toLong())
).filter {
!it.applicationInfo.isSystemApp() || whiteListedPackages.contains(it.packageName)
!(it.applicationInfo?.isSystemApp() == true)
|| whiteListedPackages.contains(it.packageName)
}.sortedWith { first, second ->
getLabel(first).compareTo(getLabel(second))
}
......@@ -100,14 +102,14 @@ class AppLockPackageListFragment : DashboardFragment() {
}
private fun getLabel(packageInfo: PackageInfo) =
packageInfo.applicationInfo.loadLabel(pm).toString()
packageInfo.applicationInfo?.loadLabel(pm).toString()
private fun createPreference(packageInfo: PackageInfo, isProtected: Boolean): Preference {
val label = getLabel(packageInfo)
return PrimarySwitchPreference(requireContext()).apply {
key = packageInfo.packageName
title = label
icon = packageInfo.applicationInfo.loadIcon(pm)
icon = packageInfo.applicationInfo?.loadIcon(pm)
setIconSize(ICON_SIZE_SMALL)
isChecked = isProtected
setOnPreferenceChangeListener { _, newValue ->
......
/*
* Copyright (C) 2022 FlamingoOS Project
* Copyright (C) 2024 The LibreMobileOS Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -119,7 +120,7 @@ class AppLockSettingsPreferenceController(
val title = mContext.getString(R.string.app_lock_authentication_dialog_title)
val intent = Intent().apply {
setClassName(SETTINGS_PACKAGE_NAME,
ConfirmDeviceCredentialActivity::class.qualifiedName)
ConfirmDeviceCredentialActivity::class.qualifiedName!!)
putExtra(KeyguardManager.EXTRA_TITLE, title)
}
securityPromptLauncher.launch(intent)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment