ui: show all apps with internet permission in exclusions list
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
a300f269f1
commit
4fae2d1255
@ -4,8 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.wireguard.android.fragment
|
package com.wireguard.android.fragment
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
@ -40,12 +40,11 @@ class AppListDialogFragment : DialogFragment() {
|
|||||||
try {
|
try {
|
||||||
val applicationData: MutableList<ApplicationData> = ArrayList()
|
val applicationData: MutableList<ApplicationData> = ArrayList()
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val launcherIntent = Intent(Intent.ACTION_MAIN, null)
|
val packageInfos = pm.getPackagesHoldingPermissions(arrayOf(Manifest.permission.INTERNET), 0)
|
||||||
launcherIntent.addCategory(Intent.CATEGORY_LAUNCHER)
|
packageInfos.forEach {
|
||||||
val resolveInfos = pm.queryIntentActivities(launcherIntent, 0)
|
val packageName = it.packageName
|
||||||
resolveInfos.forEach {
|
val appInfo = it.applicationInfo
|
||||||
val packageName = it.activityInfo.packageName
|
val appData = ApplicationData(appInfo.loadIcon(pm), appInfo.loadLabel(pm).toString(), packageName, currentlySelectedApps.contains(packageName))
|
||||||
val appData = ApplicationData(it.loadIcon(pm), it.loadLabel(pm).toString(), packageName, currentlySelectedApps.contains(packageName))
|
|
||||||
applicationData.add(appData)
|
applicationData.add(appData)
|
||||||
appData.addOnPropertyChangedCallback(object : Observable.OnPropertyChangedCallback() {
|
appData.addOnPropertyChangedCallback(object : Observable.OnPropertyChangedCallback() {
|
||||||
override fun onPropertyChanged(sender: Observable?, propertyId: Int) {
|
override fun onPropertyChanged(sender: Observable?, propertyId: Int) {
|
||||||
|
Loading…
Reference in New Issue
Block a user