Skip to content

Commit

Permalink
Fix a crash on Android 13
Browse files Browse the repository at this point in the history
  • Loading branch information
Mygod committed Apr 8, 2023
1 parent f7824f6 commit 2d016ab
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {

dependencies {
implementation(project(":lib"))
implementation("androidx.activity:activity:1.6.1")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.0")
implementation("androidx.activity:activity:1.7.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test:runner:1.5.2")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ plugins {
val androidGradleVersion = "7.4.2"
id("com.android.application") version androidGradleVersion apply false
id("com.android.library") version androidGradleVersion apply false
id("com.github.ben-manes.versions") version "0.44.0"
id("org.jetbrains.kotlin.android") version "1.8.10" apply false
id("com.github.ben-manes.versions") version "0.46.0"
id("org.jetbrains.kotlin.android") version "1.8.20" apply false
}

buildscript {
dependencies {
classpath("com.vanniktech:gradle-maven-publish-plugin:0.24.0")
classpath("com.vanniktech:gradle-maven-publish-plugin:0.25.1")
}
}
1 change: 1 addition & 0 deletions lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ android {

dependencies {
api("androidx.collection:collection-ktx:1.2.0")
api("androidx.core:core:1.10.0")
api("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test:runner:1.5.2")
Expand Down
14 changes: 8 additions & 6 deletions lib/src/main/java/be/mygod/librootkotlinx/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ package be.mygod.librootkotlinx

import android.annotation.SuppressLint
import android.content.Context
import android.os.Build
import android.os.Parcel
import android.os.Parcelable
import android.system.ErrnoException
import android.system.OsConstants
import android.util.*
import android.util.Size
import android.util.SizeF
import android.util.SparseBooleanArray
import android.util.SparseIntArray
import android.util.SparseLongArray
import androidx.annotation.RequiresApi
import androidx.core.os.ParcelCompat
import kotlinx.parcelize.Parcelize
import java.io.IOException
import java.util.*
import java.util.Locale

class NoShellException(cause: Throwable) : Exception("Root missing", cause)

Expand Down Expand Up @@ -250,9 +254,7 @@ inline fun <reified T : Parcelable> ByteArray.toParcelable(classLoader: ClassLoa
useParcel { p ->
p.unmarshall(this, 0, size)
p.setDataPosition(0)
if (Build.VERSION.SDK_INT < 33) @Suppress("DEPRECATION") {
p.readParcelable(classLoader)
} else p.readParcelable(classLoader, T::class.java)
ParcelCompat.readParcelable(p, classLoader, T::class.java)
}

// Stream closed caused in NullOutputStream
Expand Down

0 comments on commit 2d016ab

Please sign in to comment.