mirror of
https://github.com/M66B/NetGuard.git
synced 2024-12-25 09:21:14 +00:00
parent
2fa687f6d3
commit
163d2f6693
1 changed files with 11 additions and 0 deletions
|
@ -45,6 +45,16 @@ public class Util {
|
|||
return pm.isInteractive();
|
||||
}
|
||||
|
||||
public static boolean isPackageInstalled(String packageName, Context context) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
try {
|
||||
PackageInfo info = pm.getPackageInfo(packageName, 0);
|
||||
} catch (PackageManager.NameNotFoundException ignored) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void toast(final String text, final int length, final Context context) {
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
@Override
|
||||
|
@ -84,6 +94,7 @@ public class Util {
|
|||
sb.insert(0, "\r\n");
|
||||
sb.insert(0, "Please decribe your problem:\r\n");
|
||||
sb.insert(0, "\r\n");
|
||||
sb.insert(0, String.format("VPN dialogs: %b\r\n", isPackageInstalled("com.android.vpndialogs", context)));
|
||||
sb.insert(0, String.format("Id: %s\r\n", Build.ID));
|
||||
sb.insert(0, String.format("Display: %s\r\n", Build.DISPLAY));
|
||||
sb.insert(0, String.format("Host: %s\r\n", Build.HOST));
|
||||
|
|
Loading…
Reference in a new issue