Skip to content

Commit

Permalink
Build: Update compile SDK, build tools and NDK
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanghai committed Sep 10, 2024
1 parent 114e0fd commit 42eed80
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ apply plugin: 'com.google.firebase.crashlytics'

android {
namespace 'me.zhanghai.android.files'
buildToolsVersion = '34.0.0'
compileSdk 34
ndkVersion '26.3.11579264'
buildToolsVersion = '35.0.0'
compileSdk 35
ndkVersion '27.1.12297006'
defaultConfig {
applicationId 'me.zhanghai.android.files'
minSdk 21
// Not supporting notification runtime permission yet.
// Not supporting foreground service timeout yet.
//noinspection OldTargetApi
targetSdk 34
versionCode 39
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class VideoFrameFetcher(
} else {
outBitmap.width == width && outBitmap.height == height
}
val isValidConfig = !outBitmap.config.isHardware || options.config.isHardware
val isValidConfig = outBitmap.config?.isHardware != true || options.config.isHardware
val bitmap = if (isValidSize && isValidConfig) {
outBitmap
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ class ApkInfoLiveData(path: Path) : PathObserverLiveData<Stateful<ApkInfo>>(path
val signingCertificates = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
// PackageInfo.signatures returns only the oldest certificate if there are
// past certificates on P and above for compatibility.
packageInfo.signingInfo.apkContentsSigners ?: emptyArray()
packageInfo.signingInfo?.apkContentsSigners
} else {
@Suppress("DEPRECATION")
packageInfo.signatures
}
} ?: emptyArray()
val signingCertificateDigests = signingCertificates
.map { it.toByteArray().sha1Digest().toHexString() }
val pastSigningCertificates =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
val signingInfo = packageInfo.signingInfo
// SigningInfo.getSigningCertificateHistory() may return the current
// certificate if there are no past certificates.
if (signingInfo.hasPastSigningCertificates()) {
if (signingInfo?.hasPastSigningCertificates() == true) {
// SigningInfo.getSigningCertificateHistory() also returns the
// current certificate.
signingInfo.signingCertificateHistory?.toMutableList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class FilePropertiesApkTabFragment : FilePropertiesTabFragment() {
packageInfo.longVersionCodeCompat
)
)
val applicationInfo = packageInfo.applicationInfo
val applicationInfo = packageInfo.applicationInfo!!
// PackageParser didn't return minSdkVersion before N, so it's hard to implement a
// compat version.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Expand Down Expand Up @@ -77,7 +77,7 @@ class FilePropertiesApkTabFragment : FilePropertiesTabFragment() {
} else {
{
PermissionListDialogFragment.show(
packageInfo.requestedPermissions, this@FilePropertiesApkTabFragment
packageInfo.requestedPermissions!!, this@FilePropertiesApkTabFragment
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import android.annotation.SuppressLint
import android.content.pm.PackageManager
import android.content.pm.Signature
import com.google.firebase.crashlytics.FirebaseCrashlytics
import java.security.MessageDigest
import java.security.NoSuchAlgorithmException
import me.zhanghai.android.files.BuildConfig
import me.zhanghai.android.files.app.application
import me.zhanghai.android.files.app.packageManager
import me.zhanghai.android.files.util.getPackageInfoOrNull
import java.security.MessageDigest
import java.security.NoSuchAlgorithmException

object CrashlyticsInitializer {
private val HEX_CHARS = "0123456789ABCDEF".toCharArray()
Expand All @@ -39,9 +39,10 @@ object CrashlyticsInitializer {
val packageInfo = packageManager.getPackageInfoOrNull(
application.packageName, PackageManager.GET_SIGNATURES
) ?: return false
return packageInfo.signatures.size == 1
&& computeCertificateFingerprint(packageInfo.signatures[0]) == ("87:3B:9B:60:C7:7C:F7"
+ ":F3:CD:5F:AE:66:D0:FE:11:2C:4A:86:97:3E:11:8E:E8:A2:9C:34:6C:4C:67:3C:97:F0")
val signatures = packageInfo.signatures ?: return false
return signatures.size == 1 &&
computeCertificateFingerprint(signatures[0]) == "87:3B:9B:60:C7:7C:F7:F3:CD:5F:AE:66" +
":D0:FE:11:2C:4A:86:97:3E:11:8E:E8:A2:9C:34:6C:4C:67:3C:97:F0"
}

private fun computeCertificateFingerprint(certificate: Signature): String {
Expand Down

0 comments on commit 42eed80

Please sign in to comment.