在Google Chrome开发者工具/调试器中 - >设置 - > Blackboxing可以添加文件以将那些在调试器中弹出的文件列入黑名单。
现在我想用一个通配符一次阻止多个文件。所有要阻止的文件都有前两个相同的字符。
怎么做?即不是" VM $"或者" VM *"工作...
答案 0 :(得分:0)
它们是正则表达式,因此public static final int PERMISSION_RECORD_AUDIO = 1;
public static final int PERMISSION_READ_EXTERNAL_STORAGE = 2;
public static final int PERMISSION_WRITE_EXTERNAL_STORAGE = 3;
public boolean checkPermission(int permission) {
if (ActivityCompat.checkSelfPermission(this, getPermission(permission)) != PackageManager.PERMISSION_GRANTED) {
Debug.e("PERMISSION_CHECK_PERMISSION_FALSE", "-" + permission);
return false;
} else {
Debug.e("PERMISSION_CHECK_PERMISSION_TRUE", "-" + permission);
return true;
}
}
public void requestForPermission(final int permission) {
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
getPermission(permission))) {
Debug.e("PERMISSION_NEEDED", "-" + permission);
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
// Setting Dialog Message
alertDialog.setMessage(getString(R.string.text_permission_rationale));
// Setting Positive "Yes" Button
alertDialog.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
ActivityCompat.requestPermissions(BaseActivity.this, new String[]{getPermission(permission)}, permission);
}
});
alertDialog.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// Write your code here to invoke NO event
dialog.dismiss();
}
});
// Showing Alert Message
alertDialog.show();
} else {
Debug.e("PERMISSION_ALLOW", "-" + permission);
ActivityCompat.requestPermissions(this, new String[]{getPermission(permission)}, permission);
}
// END_INCLUDE(camera_permission_request)
}
@Override
public void onRequestPermissionsResult(final int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// Camera permission has been granted, preview can be displayed
Debug.e("PERMISSION_ALLOWED", "-" + requestCode);
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
// Setting Dialog Message
alertDialog.setMessage(getString(R.string.text_permission_granted));
// Setting Positive "Yes" Button
alertDialog.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
// Showing Alert Message
alertDialog.show();
} else {
Debug.e("PERMISSION_DENIED", "-" + requestCode);
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
// Setting Dialog Message
alertDialog.setMessage(getString(R.string.text_permission_not_granted));
// Setting Positive "Yes" Button
alertDialog.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
// Showing Alert Message
alertDialog.show();
}
}
public String getPermission(int permis) {
String permission = null;
switch (permis) {
case PERMISSION_RECORD_AUDIO:
permission = Manifest.permission.RECORD_AUDIO;
Debug.e("PERMISSION", "-" + permission);
return permission;
case PERMISSION_READ_EXTERNAL_STORAGE:
permission = Manifest.permission.READ_EXTERNAL_STORAGE;
Debug.e("PERMISSION", "-" + permission);
return permission;
case PERMISSION_WRITE_EXTERNAL_STORAGE:
permission = Manifest.permission.WRITE_EXTERNAL_STORAGE;
Debug.e("PERMISSION", "-" + permission);
return permission;
}
return permission;
}
应该有效。