Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dbb8bfea authored by Colin Cross's avatar Colin Cross
Browse files

Fix kotlin nullable errors in SettingsLib

Fix kotlin nullable errors that were exposed by setting the retention
of android.annotation.NonNull and android.annotation.Nullable to
class retention.

Bug: 294110802
Test: builds
Change-Id: I759f7022e500d64c4031c5b9244a00687c8631d7
parent 8db9adf8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ internal class AppListRepositoryImpl(private val context: Context) : AppListRepo
            packageManager.getInstalledModules(0)
                .filter { it.isHidden }
                .map { it.packageName }
                .filterNotNull()
                .toSet()
        }
        val hideWhenDisabledPackagesDeferred = async {
+2 −1
Original line number Diff line number Diff line
@@ -82,7 +82,8 @@ internal class PackageManagersImpl(
        val packageInfo = getPackageInfoAsUser(packageName, PackageManager.GET_PERMISSIONS, userId)
        val index = packageInfo?.requestedPermissions?.indexOf(permission) ?: return false
        return index >= 0 &&
            packageInfo.requestedPermissionsFlags[index].hasFlag(REQUESTED_PERMISSION_GRANTED)
            checkNotNull(packageInfo.requestedPermissionsFlags)[index]
                .hasFlag(REQUESTED_PERMISSION_GRANTED)
    }

    override suspend fun getAppOpPermissionPackages(userId: Int, permission: String): Set<String> =
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ class EnterpriseRepository(private val context: Context) {
    }

    fun getEnterpriseString(updatableStringId: String, resId: Int): String =
        resources.getString(updatableStringId) { context.getString(resId) }
        checkNotNull(resources.getString(updatableStringId) { context.getString(resId) })

    fun getProfileTitle(isManagedProfile: Boolean): String = if (isManagedProfile) {
        getEnterpriseString(WORK_CATEGORY_HEADER, R.string.category_work)
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ class AppInfoProvider(private val packageInfo: PackageInfo) {
                .semantics(mergeDescendants = true) {},
            horizontalAlignment = Alignment.CenterHorizontally,
        ) {
            val app = packageInfo.applicationInfo
            val app = checkNotNull(packageInfo.applicationInfo)
            Box(modifier = Modifier.padding(SettingsDimension.itemPaddingAround)) {
                AppIcon(app = app, size = SettingsDimension.appIconInfoSize)
            }
+1 −1
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ internal fun TogglePermissionAppListModel<out AppRecord>.TogglePermissionAppInfo
        footerContent = footerContent(),
        packageManagers = packageManagers,
    ) {
        val model = createSwitchModel(applicationInfo)
        val model = createSwitchModel(checkNotNull(applicationInfo))
        val restrictions = Restrictions(userId, switchRestrictionKeys)
        RestrictedSwitchPreference(model, restrictions, restrictionsProviderFactory)
    }