Debug: persistent URIs

pull/208/head
M66B 3 years ago
parent 2cd47a2700
commit 21df2e4885

@ -26,6 +26,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.UriPermission;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PermissionGroupInfo;
@ -193,6 +194,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private Button btnFontMap;
private Button btnCiphers;
private Button btnFiles;
private Button btnUris;
private Button btnAllPermissions;
private TextView tvPermissions;
@ -367,6 +369,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
btnFontMap = view.findViewById(R.id.btnFontMap);
btnCiphers = view.findViewById(R.id.btnCiphers);
btnFiles = view.findViewById(R.id.btnFiles);
btnUris = view.findViewById(R.id.btnUris);
btnAllPermissions = view.findViewById(R.id.btnAllPermissions);
tvPermissions = view.findViewById(R.id.tvPermissions);
@ -1413,6 +1416,35 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
btnUris.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SpannableStringBuilder ssb = new SpannableStringBuilderEx();
List<UriPermission> permissions = v.getContext().getContentResolver().getPersistedUriPermissions();
for (UriPermission permission : permissions) {
ssb.append(permission.getUri().toString());
ssb.append('\u00a0');
if (permission.isReadPermission())
ssb.append("r");
if (permission.isWritePermission())
ssb.append("w");
ssb.append('\n');
}
new AlertDialog.Builder(v.getContext())
.setIcon(R.drawable.twotone_info_24)
.setTitle(R.string.title_advanced_all_permissions)
.setMessage(ssb)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Do nothing
}
})
.show();
}
});
btnAllPermissions.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

@ -1643,6 +1643,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnCiphers" />
<Button
android:id="@+id/btnUris"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_uris"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnFiles" />
<Button
android:id="@+id/btnAllPermissions"
style="?android:attr/buttonStyleSmall"
@ -1651,7 +1661,7 @@
android:layout_marginTop="12dp"
android:text="@string/title_advanced_all_permissions"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnFiles" />
app:layout_constraintTop_toBottomOf="@id/btnUris" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvPermissions"

@ -786,6 +786,7 @@
<string name="title_advanced_font_map" translatable="false">Font map</string>
<string name="title_advanced_ciphers" translatable="false">Ciphers</string>
<string name="title_advanced_files" translatable="false">Files &gt;%1$s</string>
<string name="title_advanced_uris" translatable="false">URIs</string>
<string name="title_advanced_all_permissions" translatable="false">All permissions</string>
<string name="title_advanced_manual_hint">If receiving messages is disabled, it is still possible to manually receive messages by pulling down the message list</string>

Loading…
Cancel
Save