mirror of
https://github.com/whyorean/AuroraStore.git
synced 2026-06-16 03:31:02 -04:00
Resolve null-safety errors with newer compileSdk
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -8,10 +8,10 @@ fun PackageInfo.isApp(): Boolean {
|
||||
|
||||
return when {
|
||||
isQAndAbove() -> {
|
||||
Process.isApplicationUid(this.applicationInfo.uid) &&
|
||||
!this.applicationInfo.isResourceOverlay && !this.isApex
|
||||
Process.isApplicationUid(this.applicationInfo!!.uid) &&
|
||||
!this.applicationInfo!!.isResourceOverlay && !this.isApex
|
||||
}
|
||||
isNAndAbove() -> Process.isApplicationUid(this.applicationInfo.uid)
|
||||
else -> this.packageName != null && this.versionName != null
|
||||
isNAndAbove() -> Process.isApplicationUid(this.applicationInfo!!.uid)
|
||||
else -> this.versionName != null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ class AppInstaller @Inject constructor(
|
||||
)
|
||||
val version = PackageInfoCompat.getLongVersionCode(packageInfo)
|
||||
|
||||
packageInfo.applicationInfo.enabled && version >= 9
|
||||
packageInfo.applicationInfo!!.enabled && version >= 9
|
||||
} catch (exception: Exception) {
|
||||
false
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class NativeGsfVersionProvider(context: Context) {
|
||||
try {
|
||||
val packageInfo = getPackageInfo(context, GOOGLE_VENDING_PACKAGE_ID)
|
||||
vendingVersionCode = PackageInfoCompat.getLongVersionCode(packageInfo)
|
||||
vendingVersionString = packageInfo.versionName
|
||||
vendingVersionString = packageInfo.versionName!!
|
||||
} catch (e: PackageManager.NameNotFoundException) {
|
||||
// com.android.vending not found
|
||||
}
|
||||
|
||||
@@ -140,8 +140,8 @@ class ExportWorker @AssistedInject constructor(
|
||||
val packageInfo = getPackageInfo(appContext, packageName, PackageManager.GET_META_DATA)
|
||||
val fileList: MutableList<File?> = mutableListOf()
|
||||
|
||||
fileList.add(File(packageInfo.applicationInfo.sourceDir))
|
||||
packageInfo.applicationInfo.splitSourceDirs?.let { splits ->
|
||||
fileList.add(File(packageInfo.applicationInfo!!.sourceDir))
|
||||
packageInfo.applicationInfo!!.splitSourceDirs?.let { splits ->
|
||||
fileList.addAll(splits.map { File(it) })
|
||||
}
|
||||
|
||||
|
||||
@@ -92,14 +92,14 @@ object CertUtil {
|
||||
return try {
|
||||
val packageInfo = getPackageInfoWithSignature(context, packageName)
|
||||
if (isPAndAbove()) {
|
||||
if (packageInfo.signingInfo.hasMultipleSigners()) {
|
||||
packageInfo.signingInfo.apkContentsSigners.map { it.generateX509Certificate() }
|
||||
if (packageInfo.signingInfo!!.hasMultipleSigners()) {
|
||||
packageInfo.signingInfo!!.apkContentsSigners.map { it.generateX509Certificate() }
|
||||
} else {
|
||||
packageInfo.signingInfo.signingCertificateHistory.map { it.generateX509Certificate() }
|
||||
packageInfo.signingInfo!!.signingCertificateHistory.map { it.generateX509Certificate() }
|
||||
}
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
packageInfo.signatures.map { it.generateX509Certificate() }
|
||||
packageInfo.signatures!!.map { it.generateX509Certificate() }
|
||||
}
|
||||
} catch (exception: Exception) {
|
||||
Log.e(TAG, "Failed to get X509 certificates", exception)
|
||||
|
||||
@@ -150,7 +150,7 @@ object PackageUtil {
|
||||
fun getIconForPackage(context: Context, packageName: String): Bitmap? {
|
||||
return try {
|
||||
val packageInfo = context.packageManager.getPackageInfo(packageName, 0)
|
||||
val icon = packageInfo.applicationInfo.loadIcon(context.packageManager)
|
||||
val icon = packageInfo.applicationInfo!!.loadIcon(context.packageManager)
|
||||
if (icon.intrinsicWidth > 0 && icon.intrinsicHeight > 0) {
|
||||
icon.toBitmap(96, 96)
|
||||
} else {
|
||||
@@ -214,7 +214,7 @@ object PackageUtil {
|
||||
"com.google.toontastic",
|
||||
).contains(it.packageName)
|
||||
}.filter {
|
||||
it.packageName?.contains("com.google") == false
|
||||
!it.packageName.contains("com.google")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ object PackageUtil {
|
||||
}
|
||||
|
||||
if (!isExtendedUpdateEnabled) {
|
||||
packageInfoList = packageInfoList.filter { it.applicationInfo.enabled }
|
||||
packageInfoList = packageInfoList.filter { it.applicationInfo!!.enabled }
|
||||
}
|
||||
|
||||
/*Filter F-Droid apps*/
|
||||
|
||||
@@ -47,7 +47,7 @@ class PermissionBottomSheet : BaseDialogSheet<SheetPermissionsBinding>() {
|
||||
currentPerms = try {
|
||||
packageManager.getPackageInfo(
|
||||
args.app.packageName, PackageManager.GET_PERMISSIONS
|
||||
).requestedPermissions.toList()
|
||||
).requestedPermissions!!.toList()
|
||||
} catch (_: Exception) {
|
||||
emptyList()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user