Skip to content

Commit

Permalink
Fix various reported crashes in the app
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamza417 committed Sep 3, 2024
1 parent 1a4a4f2 commit 093de24
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 10 deletions.
1 change: 1 addition & 0 deletions app/src/main/assets/html/changelogs.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ <h4>Bug Fixes</h4>
<li>Fixed an OutOfMemoryError while finding text matches.</li>
<li>Fixed <b>SharedPrefs</b> panel not closing after warning.</li>
<li>Fixed various root button state issues.</li>
<li>Fixed various reported crashes in the app.</li>
</ul>

<h4>Removed</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static void installWriteSessions(int sessionId, File file, Context contex
assert in != null;
in.close();
session.close();
} catch (IOException e) {
} catch (IOException | NullPointerException e) {
e.printStackTrace();
}
}
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/app/simple/inure/apk/parsers/APKParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ object APKParser {
if (stringBuilder.isBlank()) {
stringBuilder.append(context.getString(R.string.error))
}
} catch (e: NullPointerException) {
e.printStackTrace()
if (stringBuilder.isBlank()) {
stringBuilder.append(context.getString(R.string.not_available))
}
} finally {
if (zipFile != null) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class BatchBatteryOptimization : ScopedBottomSheetFragment() {
totalApps.text = getString(
R.string.total_apps,
requireArguments().parcelableArrayList<BatchPackageInfo>
(BundleConstants.batchBatteryOptimization)!!.size.toString())
(BundleConstants.batchBatteryOptimization)!!.size)

optimize.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
Expand Down Expand Up @@ -105,4 +105,4 @@ class BatchBatteryOptimization : ScopedBottomSheetFragment() {
return dialog
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ class Warning : ScopedBottomSheetFragment() {

override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
if (!requireActivity().isDestroyed) {
warningCallbacks?.onWarningDismissed()
try {
if (!requireActivity().isDestroyed) {
warningCallbacks?.onWarningDismissed()
}
} catch (e: IllegalStateException) {
e.printStackTrace()
}
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/app/simple/inure/dialogs/tags/AddedTag.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AddedTag : ScopedBottomSheetFragment() {
}

this.tag.text = requireArguments().getString(BundleConstants.tag)
total.text = requireContext().getString(R.string.total_apps, (tag?.packages?.split(",")?.size ?: 0).toString())
total.text = requireContext().getString(R.string.total_apps, (tag?.packages?.split(",")?.size ?: 0))

recyclerView.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
recyclerView.adapter = AdapterTaggedIcons(tag?.packages?.split(",") ?: listOf())
Expand All @@ -73,4 +73,4 @@ class AddedTag : ScopedBottomSheetFragment() {
return dialog
}
}
}
}
13 changes: 11 additions & 2 deletions app/src/main/java/app/simple/inure/ui/panels/AppInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,12 @@ class AppInfo : ScopedFragment() {
childFragmentManager.newSureInstance().setOnSureCallbackListener(object : SureCallbacks {
override fun onSure() {
childFragmentManager.showUpdatesUninstaller(packageInfo) {
packageInfo = appInfoViewModel.reinitPackageInfo()
try {
packageInfo = appInfoViewModel.reinitPackageInfo()
} catch (e: NameNotFoundException) {
showWarning(e.message ?: getString(R.string.error), goBack = false)
}

appInfoViewModel.loadActionOptions()
}
}
Expand Down Expand Up @@ -639,7 +644,11 @@ class AppInfo : ScopedFragment() {
packageInfo.applicationInfo.enabled,
packageInfo.applicationInfo.sourceDir.toFile())
} catch (e: NullPointerException) {
icon.loadAPKIcon(packageInfo.applicationInfo.sourceDir)
try {
icon.loadAPKIcon(packageInfo.applicationInfo.sourceDir)
} catch (e: NullPointerException) {
icon.setImageResource(R.drawable.ic_app_icon)
}
}

name.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ class AppInfoViewModel(application: Application, private var packageInfo: Packag
}

fun reinitPackageInfo(): PackageInfo {
// FlagUtils.unsetFlag(packageInfo.applicationInfo.flags, ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)
packageInfo = packageManager.getPackageInfo(packageInfo.packageName, PackageManager.GET_META_DATA)
return packageInfo
}
Expand Down
3 changes: 3 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/10066.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Refer to Change Logs under About section of the app to get the detailed list of all changes in this version.

Feel free to join app's Telegram channel for future development updates: https://t.me/inure_app_manager

0 comments on commit 093de24

Please sign in to comment.