Skip to content

Commit

Permalink
remove API permission need in AndroidManifest.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
iamr0s committed May 5, 2023
1 parent a765924 commit baddbae
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 37 deletions.
2 changes: 1 addition & 1 deletion api
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ android {
applicationId = "com.rosan.dhizuku"
minSdk = 21
targetSdk = 33
versionCode = 4
versionName = "2.1"
versionCode = 5
versionName = "2.2"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
16 changes: 1 addition & 15 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@

<uses-sdk tools:overrideLibrary="rikka.shizuku.api, rikka.shizuku.provider, rikka.shizuku.shared, rikka.shizuku.aidl" />

<permission-group
android:name="com.rosan.dhizuku.permission-group.API"
android:description="@string/dhizuku_permission_group_dsp"
android:label="@string/dhizuku_permission_group_label" />

<permission
android:name="com.rosan.dhizuku.permission.API"
android:description="@string/dhizuku_permission_api_dsp"
android:icon="@mipmap/ic_launcher"
android:label="@string/dhizuku_permission_api_label"
android:protectionLevel="normal" />

<application
android:name=".App"
android:allowBackup="true"
Expand All @@ -56,7 +44,6 @@
android:excludeFromRecents="true"
android:exported="true"
android:launchMode="singleInstance"
android:permission="com.rosan.dhizuku.permission.API"
android:theme="@style/Theme.Dhizuku.Translucent">
<intent-filter>
<action android:name="${applicationId}.action.request.permission" />
Expand All @@ -70,8 +57,7 @@
android:directBootAware="true"
android:enabled="true"
android:exported="true"
android:permission="com.rosan.dhizuku.permission.API"
tools:ignore="UnusedAttribute" />
tools:ignore="ExportedContentProvider,UnusedAttribute" />

<receiver
android:name=".server.DhizukuDAReceiver"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.rosan.dhizuku.ui.page.settings.config

import android.content.Context
import android.content.pm.PackageManager
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
Expand Down Expand Up @@ -69,24 +68,6 @@ class ConfigViewModel(
)
}
}
val packages =
packageManager.getInstalledPackages(PackageManager.GET_PERMISSIONS or PackageManager.GET_ACTIVITIES)
packages.forEach { packageInfo ->
packageInfo.requestedPermissions?.forEach {
if (it == "com.rosan.dhizuku.permission.API") {
val applicationInfo = packageInfo.applicationInfo
val uid = applicationInfo.uid
val data = map[uid]
map[uid] = ConfigViewState.Data(
uid = uid,
packageName = packageInfo.packageName,
label = applicationInfo.loadLabel(packageManager).toString(),
icon = applicationInfo.loadIcon(packageManager),
allowApi = data?.allowApi ?: false
)
}
}
}
state = ConfigViewState(data = map.values.sortedBy {
it.uid
})
Expand Down

0 comments on commit baddbae

Please sign in to comment.