Skip to content

Commit

Permalink
update SDK to 35 (Android 15)
Browse files Browse the repository at this point in the history
  • Loading branch information
thestinger committed Oct 1, 2024
1 parent ffc6181 commit 362b351
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ android {
}
}

compileSdk = 34
compileSdk = 35
buildToolsVersion = "35.0.0"

namespace = "app.grapheneos.apps"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/grapheneos/apps/core/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private fun collectDependencies(dependant: String, dependencies: Array<Dependenc
throw DependencyResolutionException(err)
}
} else {
if (requireEnabled && !pkgInfo.applicationInfo.enabled) {
if (requireEnabled && pkgInfo.applicationInfo?.enabled == false) {
val err = MissingDependencyError(dependant, dep,
if (forUpdate)
MissingDependencyError.REASON_DEPENDENCY_DISABLED_AFTER_INSTALL
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/app/grapheneos/apps/core/InstallTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ class InstallTask(
}

val appInfo = pkgInfo.applicationInfo
if (appInfo == null) {
return false
}

coroutineScope {
val splitSourceDirs = appInfo.splitSourceDirs ?: emptyArray<String>()
Expand Down Expand Up @@ -390,7 +393,8 @@ class InstallTask(
// AndroidManifest too. OS won't run any code from packages that have hasCode="false"
// directive in their manifest
if (apk.pkg.common.noCode) {
if ((pkgInfo.applicationInfo.flags and ApplicationInfo.FLAG_HAS_CODE) != 0) {
val appInfo = pkgInfo.applicationInfo
if (appInfo == null || (appInfo.flags and ApplicationInfo.FLAG_HAS_CODE) != 0) {
throw GeneralSecurityException("${apk.pkg.packageName}: ${apk.name} should have " +
"hasCode=\"false\" attribute in its AndroidManifest")
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/app/grapheneos/apps/core/PackageState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class PackageState(val pkgName: String, val id: Long) {
// Bulk updates are performed by the auto-update job and by the "Update all" button on Updates screen
fun isEligibleForBulkUpdate(): Boolean {
val pi = osPackageInfo
return pi != null && (canUpdateDisabledPackages || pi.applicationInfo.enabled)
return pi != null && (canUpdateDisabledPackages || pi.applicationInfo?.enabled == true)
&& pi.longVersionCode < rPackage.versionCode
&& !rPackage.common.optOutOfBulkUpdates
}
Expand All @@ -154,15 +154,15 @@ class PackageState(val pkgName: String, val id: Long) {
}

val ai = pi.applicationInfo
if (!canUpdateDisabledPackages && !ai.enabled) {
if (!canUpdateDisabledPackages && ai?.enabled == false) {
return Status.DISABLED
}

if (pi.longVersionCode < rPackage.versionCode) {
return Status.OUT_OF_DATE
}

if (!ai.enabled) {
if (ai?.enabled == false) {
return Status.DISABLED
}

Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/app/grapheneos/apps/core/Repo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Repo(json: JSONObject, val eTag: String, val isDummy: Boolean = false) {

if (originalPackage != null) {
pkgManager.getPackageInfoOrNull(originalPackage)?.let {
if (it.applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM != 0) {
if (it.applicationInfo?.flags ?: 0 and ApplicationInfo.FLAG_SYSTEM != 0) {
renamedPackages.put(manifestPackageName, originalPackage)
}
}
Expand Down Expand Up @@ -573,11 +573,12 @@ private fun checkPackageDep(dep: ComplexDependency, repo: Repo, enforceSystemPkg
val manifestPackageName = dep.lhs
val packageName = repo.translateManifestPackageName(manifestPackageName)
val pi = pkgManager.getPackageInfoOrNull(packageName) ?: return false
if (!pi.applicationInfo.enabled) {
val appInfo = pi.applicationInfo ?: return false
if (!appInfo.enabled) {
return false
}
if (enforceSystemPkg) {
if (pi.applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM == 0) {
if (appInfo.flags and ApplicationInfo.FLAG_SYSTEM == 0) {
return false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ fun PackageManager.getSharedLibraries(flags: Long = 0L): List<SharedLibraryInfo>

fun PackageInfo.getVersionNameOrVersionCode() = versionName ?: versionCode.toString()

fun PackageInfo.isSystemPackage() = applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM != 0
fun PackageInfo.isUpdatedSystemPackage() = applicationInfo.flags and ApplicationInfo.FLAG_UPDATED_SYSTEM_APP != 0
fun PackageInfo.isSystemPackage() = applicationInfo?.flags ?: 0 and ApplicationInfo.FLAG_SYSTEM != 0

fun PackageInfo.isUpdatedSystemPackage() = applicationInfo?.flags ?: 0 and ApplicationInfo.FLAG_UPDATED_SYSTEM_APP != 0

fun appDetailsIntent(pkgName: String) = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, packageUri(pkgName))

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ plugins {

allprojects {
tasks.withType<JavaCompile> {
options.compilerArgs.addAll(listOf("-Xlint", "-Xlint:-rawtypes", "-Xlint:-serial"))
options.compilerArgs.addAll(listOf("-Xlint", "-Xlint:-classfile", "-Xlint:-rawtypes", "-Xlint:-serial"))
}
}

0 comments on commit 362b351

Please sign in to comment.