List of usage examples for android.os Build DISPLAY
String DISPLAY
To view the source code for android.os Build DISPLAY.
Click Source Link
From source file:org.zeroxlab.benchmark.Benchmark.java
public String getXMLResult() { if (mCases.size() == 0) return ""; Date date = new Date(); //2010-05-28T17:40:25CST SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz"); String xml = ""; xml += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; xml += "<result"; xml += " executedTimestamp=\"" + sdf.format(date) + "\""; xml += " manufacturer=\"" + Build.MANUFACTURER.replace(' ', '_') + "\""; xml += " model=\"" + Build.MODEL.replace(' ', '_') + ":" + Build.DISPLAY + "\""; xml += " buildTimestamp=\"" + sdf.format(new Date(Build.TIME)) + "\""; xml += " orientation=\"" + Integer.toString(orientation) + "\""; try { // read kernel version BufferedReader procVersion = new BufferedReader(new FileReader("/proc/version")); StringBuffer sbuff = new StringBuffer(); String tmp;//from w w w . j a va 2s . c o m while ((tmp = procVersion.readLine()) != null) sbuff.append(tmp); procVersion.close(); tmp = sbuff.toString().replace("[\n\r]+", " ").replace(" +", "."); xml += " version=\"" + tmp + "\""; } catch (IOException e) { Log.e(TAG, "opening /proc/version failed: " + e.toString()); } try { // read and parse cpu info BufferedReader procVersion = new BufferedReader(new FileReader("/proc/cpuinfo")); StringBuffer sbuff = new StringBuffer(); String tmp; while ((tmp = procVersion.readLine()) != null) sbuff.append(tmp + "\n"); procVersion.close(); tmp = sbuff.toString(); sbuff = new StringBuffer(); Pattern p1 = Pattern.compile("(Processor\\s*:\\s*(.*)\\s*[\n\r]+)"); Matcher m1 = p1.matcher(tmp); if (m1.find()) sbuff.append(m1.group(2)); Pattern p2 = Pattern.compile("(Hardware\\s*:\\s*(.*)\\s*[\n\r]+)"); Matcher m2 = p2.matcher(tmp); if (m2.find()) sbuff.append(":" + m2.group(2)); Pattern p3 = Pattern.compile("(Revision\\s*:\\s*(.*)\\s*[\n\r]+)"); Matcher m3 = p3.matcher(tmp); if (m3.find()) sbuff.append(":" + m3.group(2)); Log.e(TAG, sbuff.toString()); xml += " cpu=\"" + sbuff.toString() + "\""; } catch (IOException e) { Log.e(TAG, "opening /proc/version failed: " + e.toString()); } xml += ">"; Case mycase; for (int i = 0; i < mCases.size(); i++) { mycase = mCases.get(i); xml += mycase.getXMLBenchmark(); } xml += "</result>"; return xml; }
From source file:android_network.hetnet.vpn_service.Util.java
public static void sendLogcat(final Uri uri, final Context context) { AsyncTask task = new AsyncTask<Object, Object, Intent>() { @Override// w w w.j a va 2s. co m protected Intent doInBackground(Object... objects) { StringBuilder sb = new StringBuilder(); sb.append(context.getString(R.string.msg_issue)); sb.append("\r\n\r\n\r\n\r\n"); // Get version info String version = getSelfVersionName(context); sb.append(String.format("NetGuard: %s/%d\r\n", version, getSelfVersionCode(context))); sb.append(String.format("Android: %s (SDK %d)\r\n", Build.VERSION.RELEASE, Build.VERSION.SDK_INT)); sb.append("\r\n"); // Get device info sb.append(String.format("Brand: %s\r\n", Build.BRAND)); sb.append(String.format("Manufacturer: %s\r\n", Build.MANUFACTURER)); sb.append(String.format("Model: %s\r\n", Build.MODEL)); sb.append(String.format("Product: %s\r\n", Build.PRODUCT)); sb.append(String.format("Device: %s\r\n", Build.DEVICE)); sb.append(String.format("Host: %s\r\n", Build.HOST)); sb.append(String.format("Display: %s\r\n", Build.DISPLAY)); sb.append(String.format("Id: %s\r\n", Build.ID)); sb.append(String.format("Fingerprint: %B\r\n", hasValidFingerprint(context))); String abi; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) abi = Build.CPU_ABI; else abi = (Build.SUPPORTED_ABIS.length > 0 ? Build.SUPPORTED_ABIS[0] : "?"); sb.append(String.format("ABI: %s\r\n", abi)); sb.append("\r\n"); sb.append(String.format("VPN dialogs: %B\r\n", isPackageInstalled("com.android.vpndialogs", context))); try { sb.append(String.format("Prepared: %B\r\n", VpnService.prepare(context) == null)); } catch (Throwable ex) { sb.append("Prepared: ").append((ex.toString())).append("\r\n") .append(Log.getStackTraceString(ex)); } sb.append(String.format("Permission: %B\r\n", hasPhoneStatePermission(context))); sb.append("\r\n"); sb.append(getGeneralInfo(context)); sb.append("\r\n\r\n"); sb.append(getNetworkInfo(context)); sb.append("\r\n\r\n"); sb.append(getSubscriptionInfo(context)); sb.append("\r\n\r\n"); // Get settings SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); Map<String, ?> all = prefs.getAll(); for (String key : all.keySet()) sb.append("Setting: ").append(key).append('=').append(all.get(key)).append("\r\n"); sb.append("\r\n"); // Write logcat OutputStream out = null; try { Log.i(TAG, "Writing logcat URI=" + uri); out = context.getContentResolver().openOutputStream(uri); out.write(getLogcat().toString().getBytes()); out.write(getTrafficLog(context).toString().getBytes()); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); sb.append(ex.toString()).append("\r\n").append(Log.getStackTraceString(ex)).append("\r\n"); } finally { if (out != null) try { out.close(); } catch (IOException ignored) { } } // Build intent Intent sendEmail = new Intent(Intent.ACTION_SEND); sendEmail.setType("message/rfc822"); sendEmail.putExtra(Intent.EXTRA_EMAIL, new String[] { "marcel+netguard@faircode.eu" }); sendEmail.putExtra(Intent.EXTRA_SUBJECT, "NetGuard " + version + " logcat"); sendEmail.putExtra(Intent.EXTRA_TEXT, sb.toString()); sendEmail.putExtra(Intent.EXTRA_STREAM, uri); return sendEmail; } @Override protected void onPostExecute(Intent sendEmail) { if (sendEmail != null) try { context.startActivity(sendEmail); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } } }; task.execute(); }
From source file:eu.faircode.netguard.Util.java
public static void sendLogcat(final Uri uri, final Context context) { AsyncTask task = new AsyncTask<Object, Object, Intent>() { @Override/* w w w . j a v a 2 s. c o m*/ protected Intent doInBackground(Object... objects) { StringBuilder sb = new StringBuilder(); sb.append(context.getString(R.string.msg_issue)); sb.append("\r\n\r\n\r\n\r\n"); // Get version info String version = getSelfVersionName(context); sb.append(String.format("NetGuard: %s/%d\r\n", version, getSelfVersionCode(context))); sb.append(String.format("Android: %s (SDK %d)\r\n", Build.VERSION.RELEASE, Build.VERSION.SDK_INT)); sb.append("\r\n"); // Get device info sb.append(String.format("Brand: %s\r\n", Build.BRAND)); sb.append(String.format("Manufacturer: %s\r\n", Build.MANUFACTURER)); sb.append(String.format("Model: %s\r\n", Build.MODEL)); sb.append(String.format("Product: %s\r\n", Build.PRODUCT)); sb.append(String.format("Device: %s\r\n", Build.DEVICE)); sb.append(String.format("Host: %s\r\n", Build.HOST)); sb.append(String.format("Display: %s\r\n", Build.DISPLAY)); sb.append(String.format("Id: %s\r\n", Build.ID)); sb.append(String.format("Fingerprint: %B\r\n", hasValidFingerprint(context))); String abi; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) abi = Build.CPU_ABI; else abi = (Build.SUPPORTED_ABIS.length > 0 ? Build.SUPPORTED_ABIS[0] : "?"); sb.append(String.format("ABI: %s\r\n", abi)); sb.append("\r\n"); sb.append(String.format("VPN dialogs: %B\r\n", isPackageInstalled("com.android.vpndialogs", context))); try { sb.append(String.format("Prepared: %B\r\n", VpnService.prepare(context) == null)); } catch (Throwable ex) { sb.append("Prepared: ").append((ex.toString())).append("\r\n") .append(Log.getStackTraceString(ex)); } sb.append("\r\n"); sb.append(getGeneralInfo(context)); sb.append("\r\n\r\n"); sb.append(getNetworkInfo(context)); sb.append("\r\n\r\n"); // Get DNS sb.append("DNS system:\r\n"); for (String dns : getDefaultDNS(context)) sb.append("- ").append(dns).append("\r\n"); sb.append("DNS VPN:\r\n"); for (InetAddress dns : ServiceSinkhole.getDns(context)) sb.append("- ").append(dns).append("\r\n"); sb.append("\r\n"); // Get TCP connection info String line; BufferedReader in; try { sb.append("/proc/net/tcp:\r\n"); in = new BufferedReader(new FileReader("/proc/net/tcp")); while ((line = in.readLine()) != null) sb.append(line).append("\r\n"); in.close(); sb.append("\r\n"); sb.append("/proc/net/tcp6:\r\n"); in = new BufferedReader(new FileReader("/proc/net/tcp6")); while ((line = in.readLine()) != null) sb.append(line).append("\r\n"); in.close(); sb.append("\r\n"); } catch (IOException ex) { sb.append(ex.toString()).append("\r\n"); } // Get settings SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); Map<String, ?> all = prefs.getAll(); for (String key : all.keySet()) sb.append("Setting: ").append(key).append('=').append(all.get(key)).append("\r\n"); sb.append("\r\n"); // Write logcat OutputStream out = null; try { Log.i(TAG, "Writing logcat URI=" + uri); out = context.getContentResolver().openOutputStream(uri); out.write(getLogcat().toString().getBytes()); out.write(getTrafficLog(context).toString().getBytes()); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); sb.append(ex.toString()).append("\r\n").append(Log.getStackTraceString(ex)).append("\r\n"); } finally { if (out != null) try { out.close(); } catch (IOException ignored) { } } // Build intent Intent sendEmail = new Intent(Intent.ACTION_SEND); sendEmail.setType("message/rfc822"); sendEmail.putExtra(Intent.EXTRA_EMAIL, new String[] { "marcel+netguard@faircode.eu" }); sendEmail.putExtra(Intent.EXTRA_SUBJECT, "NetGuard " + version + " logcat"); sendEmail.putExtra(Intent.EXTRA_TEXT, sb.toString()); sendEmail.putExtra(Intent.EXTRA_STREAM, uri); return sendEmail; } @Override protected void onPostExecute(Intent sendEmail) { if (sendEmail != null) try { context.startActivity(sendEmail); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } } }; task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }
From source file:com.droid.app.fotobot.FotoBot.java
/** * ? ? ? //w ww .j a v a2s .c om * * @param h * @param str */ public void SendMail(Handler h, String str, String fc_str, String bc_video, String fc_video) { // final FotoBot fb = (FotoBot) getApplicationContext(); Mail m = new Mail(getApplicationContext(), EMail_Sender, EMail_Sender_Password, SMTP_Host, SMTP_Port); String[] toArr = { EMail_Recepient }; String s = "Debug-infos:"; s += "\n OS Version: " + System.getProperty("os.version") + "(" + android.os.Build.VERSION.INCREMENTAL + ")"; s += "\n OS API Level: " + android.os.Build.VERSION.SDK_INT; s += "\n Device: " + android.os.Build.DEVICE; s += "\n Model (and Product): " + android.os.Build.MODEL + " (" + android.os.Build.PRODUCT + ")"; s += "\n RELEASE: " + android.os.Build.VERSION.RELEASE; s += "\n BRAND: " + android.os.Build.BRAND; s += "\n DISPLAY: " + android.os.Build.DISPLAY; s += "\n CPU_ABI: " + android.os.Build.CPU_ABI; s += "\n CPU_ABI2: " + android.os.Build.CPU_ABI2; s += "\n UNKNOWN: " + android.os.Build.UNKNOWN; s += "\n HARDWARE: " + android.os.Build.HARDWARE; s += "\n Build ID: " + android.os.Build.ID; s += "\n MANUFACTURER: " + android.os.Build.MANUFACTURER; s += "\n SERIAL: " + android.os.Build.SERIAL; s += "\n USER: " + android.os.Build.USER; s += "\n HOST: " + android.os.Build.HOST; m.setTo(toArr); m.setFrom(EMail_Sender); m.setSubject("Fotobot v" + versionName + " " + Camera_Name); String email_body = ""; email_body = "Fotobot v" + versionName + "\n" + "---------------------------------------------\n" + "Camera Name" + ": " + Camera_Name + "\n" + getResources().getString(R.string.battery_charge) + ": " + battery_level + "%" + "\n" + getResources().getString(R.string.battery_temperature) + ": " + battery_temperature + "C" + "\n"; if (Attached_Info_Detailisation.equals("Normal") || Attached_Info_Detailisation.equals("Detailed")) { email_body = email_body + getResources().getString(R.string.gsm) + ": " + GSM_Signal + "ASU " + (2.0 * GSM_Signal - 113) + "dBm" + "\n" + "-50 -82 dbm - very good" + "\n" + "-83 -86 dbm - good" + "\n" + "-87 -91 dbm - normal" + "\n" + "-92 -95 dbm - bad" + "\n" + "-96 -100 dbm - almost no signal" + "\n" + "---------------------------------------------\n" + "Image Index:" + Image_Index + "\n" + "---------------------------------------------\n" + getResources().getString(R.string.phone_memory) + ":" + "\n" + "totalMemory: " + totalMemory + "\n" + "usedMemory: " + usedMemory + "\n" + "freeMemory: " + freeMemory + "\n" + "---------------------------------------------\n" + getResources().getString(R.string.email_sending_time) + ": " + email_sending_time + "\n" + "---------------------------------------------\n" + getResources().getString(R.string.Fotobot_settings) + ":\n" + "Network_Channel: " + Network_Channel + "\n" + "Network_Connection_Method: " + Network_Connection_Method + "\n" + "Use_Flash: " + Use_Flash + "\n" + "JPEG_Compression: " + JPEG_Compression + "\n" + "Photo_Frequency: " + Photo_Frequency + "\n" + "process_delay: " + process_delay + "\n" + "Image_Scale: " + Image_Scale + "\n" + "Image_Size: " + Image_Size + "\n" + "EMail_Sender: " + EMail_Sender + "\n" + "EMail_Sender_Password: *********" + "\n" + "EMail_Recepient: " + EMail_Recepient + "\n" + "Log_Font_Size: " + Log_Font_Size + "\n" + "Config_Font_Size: " + Config_Font_Size + "\n" + "Photo_Post_Processing_Method: " + Photo_Post_Processing_Method + "\n" + "SMTP_Host: " + SMTP_Host + "\n" + "SMTP_Port: " + SMTP_Port + "\n" + "Log length: " + loglength + "\n" + "FLog length: " + floglength + "\n" + "wake_up_interval: " + wake_up_interval + "\n" + "---------------------------------------------\n" + getResources().getString(R.string.hardware_info) + ":\n" + "Android: " + Build.VERSION.SDK_INT + "\n" + s + "\n" + "---------------------------------------------\n" + "Available SMS commands: " + "\n" + sms_commands_list() + "\n"; ; if (Attached_Info_Detailisation.equals("Detailed")) { email_body = email_body + "\n\n\nActive tasks:\n" + Top + "\n\n\nBack Camera Properties:\n" + Camera_Properties + "\n\n\nFront Camera Properties:\n" + fc_Camera_Properties; } } m.setBody(email_body); File attach_file; if (make_photo_bc && bc_image_attach) { attach_file = new File(str); boolean fileExists = attach_file.isFile(); if (fileExists) { } else { SendMessage("ERROR: image doesn't exist for attaching to email.", MSG_FAIL); } } if (make_video_bc && bc_video_attach) { attach_file = new File(bc_video); boolean fileExists = attach_file.isFile(); if (fileExists) { } else { SendMessage("ERROR: video " + bc_video + " doesn't exist for attaching to email.", MSG_FAIL); } } if (front_camera && make_photo_fc && fc_image_attach) { attach_file = new File(fc_str); boolean fc_fileExists = attach_file.isFile(); if (front_camera && fc_fileExists && make_photo_fc) { } else { SendMessage("ERROR: front camera image doesn't exist for attaching to email.", MSG_FAIL); } } if (front_camera && make_video_fc && fc_video_attach) { attach_file = new File(fc_video); boolean fc_fileExists = attach_file.isFile(); if (front_camera && fc_fileExists && make_photo_fc) { } else { SendMessage("ERROR: video " + fc_video + " doesn't exist for attaching to email.", MSG_FAIL); } } if (attach_log) { attach_file = new File((work_dir + "/logfile.txt")); boolean fileExists = attach_file.isFile(); if (fileExists) { } else { SendMessage("ERROR: log doesn't exist for attaching to email.", MSG_FAIL); } } try { if (make_photo_bc && bc_image_attach) { m.addAttachment(str); } if (front_camera && make_photo_fc && fc_image_attach) { m.addAttachment(fc_str); } if (make_video_bc && bc_image_attach) { m.addAttachment(bc_video); } if (front_camera && make_video_fc && fc_image_attach) { m.addAttachment(fc_video); } if (attach_log) { m.addAttachment(work_dir + "/logfile.txt"); } fbpause(h, process_delay); if (m.send()) { SendMessage(getResources().getString(R.string.foto_sent), MSG_PASS); SaveSettings(); } else { SendMessage("ERROR: ? ", MSG_FAIL); } } catch (Exception e) { SendMessage("Could not send email", MSG_FAIL); Log.e("MailApp", "Could not send email", e); } }
From source file:eu.faircode.adblocker.Util.java
public static void sendLogcat(final Uri uri, final Context context) { AsyncTask task = new AsyncTask<Object, Object, Intent>() { @Override//w w w. j a va 2s . c o m protected Intent doInBackground(Object... objects) { // Get device info StringBuilder sb = new StringBuilder(); String version = getSelfVersionName(context); sb.append(String.format("adblocker: %s/%d\r\n", version, getSelfVersionCode(context))); sb.append(String.format("Android: %s (SDK %d)\r\n", Build.VERSION.RELEASE, Build.VERSION.SDK_INT)); sb.append("\r\n"); sb.append(String.format("Brand: %s\r\n", Build.BRAND)); sb.append(String.format("Manufacturer: %s\r\n", Build.MANUFACTURER)); sb.append(String.format("Model: %s\r\n", Build.MODEL)); sb.append(String.format("Product: %s\r\n", Build.PRODUCT)); sb.append(String.format("Device: %s\r\n", Build.DEVICE)); sb.append(String.format("Host: %s\r\n", Build.HOST)); sb.append(String.format("Display: %s\r\n", Build.DISPLAY)); sb.append(String.format("Id: %s\r\n", Build.ID)); sb.append(String.format("Fingerprint: %B\r\n", hasValidFingerprint(context))); String abi; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) abi = Build.CPU_ABI; else abi = (Build.SUPPORTED_ABIS.length > 0 ? Build.SUPPORTED_ABIS[0] : "?"); sb.append(String.format("ABI: %s\r\n", abi)); sb.append("\r\n"); sb.append(String.format("VPN dialogs: %B\r\n", isPackageInstalled("com.android.vpndialogs", context))); try { sb.append(String.format("Prepared: %B\r\n", VpnService.prepare(context) == null)); } catch (Throwable ex) { sb.append("Prepared: ").append((ex.toString())).append("\r\n") .append(Log.getStackTraceString(ex)); } sb.append(String.format("Permission: %B\r\n", hasPhoneStatePermission(context))); sb.append("\r\n"); sb.append(getGeneralInfo(context)); sb.append("\r\n\r\n"); sb.append(getNetworkInfo(context)); sb.append("\r\n\r\n"); sb.append(getSubscriptionInfo(context)); sb.append("\r\n\r\n"); // Get settings SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); Map<String, ?> all = prefs.getAll(); for (String key : all.keySet()) sb.append("Setting: ").append(key).append('=').append(all.get(key)).append("\r\n"); sb.append("\r\n"); // Finalize message sb.append("Please describe your problem:\r\n"); sb.append("\r\n"); // Write logcat OutputStream out = null; try { Log.i(TAG, "Writing logcat URI=" + uri); out = context.getContentResolver().openOutputStream(uri); out.write(getLogcat().toString().getBytes()); out.write(getTrafficLog(context).toString().getBytes()); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); sb.append(ex.toString()).append("\r\n").append(Log.getStackTraceString(ex)).append("\r\n"); } finally { if (out != null) try { out.close(); } catch (IOException ignored) { } } // Build intent Intent sendEmail = new Intent(Intent.ACTION_SEND); sendEmail.setType("message/rfc822"); sendEmail.putExtra(Intent.EXTRA_EMAIL, new String[] { "marcel+adblocker@faircode.eu" }); sendEmail.putExtra(Intent.EXTRA_SUBJECT, "NetGuard " + version + " logcat"); sendEmail.putExtra(Intent.EXTRA_TEXT, sb.toString()); sendEmail.putExtra(Intent.EXTRA_STREAM, uri); return sendEmail; } @Override protected void onPostExecute(Intent sendEmail) { if (sendEmail != null) try { context.startActivity(sendEmail); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } } }; task.execute(); }
From source file:org.strongswan.android.logic.CharonVpnService.java
/** * Function called via JNI to determine information about the Android version. *///from w w w .ja v a2 s .co m private static String getAndroidVersion() { String version = "Android " + Build.VERSION.RELEASE + " - " + Build.DISPLAY; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { version += "/" + Build.VERSION.SECURITY_PATCH; } return version; }
From source file:com.master.metehan.filtereagle.Util.java
public static void sendLogcat(final Uri uri, final Context context) { AsyncTask task = new AsyncTask<Object, Object, Intent>() { @Override/*from w w w. ja va2 s. c o m*/ protected Intent doInBackground(Object... objects) { StringBuilder sb = new StringBuilder(); sb.append(context.getString(R.string.msg_issue)); sb.append("\r\n\r\n\r\n\r\n"); // Get version info String version = getSelfVersionName(context); sb.append(String.format("FilterEagle: %s/%d\r\n", version, getSelfVersionCode(context))); sb.append(String.format("Android: %s (SDK %d)\r\n", Build.VERSION.RELEASE, Build.VERSION.SDK_INT)); sb.append("\r\n"); // Get device info sb.append(String.format("Brand: %s\r\n", Build.BRAND)); sb.append(String.format("Manufacturer: %s\r\n", Build.MANUFACTURER)); sb.append(String.format("Model: %s\r\n", Build.MODEL)); sb.append(String.format("Product: %s\r\n", Build.PRODUCT)); sb.append(String.format("Device: %s\r\n", Build.DEVICE)); sb.append(String.format("Host: %s\r\n", Build.HOST)); sb.append(String.format("Display: %s\r\n", Build.DISPLAY)); sb.append(String.format("Id: %s\r\n", Build.ID)); sb.append(String.format("Fingerprint: %B\r\n", hasValidFingerprint(context))); String abi; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) abi = Build.CPU_ABI; else abi = (Build.SUPPORTED_ABIS.length > 0 ? Build.SUPPORTED_ABIS[0] : "?"); sb.append(String.format("ABI: %s\r\n", abi)); sb.append("\r\n"); sb.append(String.format("VPN dialogs: %B\r\n", isPackageInstalled("com.android.vpndialogs", context))); try { sb.append(String.format("Prepared: %B\r\n", VpnService.prepare(context) == null)); } catch (Throwable ex) { sb.append("Prepared: ").append((ex.toString())).append("\r\n") .append(Log.getStackTraceString(ex)); } sb.append(String.format("Permission: %B\r\n", hasPhoneStatePermission(context))); sb.append("\r\n"); sb.append(getGeneralInfo(context)); sb.append("\r\n\r\n"); sb.append(getNetworkInfo(context)); sb.append("\r\n\r\n"); sb.append(getSubscriptionInfo(context)); sb.append("\r\n\r\n"); // Get settings SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); Map<String, ?> all = prefs.getAll(); for (String key : all.keySet()) sb.append("Setting: ").append(key).append('=').append(all.get(key)).append("\r\n"); sb.append("\r\n"); // Write logcat OutputStream out = null; try { Log.i(TAG, "Writing logcat URI=" + uri); out = context.getContentResolver().openOutputStream(uri); out.write(getLogcat().toString().getBytes()); out.write(getTrafficLog(context).toString().getBytes()); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); sb.append(ex.toString()).append("\r\n").append(Log.getStackTraceString(ex)).append("\r\n"); } finally { if (out != null) try { out.close(); } catch (IOException ignored) { } } // Build intent Intent sendEmail = new Intent(Intent.ACTION_SEND); sendEmail.setType("message/rfc822"); sendEmail.putExtra(Intent.EXTRA_EMAIL, new String[] { "metehan.ozsoy@gmail.com" }); sendEmail.putExtra(Intent.EXTRA_SUBJECT, "FilterEagle " + version + " logcat"); sendEmail.putExtra(Intent.EXTRA_TEXT, sb.toString()); sendEmail.putExtra(Intent.EXTRA_STREAM, uri); return sendEmail; } @Override protected void onPostExecute(Intent sendEmail) { if (sendEmail != null) try { context.startActivity(sendEmail); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } } }; task.execute(); }
From source file:com.google.android.apps.mytracks.TrackListActivity.java
private void checkPriorExceptions(boolean firstTime) { final File file = new File(FileUtils.buildExternalDirectoryPath("error.log")); if (file != null && file.exists() && file.length() > 0) { String msg = getString(R.string.previous_run_crashed); Builder builder = new AlertDialog.Builder(TrackListActivity.this); // User says no builder.setMessage(msg).setNeutralButton(getString(R.string.donot_send_report), new DialogInterface.OnClickListener() { @Override/* ww w . ja v a 2 s. c om*/ public void onClick(DialogInterface dialog, int which) { // Delete Exceptions File when user presses Ignore if (!file.delete()) Toast.makeText(getApplicationContext(), "Exceptions file not deleted", Toast.LENGTH_LONG).show(); } }); // User says yes builder.setPositiveButton(R.string.send_report, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { Constants.BUGS_MAIL }); //$NON-NLS-1$ intent.setType("vnd.android.cursor.dir/email"); //$NON-NLS-1$ intent.putExtra(Intent.EXTRA_SUBJECT, "nogago Tracks bug"); //$NON-NLS-1$ StringBuilder text = new StringBuilder(); text.append("\nDevice : ").append(Build.DEVICE); //$NON-NLS-1$ text.append("\nBrand : ").append(Build.BRAND); //$NON-NLS-1$ text.append("\nModel : ").append(Build.MODEL); //$NON-NLS-1$ text.append("\nProduct : ").append("Tracks"); //$NON-NLS-1$ text.append("\nBuild : ").append(Build.DISPLAY); //$NON-NLS-1$ text.append("\nVersion : ").append(Build.VERSION.RELEASE); //$NON-NLS-1$ text.append("\nApp Starts : ").append(EulaUtils.getAppStart(TrackListActivity.this)); //$NON-NLS-1$ try { PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 0); if (info != null) { text.append("\nApk Version : ").append(info.versionName).append(" ") //$NON-NLS-1$//$NON-NLS-2$ .append(info.versionCode); } } catch (NameNotFoundException e) { } try { FileReader fr = new FileReader(file); BufferedReader br = new BufferedReader(fr); String line; while (br.read() != -1) { if ((line = br.readLine()) != null) { text.append(line); } } br.close(); fr.close(); } catch (IOException e) { Toast.makeText(getApplicationContext(), "Error reading exceptions file!", Toast.LENGTH_LONG) .show(); } intent.putExtra(Intent.EXTRA_TEXT, text.toString()); startActivity(Intent.createChooser(intent, getString(R.string.send_report))); if (!file.delete()) Toast.makeText(getApplicationContext(), "Exceptions file not deleted", Toast.LENGTH_LONG) .show(); } }); builder.show(); } }
From source file:biz.bokhorst.xprivacy.ActivityMain.java
@SuppressLint("DefaultLocale") private void optionAbout() { // About/* w w w.ja v a 2 s .co m*/ Dialog dlgAbout = new Dialog(this); dlgAbout.requestWindowFeature(Window.FEATURE_LEFT_ICON); dlgAbout.setTitle(R.string.menu_about); dlgAbout.setContentView(R.layout.about); dlgAbout.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher)); // Show version try { int userId = Util.getUserId(Process.myUid()); Version currentVersion = new Version(Util.getSelfVersionName(this)); Version storedVersion = new Version( PrivacyManager.getSetting(userId, PrivacyManager.cSettingVersion, "0.0")); boolean migrated = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingMigrated, false); String versionName = currentVersion.toString(); if (currentVersion.compareTo(storedVersion) != 0) versionName += "/" + storedVersion.toString(); if (!migrated) versionName += "!"; int versionCode = Util.getSelfVersionCode(this); TextView tvVersion = (TextView) dlgAbout.findViewById(R.id.tvVersion); tvVersion.setText(String.format(getString(R.string.app_version), versionName, versionCode)); } catch (Throwable ex) { Util.bug(null, ex); } if (!PrivacyManager.cVersion3 || Hook.isAOSP(19)) ((TextView) dlgAbout.findViewById(R.id.tvCompatibility)).setVisibility(View.GONE); // Show license String licensed = Util.hasProLicense(this); TextView tvLicensed1 = (TextView) dlgAbout.findViewById(R.id.tvLicensed); TextView tvLicensed2 = (TextView) dlgAbout.findViewById(R.id.tvLicensedAlt); if (licensed == null) { tvLicensed1.setText(Environment.getExternalStorageDirectory().getAbsolutePath()); tvLicensed2.setText(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) .getAbsolutePath()); } else { tvLicensed1.setText(String.format(getString(R.string.app_licensed), licensed)); tvLicensed2.setVisibility(View.GONE); } // Show some build properties String android = String.format("%s (%d)", Build.VERSION.RELEASE, Build.VERSION.SDK_INT); ((TextView) dlgAbout.findViewById(R.id.tvAndroid)).setText(android); ((TextView) dlgAbout.findViewById(R.id.build_brand)).setText(Build.BRAND); ((TextView) dlgAbout.findViewById(R.id.build_manufacturer)).setText(Build.MANUFACTURER); ((TextView) dlgAbout.findViewById(R.id.build_model)).setText(Build.MODEL); ((TextView) dlgAbout.findViewById(R.id.build_product)).setText(Build.PRODUCT); ((TextView) dlgAbout.findViewById(R.id.build_device)).setText(Build.DEVICE); ((TextView) dlgAbout.findViewById(R.id.build_host)).setText(Build.HOST); ((TextView) dlgAbout.findViewById(R.id.build_display)).setText(Build.DISPLAY); ((TextView) dlgAbout.findViewById(R.id.build_id)).setText(Build.ID); dlgAbout.setCancelable(true); final int userId = Util.getUserId(Process.myUid()); if (PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFirstRun, true)) dlgAbout.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { Dialog dlgUsage = new Dialog(ActivityMain.this); dlgUsage.requestWindowFeature(Window.FEATURE_LEFT_ICON); dlgUsage.setTitle(R.string.app_name); dlgUsage.setContentView(R.layout.usage); dlgUsage.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher)); dlgUsage.setCancelable(true); dlgUsage.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { PrivacyManager.setSetting(userId, PrivacyManager.cSettingFirstRun, Boolean.FALSE.toString()); optionLegend(); } }); dlgUsage.show(); } }); dlgAbout.show(); }
From source file:org.uguess.android.sysinfo.SiragonManager.java
static void createTextHeader(Context context, StringBuffer sb, String title) { sb.append(title).append("\n"); //$NON-NLS-1$ sb.append(context.getString(R.string.collector_head, context.getString(R.string.app_name), SiragonManager.getVersionName(context.getPackageManager(), context.getPackageName()))); sb.append(context.getString(R.string.device)).append(": ") //$NON-NLS-1$ .append(Build.DEVICE).append('\n').append(context.getString(R.string.model)).append(": ") //$NON-NLS-1$ .append(Build.MODEL).append('\n').append(context.getString(R.string.product)).append(": ") //$NON-NLS-1$ .append(Build.PRODUCT).append('\n').append(context.getString(R.string.brand)).append(": ") //$NON-NLS-1$ .append(Build.BRAND).append('\n').append(context.getString(R.string.release)).append(": ") //$NON-NLS-1$ .append(Build.VERSION.RELEASE).append('\n').append(context.getString(R.string.build)).append(": ") //$NON-NLS-1$ .append(Build.DISPLAY).append('\n').append(context.getString(R.string.locale)).append(": ") //$NON-NLS-1$ .append(Locale.getDefault().toString()).append("\n"); //$NON-NLS-1$ try {//from w w w .ja va 2s. c o m SiragonManager.readRawText(sb, new FileInputStream(SiragonManager.F_VERSION)); sb.append('\n'); } catch (Exception e) { Log.e(LogViewer.class.getName(), e.getLocalizedMessage(), e); } }