Skip to content

Commit

Permalink
Merge pull request #369
Browse files Browse the repository at this point in the history
android_15_support
  • Loading branch information
Hamza417 authored Oct 31, 2024
2 parents 28bb6bf + 79c5ced commit acb7943
Show file tree
Hide file tree
Showing 114 changed files with 734 additions and 666 deletions.
4 changes: 2 additions & 2 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {

android {

compileSdk 34
compileSdk 35

buildFeatures {
viewBinding false
Expand All @@ -21,7 +21,7 @@ android {
defaultConfig {
applicationId "app.simple.inure"
minSdkVersion 23
targetSdkVersion 34
targetSdkVersion 35
versionCode 10100
versionName "Build101.0.0"
vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import app.simple.inure.R
import app.simple.inure.apk.utils.PackageUtils.isInstalled
import app.simple.inure.apk.utils.PackageUtils.safeApplicationInfo
import app.simple.inure.constants.DebloatSortConstants
import app.simple.inure.constants.SortConstant
import app.simple.inure.decorations.overscroll.VerticalListViewHolder
Expand Down Expand Up @@ -57,7 +58,7 @@ class AdapterDebloat(private val bloats: ArrayList<Bloat>, private val header: B

when (holder) {
is Holder -> {
holder.name.text = bloats[pos].packageInfo.applicationInfo.name
holder.name.text = bloats[pos].packageInfo.safeApplicationInfo.name
// holder.name.setAppVisualStates(bloats[pos].packageInfo)
holder.name.setWarningIcon(isWarning(bloats[pos]))
holder.packageName.text = bloats[pos].packageInfo.packageName
Expand All @@ -76,8 +77,8 @@ class AdapterDebloat(private val bloats: ArrayList<Bloat>, private val header: B

holder.icon.loadAppIcon(
bloats[pos].packageInfo.packageName,
bloats[pos].packageInfo.applicationInfo.enabled,
bloats[pos].packageInfo.applicationInfo.sourceDir.toFile())
bloats[pos].packageInfo.safeApplicationInfo.enabled,
bloats[pos].packageInfo.safeApplicationInfo.sourceDir.toFile())

holder.checkBox.setOnCheckedChangeListener {
bloats[pos].isSelected = it
Expand Down Expand Up @@ -208,7 +209,7 @@ class AdapterDebloat(private val bloats: ArrayList<Bloat>, private val header: B
text = buildString {
// State
if (bloat.packageInfo.isInstalled()) {
if (bloat.packageInfo.applicationInfo.enabled) {
if (bloat.packageInfo.safeApplicationInfo.enabled) {
appendFlag(this@setBloatFlags.context.getString(R.string.enabled))
} else {
appendFlag(this@setBloatFlags.context.getString(R.string.disabled))
Expand Down
5 changes: 3 additions & 2 deletions app/src/github/java/app/simple/inure/sort/DebloatSort.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package app.simple.inure.sort

import app.simple.inure.apk.utils.PackageUtils.safeApplicationInfo
import app.simple.inure.constants.SortConstant
import app.simple.inure.models.Bloat
import app.simple.inure.preferences.DebloatPreferences
Expand All @@ -23,10 +24,10 @@ object DebloatSort {
private fun ArrayList<Bloat>.sortByName() {
when (DebloatPreferences.getSortingStyle()) {
SortConstant.ASCENDING -> {
sortBy { it.packageInfo.applicationInfo.name }
sortBy { it.packageInfo.safeApplicationInfo.name }
}
SortConstant.DESCENDING -> {
sortByDescending { it.packageInfo.applicationInfo.name }
sortByDescending { it.packageInfo.safeApplicationInfo.name }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import app.simple.inure.apk.utils.PackageUtils.isEnabled
import app.simple.inure.apk.utils.PackageUtils.isInstalled
import app.simple.inure.apk.utils.PackageUtils.safeApplicationInfo
import app.simple.inure.constants.DebloatSortConstants
import app.simple.inure.constants.SortConstant
import app.simple.inure.constants.Warnings
Expand Down Expand Up @@ -104,12 +105,12 @@ class DebloatViewModel(application: Application) : RootShizukuViewModel(applicat
when (DebloatPreferences.getApplicationType()) {
SortConstant.SYSTEM -> {
bloats = bloats.parallelStream().filter { b ->
b.packageInfo.applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM != 0
b.packageInfo.safeApplicationInfo.flags and ApplicationInfo.FLAG_SYSTEM != 0
}.collect(Collectors.toList()) as ArrayList<Bloat>
}
SortConstant.USER -> {
bloats = bloats.parallelStream().filter { b ->
b.packageInfo.applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM == 0
b.packageInfo.safeApplicationInfo.flags and ApplicationInfo.FLAG_SYSTEM == 0
}.collect(Collectors.toList()) as ArrayList<Bloat>
}
}
Expand Down Expand Up @@ -155,12 +156,12 @@ class DebloatViewModel(application: Application) : RootShizukuViewModel(applicat
when (DebloatPreferences.getApplicationType()) {
SortConstant.SYSTEM -> {
bloats = bloats.parallelStream().filter { b ->
b.packageInfo.applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM != 0
b.packageInfo.safeApplicationInfo.flags and ApplicationInfo.FLAG_SYSTEM != 0
}.collect(Collectors.toList()) as ArrayList<Bloat>
}
SortConstant.USER -> {
bloats = bloats.parallelStream().filter { b ->
b.packageInfo.applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM == 0
b.packageInfo.safeApplicationInfo.flags and ApplicationInfo.FLAG_SYSTEM == 0
}.collect(Collectors.toList()) as ArrayList<Bloat>
}
}
Expand All @@ -177,8 +178,8 @@ class DebloatViewModel(application: Application) : RootShizukuViewModel(applicat
bloats.getSortedList()

bloats = bloats.parallelStream().filter { bloat ->
bloat.packageInfo.applicationInfo.name.contains(keyword, true) ||
bloat.packageInfo.applicationInfo.packageName.contains(keyword, true) ||
bloat.packageInfo.safeApplicationInfo.name.contains(keyword, true) ||
bloat.packageInfo.safeApplicationInfo.packageName.contains(keyword, true) ||
bloat.description.contains(keyword, true) ||
bloat.list.contains(keyword, true) ||
bloat.dependencies.contains(keyword) ||
Expand Down Expand Up @@ -375,7 +376,7 @@ class DebloatViewModel(application: Application) : RootShizukuViewModel(applicat

parallelStream().forEach {
if (FlagUtils.isFlagSet(state, DebloatSortConstants.DISABLED)) {
if (it.packageInfo.applicationInfo.enabled.not() && it.packageInfo.isInstalled()) {
if (it.packageInfo.safeApplicationInfo.enabled.not() && it.packageInfo.isInstalled()) {
synchronized(filteredList) {
if (filteredList.contains(it).invert()) {
filteredList.add(it)
Expand All @@ -385,7 +386,7 @@ class DebloatViewModel(application: Application) : RootShizukuViewModel(applicat
}

if (FlagUtils.isFlagSet(state, DebloatSortConstants.ENABLED)) {
if (it.packageInfo.applicationInfo.enabled && it.packageInfo.isInstalled()) {
if (it.packageInfo.safeApplicationInfo.enabled && it.packageInfo.isInstalled()) {
synchronized(filteredList) {
if (filteredList.contains(it).invert()) {
filteredList.add(it)
Expand Down Expand Up @@ -455,9 +456,9 @@ class DebloatViewModel(application: Application) : RootShizukuViewModel(applicat
bloats.forEach {
Shell.cmd(getCommand(method, user, it.id)).exec().let { result ->
if (result.isSuccess) {
debloatedPackages.add(PackageStateResult(it.packageInfo.applicationInfo.name, it.id, true))
debloatedPackages.add(PackageStateResult(it.packageInfo.safeApplicationInfo.name, it.id, true))
} else {
debloatedPackages.add(PackageStateResult(it.packageInfo.applicationInfo.name, it.id, false))
debloatedPackages.add(PackageStateResult(it.packageInfo.safeApplicationInfo.name, it.id, false))
}
}
}
Expand All @@ -477,37 +478,37 @@ class DebloatViewModel(application: Application) : RootShizukuViewModel(applicat
METHOD_UNINSTALL -> {
getShizukuService().simpleExecute(getCommand(method, user, bloat.id)).let { result ->
if (result.isSuccess) {
debloatedPackages.add(PackageStateResult(bloat.packageInfo.applicationInfo.name, bloat.id, true))
debloatedPackages.add(PackageStateResult(bloat.packageInfo.safeApplicationInfo.name, bloat.id, true))
} else {
debloatedPackages.add(PackageStateResult(bloat.packageInfo.applicationInfo.name, bloat.id, false))
debloatedPackages.add(PackageStateResult(bloat.packageInfo.safeApplicationInfo.name, bloat.id, false))
}
}
}
METHOD_DISABLE -> {
kotlin.runCatching {
ShizukuUtils.setAppDisabled(bloat.packageInfo.applicationInfo.enabled, setOf(bloat.packageInfo.packageName))
ShizukuUtils.setAppDisabled(bloat.packageInfo.safeApplicationInfo.enabled, setOf(bloat.packageInfo.packageName))
}.onSuccess {
debloatedPackages.add(PackageStateResult(bloat.packageInfo.applicationInfo.name, bloat.id, true))
debloatedPackages.add(PackageStateResult(bloat.packageInfo.safeApplicationInfo.name, bloat.id, true))
}.getOrElse {
debloatedPackages.add(PackageStateResult(bloat.packageInfo.applicationInfo.name, bloat.id, false))
debloatedPackages.add(PackageStateResult(bloat.packageInfo.safeApplicationInfo.name, bloat.id, false))
}
}
METHOD_RESTORE -> {
getShizukuService().simpleExecute(getCommand(method, user, bloat.id)).let { result ->
if (result.isSuccess) {
if (bloat.packageInfo.isEnabled()) {
debloatedPackages.add(PackageStateResult(bloat.packageInfo.applicationInfo.name, bloat.id, true))
debloatedPackages.add(PackageStateResult(bloat.packageInfo.safeApplicationInfo.name, bloat.id, true))
} else {
kotlin.runCatching {
ShizukuUtils.setAppDisabled(bloat.packageInfo.applicationInfo.enabled, setOf(bloat.packageInfo.packageName))
ShizukuUtils.setAppDisabled(bloat.packageInfo.safeApplicationInfo.enabled, setOf(bloat.packageInfo.packageName))
}.onSuccess {
debloatedPackages.add(PackageStateResult(bloat.packageInfo.applicationInfo.name, bloat.id, true))
debloatedPackages.add(PackageStateResult(bloat.packageInfo.safeApplicationInfo.name, bloat.id, true))
}.getOrElse {
debloatedPackages.add(PackageStateResult(bloat.packageInfo.applicationInfo.name, bloat.id, false))
debloatedPackages.add(PackageStateResult(bloat.packageInfo.safeApplicationInfo.name, bloat.id, false))
}
}
} else {
debloatedPackages.add(PackageStateResult(bloat.packageInfo.applicationInfo.name, bloat.id, false))
debloatedPackages.add(PackageStateResult(bloat.packageInfo.safeApplicationInfo.name, bloat.id, false))
}
}
}
Expand All @@ -517,7 +518,7 @@ class DebloatViewModel(application: Application) : RootShizukuViewModel(applicat
}
}.getOrElse {
it.printStackTrace()
debloatedPackages.add(PackageStateResult(bloat.packageInfo.applicationInfo.name, bloat.id, false))
debloatedPackages.add(PackageStateResult(bloat.packageInfo.safeApplicationInfo.name, bloat.id, false))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import app.simple.inure.apk.utils.PackageData.getInstallerDir
import app.simple.inure.apk.utils.PackageData.getOtherCacheDir
import app.simple.inure.apk.utils.PackageUtils
import app.simple.inure.apk.utils.PackageUtils.getPackageArchiveInfo
import app.simple.inure.apk.utils.PackageUtils.safeApplicationInfo
import app.simple.inure.extensions.activities.BaseActivity
import app.simple.inure.ui.panels.AppInfo
import app.simple.inure.util.FileUtils
Expand Down Expand Up @@ -51,8 +52,8 @@ class AppInformationActivity : BaseActivity() {
sourceFile.absolutePath.lowercase().endsWith(".apk") -> { // Single APK
packageInfo = packageManager.getPackageArchiveInfo(sourceFile.absolutePath)!!

packageInfo.applicationInfo.publicSourceDir = sourceFile.absolutePath
packageInfo.applicationInfo.sourceDir = sourceFile.absolutePath
packageInfo.safeApplicationInfo.publicSourceDir = sourceFile.absolutePath
packageInfo.safeApplicationInfo.sourceDir = sourceFile.absolutePath
}
sourceFile.absolutePath.endsWith(".apks") ||
sourceFile.absolutePath.endsWith(".xapk") ||
Expand All @@ -72,20 +73,20 @@ class AppInformationActivity : BaseActivity() {

for (file in copiedFile.path.substringBeforeLast(".").toFile().listFiles()!!) {
packageInfo = packageManager.getPackageArchiveInfo(file.absolutePath.toFile()) ?: continue
packageInfo!!.applicationInfo.sourceDir = file.absolutePath
packageInfo!!.applicationInfo.publicSourceDir = file.absolutePath
packageInfo!!.safeApplicationInfo.sourceDir = file.absolutePath
packageInfo!!.safeApplicationInfo.publicSourceDir = file.absolutePath
break
}
}
}
else -> {
packageInfo = PackageInfo() // empty package info
packageInfo!!.applicationInfo = ApplicationInfo() // empty application info
packageInfo!!.applicationInfo.sourceDir = sourceFile.absolutePath
packageInfo!!.safeApplicationInfo = ApplicationInfo() // empty application info
packageInfo!!.safeApplicationInfo.sourceDir = sourceFile.absolutePath
}
}

packageInfo!!.applicationInfo.name = PackageUtils.getApplicationName(baseContext, packageInfo!!.applicationInfo)
packageInfo!!.safeApplicationInfo.name = PackageUtils.getApplicationName(baseContext, packageInfo!!.safeApplicationInfo)
packageInfo!!.versionName = PackageUtils.getApplicationVersion(baseContext, packageInfo!!)

withContext(Dispatchers.Main) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.lifecycle.lifecycleScope
import app.simple.inure.R
import app.simple.inure.apk.utils.PackageData.getInstallerDir
import app.simple.inure.apk.utils.PackageUtils
import app.simple.inure.apk.utils.PackageUtils.safeApplicationInfo
import app.simple.inure.extensions.activities.BaseActivity
import app.simple.inure.ui.viewers.Information
import app.simple.inure.util.FileUtils
Expand Down Expand Up @@ -52,11 +53,11 @@ class InformationActivity : BaseActivity() {
packageManager.getPackageArchiveInfo(sourceFile.absolutePath, PackageUtils.flags.toInt())!!
}

packageInfo.applicationInfo.sourceDir = sourceFile.absolutePath
packageInfo.safeApplicationInfo.sourceDir = sourceFile.absolutePath
} else {
packageInfo = PackageInfo() // empty package info
packageInfo.applicationInfo = ApplicationInfo() // empty application info
packageInfo.applicationInfo.sourceDir = sourceFile.absolutePath
packageInfo.safeApplicationInfo = ApplicationInfo() // empty application info
packageInfo.safeApplicationInfo.sourceDir = sourceFile.absolutePath
}

withContext(Dispatchers.Main) {
Expand Down
Loading

0 comments on commit acb7943

Please sign in to comment.