Debug info: Android permissions

pull/194/head
M66B 4 years ago
parent b367a6e0a0
commit ccd274fe9e

@ -29,6 +29,8 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.sqlite.SQLiteFullException;
@ -1105,7 +1107,7 @@ public class Log {
return true;
while (ex != null) {
for (StackTraceElement ste :stack)
for (StackTraceElement ste : stack)
if (ste.getClassName().startsWith(BuildConfig.APPLICATION_ID))
return true;
ex = ex.getCause();
@ -1478,6 +1480,22 @@ public class Log {
sb.append("\r\n");
try {
PackageInfo pi = context.getPackageManager()
.getPackageInfo(BuildConfig.APPLICATION_ID, PackageManager.GET_PERMISSIONS);
for (int i = 0; i < pi.requestedPermissions.length; i++)
if (pi.requestedPermissions[i] != null &&
pi.requestedPermissions[i].startsWith("android.permission.")) {
boolean granted = ((pi.requestedPermissionsFlags[i] & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0);
sb.append(pi.requestedPermissions[i].replace("android.permission.", ""))
.append('=').append(granted).append("\r\n");
}
} catch (Throwable ex) {
sb.append(ex.toString()).append("\r\n");
}
sb.append("\r\n");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
try {
// https://developer.android.com/reference/android/app/ApplicationExitInfo

Loading…
Cancel
Save