All apps visible for android 11-12

Reformat some code
This commit is contained in:
LooKeR 2021-10-10 22:31:20 +05:30
parent 9f8f5cdb7a
commit d4d55b3c21
2 changed files with 12 additions and 7 deletions

View File

@ -8,6 +8,7 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" /> <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<application <application
android:name="com.looker.droidify.MainApplication" android:name="com.looker.droidify.MainApplication"

View File

@ -208,8 +208,9 @@ class ProductFragment() : ScreenFragment(), ProductAdapter.Callbacks {
Intent.CATEGORY_LAUNCHER Intent.CATEGORY_LAUNCHER
), 0 ), 0
) )
.asSequence().mapNotNull { it.activityInfo } .asSequence()
.filter { it.packageName == packageName } .mapNotNull { resolveInfo -> resolveInfo.activityInfo }
.filter { activityInfo -> activityInfo.packageName == packageName }
.mapNotNull { activityInfo -> .mapNotNull { activityInfo ->
val label = try { val label = try {
activityInfo.loadLabel(packageManager).toString() activityInfo.loadLabel(packageManager).toString()
@ -217,7 +218,12 @@ class ProductFragment() : ScreenFragment(), ProductAdapter.Callbacks {
e.printStackTrace() e.printStackTrace()
null null
} }
label?.let { Pair(activityInfo.name, it) } label?.let { labelName ->
Pair(
activityInfo.name,
labelName
)
}
} }
.toList() .toList()
} }
@ -399,8 +405,7 @@ class ProductFragment() : ScreenFragment(), ProductAdapter.Callbacks {
productRepository.second, productRepository.second,
release release
) )
} } else Unit
Unit
} }
ProductAdapter.Action.LAUNCH -> { ProductAdapter.Action.LAUNCH -> {
val launcherActivities = installed?.launcherActivities.orEmpty() val launcherActivities = installed?.launcherActivities.orEmpty()
@ -432,8 +437,7 @@ class ProductFragment() : ScreenFragment(), ProductAdapter.Callbacks {
val binder = downloadConnection.binder val binder = downloadConnection.binder
if (downloading && binder != null) { if (downloading && binder != null) {
binder.cancel(packageName) binder.cancel(packageName)
} } else Unit
Unit
} }
}::class }::class
} }