MCPcopy Create free account
hub / github.com/M66B/FairEmail / getAppInfo

Method getAppInfo

app/src/main/java/eu/faircode/email/DebugHelper.java:264–647  ·  view source on GitHub ↗
(Context context)

Source from the content-addressed store, hash-verified

262 }
263
264 private static StringBuilder getAppInfo(Context context) {
265 StringBuilder sb = new StringBuilder();
266
267 ContentResolver resolver = context.getContentResolver();
268 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
269 boolean main_log = prefs.getBoolean("main_log", true);
270 boolean protocol = prefs.getBoolean("protocol", false);
271 long last_cleanup = prefs.getLong("last_cleanup", 0);
272
273 PackageManager pm = context.getPackageManager();
274
275 int vmajor = 0;
276 int vminor = 0;
277 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) {
278 vmajor = Build.getMajorSdkVersion(Build.VERSION.SDK_INT_FULL);
279 vminor = Build.getMinorSdkVersion(Build.VERSION.SDK_INT_FULL);
280 }
281
282 // Get version info
283 sb.append(String.format("%s %s\r\n", context.getString(R.string.app_name), getVersionInfo(context)));
284 sb.append(String.format("Package: %s uid: %d\r\n",
285 BuildConfig.APPLICATION_ID, android.os.Process.myUid()));
286 sb.append(String.format("Android: %s (SDK device=%d target=%d full=%d.%d)\r\n",
287 Build.VERSION.RELEASE,
288 Build.VERSION.SDK_INT, Helper.getTargetSdk(context),
289 vmajor, vminor));
290
291 String miui = Helper.getMIUIVersion();
292 sb.append(String.format("MIUI: %s\r\n", miui == null ? "-" : miui));
293
294 boolean reporting = prefs.getBoolean("crash_reports", false);
295 String uuid = (reporting || Log.isTestRelease()
296 ? prefs.getString("uuid", null) : null);
297 sb.append(String.format("Bugsnag UUID: %s\r\n", uuid == null ? "-" : uuid));
298
299 try {
300 ApplicationInfo app = pm.getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
301 String build_uuid = app.metaData.getString("com.bugsnag.android.BUILD_UUID");
302 sb.append(String.format("Build UUID: %s\r\n", build_uuid == null ? "-" : build_uuid));
303 } catch (PackageManager.NameNotFoundException ex) {
304 Log.e(ex);
305 }
306
307 String gms = null;
308 try {
309 PackageInfo pi = pm.getPackageInfo("com.google.android.gms", 0);
310 if (pi != null)
311 gms = pi.versionName + " #" + pi.versionCode;
312 } catch (Throwable ignored) {
313 }
314
315 String installer = Helper.getInstallerName(context);
316 sb.append(String.format("Release: %s\r\n", Log.getReleaseType(context)));
317 sb.append(String.format("Play Store: %s Services: %s\r\n", Helper.hasPlayStore(context), gms));
318 sb.append(String.format("Installer: %s\r\n", installer == null ? "-" : installer));
319 sb.append(String.format("Installed: %s\r\n", new Date(Helper.getInstallTime(context))));
320 sb.append(String.format("Updated: %s\r\n", new Date(Helper.getUpdateTime(context))));
321 sb.append(String.format("Last cleanup: %s\r\n", new Date(last_cleanup)));

Callers 1

getDebugInfoMethod · 0.95

Calls 15

getVersionInfoMethod · 0.95
getTargetSdkMethod · 0.95
getMIUIVersionMethod · 0.95
isTestReleaseMethod · 0.95
eMethod · 0.95
getInstallerNameMethod · 0.95
getReleaseTypeMethod · 0.95
hasPlayStoreMethod · 0.95
getInstallTimeMethod · 0.95
getUpdateTimeMethod · 0.95
getSystemServiceMethod · 0.95
isArcMethod · 0.95

Tested by

no test coverage detected