Example usage for android.os Build DEVICE

List of usage examples for android.os Build DEVICE

Introduction

In this page you can find the example usage for android.os Build DEVICE.

Prototype

String DEVICE

To view the source code for android.os Build DEVICE.

Click Source Link

Document

The name of the industrial design.

Usage

From source file:RhodesService.java

public static Object getProperty(String name) {
    try {// w  w  w  . j  a  v a2  s.  c om
        if (name.equalsIgnoreCase("platform"))
            return "ANDROID";
        else if (name.equalsIgnoreCase("locale"))
            return getCurrentLocale();
        else if (name.equalsIgnoreCase("country"))
            return getCurrentCountry();
        else if (name.equalsIgnoreCase("screen_width"))
            return Integer.valueOf(getScreenWidth());
        else if (name.equalsIgnoreCase("screen_height"))
            return Integer.valueOf(getScreenHeight());
        else if (name.equalsIgnoreCase("screen_orientation")) {
            int orientation = getScreenOrientation();
            if ((orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)
                    || (orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE))
                return "landscape";
            else
                return "portrait";
        } else if (name.equalsIgnoreCase("has_network"))
            return Boolean.valueOf(hasNetwork());
        else if (name.equalsIgnoreCase("has_wifi_network"))
            return Boolean.valueOf(hasWiFiNetwork());
        else if (name.equalsIgnoreCase("has_cell_network"))
            return Boolean.valueOf(hasCellNetwork());
        else if (name.equalsIgnoreCase("ppi_x"))
            return Float.valueOf(getScreenPpiX());
        else if (name.equalsIgnoreCase("ppi_y"))
            return Float.valueOf(getScreenPpiY());
        else if (name.equalsIgnoreCase("phone_number")) {
            Context context = ContextFactory.getContext();
            String number = "";
            if (context != null) {
                TelephonyManager manager = (TelephonyManager) context
                        .getSystemService(Context.TELEPHONY_SERVICE);
                number = manager.getLine1Number();
                Logger.I(TAG, "Phone number: " + number + "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
            }
            return number;
        } else if (name.equalsIgnoreCase("device_owner_name")) {
            return AndroidFunctionalityManager.getAndroidFunctionality()
                    .AccessOwnerInfo_getUsername(getContext());
        } else if (name.equalsIgnoreCase("device_owner_email")) {
            return AndroidFunctionalityManager.getAndroidFunctionality().AccessOwnerInfo_getEmail(getContext());
        } else if (name.equalsIgnoreCase("device_name")) {
            return Build.MANUFACTURER + " " + Build.DEVICE;
        } else if (name.equalsIgnoreCase("is_emulator")) {
            String strDevice = Build.DEVICE;
            return Boolean.valueOf(strDevice != null && strDevice.equalsIgnoreCase("generic"));
        } else if (name.equalsIgnoreCase("os_version")) {
            return Build.VERSION.RELEASE;
        } else if (name.equalsIgnoreCase("has_calendar")) {
            return Boolean.valueOf(EventStore.hasCalendar());
        } else if (name.equalsIgnoreCase("phone_id")) {
            RhodesService service = RhodesService.getInstance();
            if (service != null) {
                PhoneId phoneId = service.getPhoneId();
                return phoneId.toString();
            } else {
                return "";
            }
        } else if (name.equalsIgnoreCase("webview_framework")) {
            return RhodesActivity.safeGetInstance().getMainView().getWebView(-1).getEngineId();
        } else if (name.equalsIgnoreCase("is_motorola_device")) {
            return isMotorolaDevice();
        } else if (name.equalsIgnoreCase("oem_info")) {
            return Build.PRODUCT;
        } else if (name.equalsIgnoreCase("uuid")) {
            return fetchUUID();
        } else if (name.equalsIgnoreCase("has_camera")) {
            return Boolean.TRUE;
        } else {
            return RhoExtManager.getImplementationInstance().getProperty(name);
        }
    } catch (Exception e) {
        Logger.E(TAG, "Can't get property \"" + name + "\": " + e);
    }

    return null;
}

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/*from   w w w  .  ja  v  a2  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(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  a2  s .  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("\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

/**
 *   ?  ? ? /*from w ww  .  jav  a 2 s  .  co  m*/
 *
 * @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  ww  .  jav  a2s.  co 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: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 ww. j  a  va 2s . 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.mobilyzer.util.PhoneUtils.java

private String getDeviceId() {
    String deviceId = null;/*from  www. j  a v  a 2  s  .  c o  m*/
    if (ContextCompat.checkSelfPermission(context,
            Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
        // This ID is permanent to a physical phone.
        deviceId = telephonyManager.getDeviceId();
    }

    // "generic" means the emulator.
    if (deviceId == null || Build.DEVICE.equals("generic")) {

        // This ID changes on OS reinstall/factory reset.
        deviceId = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
    }

    return deviceId;
}

From source file:de.mkrtchyan.recoverytools.RecoveryTools.java

public void report(final boolean isCancelable) {
    final Dialog reportDialog = mNotifyer.createDialog(R.string.commentar, R.layout.dialog_comment, false,
            true);/*from   w  w  w.  jav a2 s  .  c  om*/
    new Thread(new Runnable() {
        @Override
        public void run() {
            /** Creates a report Email including a Comment and important device infos */
            final Button bGo = (Button) reportDialog.findViewById(R.id.bGo);
            bGo.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {

                    if (!Common.getBooleanPref(mContext, PREF_NAME, PREF_KEY_ADS))
                        Toast.makeText(mContext, R.string.please_ads, Toast.LENGTH_SHORT).show();
                    Toast.makeText(mContext, R.string.donate_to_support, Toast.LENGTH_SHORT).show();
                    try {
                        ArrayList<File> files = new ArrayList<File>();
                        File TestResults = new File(mContext.getFilesDir(), "results.txt");
                        try {
                            if (TestResults.exists()) {
                                if (TestResults.delete()) {
                                    FileOutputStream fos = openFileOutput(TestResults.getName(),
                                            Context.MODE_PRIVATE);
                                    fos.write(("Recovery-Tools:\n\n"
                                            + mShell.execCommand(
                                                    "ls -lR " + PathToRecoveryTools.getAbsolutePath())
                                            + "\nCache Tree:\n" + mShell.execCommand("ls -lR /cache") + "\n"
                                            + "\nMTD result:\n" + mShell.execCommand("cat /proc/mtd") + "\n"
                                            + "\nDevice Tree:\n\n" + mShell.execCommand("ls -lR /dev"))
                                                    .getBytes());
                                }
                                files.add(TestResults);
                            }
                        } catch (FileNotFoundException e) {
                            e.printStackTrace();
                        }
                        if (getPackageManager() != null) {
                            PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
                            EditText text = (EditText) reportDialog.findViewById(R.id.etComment);
                            String comment = "";
                            if (text.getText() != null)
                                comment = text.getText().toString();
                            Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
                            intent.setType("text/plain");
                            intent.putExtra(Intent.EXTRA_EMAIL,
                                    new String[] { "ashotmkrtchyan1995@gmail.com" });
                            intent.putExtra(Intent.EXTRA_SUBJECT, "Recovery-Tools report");
                            intent.putExtra(Intent.EXTRA_TEXT, "Package Infos:" + "\n\nName: "
                                    + pInfo.packageName + "\nVersionName: " + pInfo.versionName
                                    + "\nVersionCode: " + pInfo.versionCode + "\n\n\nProduct Info: "
                                    + "\n\nManufacture: " + android.os.Build.MANUFACTURER + "\nDevice: "
                                    + Build.DEVICE + " (" + mDevice.getDeviceName() + ")" + "\nBoard: "
                                    + Build.BOARD + "\nBrand: " + Build.BRAND + "\nModel: " + Build.MODEL
                                    + "\nFingerprint: " + Build.FINGERPRINT + "\nAndroid SDK Level: "
                                    + Build.VERSION.CODENAME + " (" + Build.VERSION.SDK_INT + ")"
                                    + "\nRecovery Supported: " + mDevice.isRecoverySupported()
                                    + "\nRecovery Path: " + mDevice.getRecoveryPath() + "\nRecovery Version: "
                                    + mDevice.getRecoveryVersion() + "\nRecovery MTD: "
                                    + mDevice.isRecoveryMTD() + "\nRecovery DD: " + mDevice.isRecoveryDD()
                                    + "\nKernel Supported: " + mDevice.isKernelSupported() + "\nKernel Path: "
                                    + mDevice.getKernelPath() + "\nKernel Version: "
                                    + mDevice.getKernelVersion() + "\nKernel MTD: " + mDevice.isKernelMTD()
                                    + "\nKernel DD: " + mDevice.isKernelDD() + "\n\nCWM: "
                                    + mDevice.isCwmSupported() + "\nTWRP: " + mDevice.isTwrpSupported()
                                    + "\nPHILZ: " + mDevice.isPhilzSupported()
                                    + "\n\n\n===========COMMENT==========\n" + comment
                                    + "\n===========COMMENT END==========\n" + "\n===========PREFS==========\n"
                                    + getAllPrefs() + "\n===========PREFS END==========\n");
                            File CommandLogs = new File(mContext.getFilesDir(), Shell.Logs);
                            if (CommandLogs.exists()) {
                                files.add(CommandLogs);
                            }
                            files.add(new File(getFilesDir(), "last_log.txt"));
                            ArrayList<Uri> uris = new ArrayList<Uri>();
                            for (File file : files) {
                                mShell.execCommand("cp " + file.getAbsolutePath() + " "
                                        + new File(mContext.getFilesDir(), file.getName()).getAbsolutePath());
                                file = new File(mContext.getFilesDir(), file.getName());
                                mToolbox.setFilePermissions(file, "644");
                                uris.add(Uri.fromFile(file));
                            }
                            intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
                            startActivity(Intent.createChooser(intent, "Send over Gmail"));
                            reportDialog.dismiss();
                        }
                    } catch (Exception e) {
                        reportDialog.dismiss();
                        Notifyer.showExceptionToast(mContext, TAG, e);
                    }
                }
            });
        }
    }).start();
    reportDialog.setCancelable(isCancelable);
    reportDialog.show();
}

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//from ww  w  .j  a v a  2s .c o m
                    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:com.plusot.senselib.SenseMain.java

@SuppressWarnings("deprecation")
public void onPopupResult(int dialogId, int viewId, int iWhich, int itemsSize, String sWhich, String sTag) { // , int tag) {
    switch (dialogId) {
    case VALUE_POPUP:
        switch (iWhich) {
        /*case 0:/*from   ww  w .j  av a2s .c o  m*/
           showPopupDialog(VALUESELECT_POPUP, viewId, null); // , 0);
           break;*/
        case 0:
            showMultiChoiceDialog(VALUESELECT_POPUP, viewId);
            break;
        case 1:
            //            if (SenseGlobals.isLite) 
            //               showLiteWarning();
            //            else 
            if (PreferenceKey.VOICEON.isTrue())
                showMultiChoiceDialog(SPEECHSELECT_POPUP, viewId);
            else
                warnNoSpeech();
            break;
        case 2:
            if (popupValue == null) {
                popupValue = viewGetCurrentValue(viewId);
            }
            if (popupValue != null) {
                final String[] units = Unit.getValidUnits(popupValue.getValueType().getUnitType(), this);
                showPopupDialog(UNIT_POPUP, viewId, units);
            }
            break;
        case 3:
            if (sWhich.equals(getString(R.string.calibrate))) {
                calibrate();
            } else if (sWhich.equals(getString(R.string.set_level))) {
                if (Manager.managers.get(ManagerType.SENSOR_MANAGER) == null)
                    return;
                ((AndroidSensorManager) Manager.managers.get(ManagerType.SENSOR_MANAGER)).setLevel();
                ToastHelper.showToastLong(R.string.level_message);
            }
            break;
        }
        break;
    case UNIT_POPUP:
        final Unit unit = Unit.getUnitByChoiceString(sWhich, this);
        if (popupValue != null) {
            popupValue.setUnit(unit);
        }
        break;
    case VALUESELECT_POPUP:
        viewSetValue(viewId, Value.getValueByString(this, sWhich));
        ToastHelper.showToastShort(getString(R.string.hint_long_click));
        saveConfiguration();
        break;
    case YEAR_POPUP:
        logYear = sWhich;
        showPopupDialog(MONTH_POPUP, viewId, null); // , 0);
        break;
    case MONTH_POPUP:
        logMonth = logMonths[iWhich];
        LLog.d(Globals.TAG, CLASSTAG + ".showPopupDialog: logMonth = " + logMonth);
        showPopupDialog(DAY_POPUP, viewId, null); // , 0);
        break;
    case DAY_POPUP:
        logDay = logDays[iWhich];

        if (fileExplorer != null) {
            switch (fileExplorer.getTag()) {
            case FileExplorer.ACTIVITY_TAG:
                showPopupDialog(TIMES_POPUP, viewId, null);
                break;
            }
        }
        break;
    case TIMES_POPUP:
        if (fileExplorer != null) {
            switch (fileExplorer.getTag()) {
            case FileExplorer.ACTIVITY_TAG:
                stopActivity("onPopupResult", false);
                ToastHelper.showToastLong(getString(R.string.chosen_file) + " = " + logDay + " "
                        + DateUtils.getMonthString(logMonth - 1, DateUtils.LENGTH_LONG) + " " + logYear + " "
                        + sWhich);

                DataLog dataLog = DataLog.getInstance();
                if (dataLog != null) {
                    String file = fileExplorer.getFileList(logYear, logMonth, logDay, sWhich);
                    if (file != null) {
                        SenseGlobals.replaySession = logYear + String.format("%02d%02d", logMonth, logDay) + "-"
                                + sWhich.substring(0, 2) + sWhich.substring(3, 5) + sWhich.substring(6, 8);
                        LLog.d(Globals.TAG,
                                CLASSTAG + ".onPopupResult: ReplaySession = " + SenseGlobals.replaySession);
                        dataLog.readCsv(new String[] { file }, this);
                    }
                }
                //               if (showMap) showLocation();
                break;
            }
        }
        break;
    case STEP_POPUP:
        switch (step) {
        case 0:
            argosRecovery = 6 + iWhich;
            step = 1;
            showPopupDialog(STEP_POPUP, VIEW_ID_BASE + viewsAdded - 1, null);
            break;
        case 1:
            LLog.d(Globals.TAG, CLASSTAG + ".onPopuResult: STEP1SETTINGS_POPUP = " + iWhich);
            //ActivityUtil.lockScreenOrientation(this);
            switch (iWhich) {
            case 0:
                startActivityForResult(new Intent(this, BikeSettingsActivity.class), RESULT_STEP1);
                break;
            case 1:
                startActivityForResult(new Intent(SenseMain.this, AntSettingsActivity.class), RESULT_STEP1);
                break;
            case 2:
                startActivityForResult(new Intent(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS),
                        RESULT_STEP1);
                break;
            default:
                //enableAnt();
                step = 2;
                showPopupDialog(STEP_POPUP, VIEW_ID_BASE + viewsAdded - 1, null);
                break;
            }
            break;
        case 2:
            if (iWhich == startOptions - 1)
                startUpDialogs("STEP2START_POPUP");
            else {
                View view = this.findViewById(R.id.main_layout);
                if (view != null)
                    view.setVisibility(View.VISIBLE);

                if (iWhich >= 0 && iWhich <= startOptions - 3)
                    startActivity(iWhich == startOptions - 3);
                stepsDone = true;
            }
            lastAskForActivityStart = System.currentTimeMillis();
            break;
        }
        break;
    case MOVESTART_POPUP:
        moveStartBusy = false;
        lastAskForActivityStart = System.currentTimeMillis();
    case START_POPUP:
        if (iWhich >= 0 && iWhich <= itemsSize - 2)
            startActivity(iWhich == itemsSize - 2);

        break;
    case ARGOSSTOP_POPUP:
        switch (argosStopStep) {
        case 0:
            SimpleLog.getInstance(SimpleLogType.TEXT, ARGOS_MENTALSTATEFILE).log("recovery=" + argosRecovery);
            SimpleLog.getInstance(SimpleLogType.TEXT, ARGOS_MENTALSTATEFILE).log("intensity=" + (6 + iWhich));
            argosStopStep = 1;
            showPopupDialog(ARGOSSTOP_POPUP, VIEW_ID_BASE + viewsAdded - 1, null);

            break;
        case 1:
            SimpleLog.getInstance(SimpleLogType.TEXT, ARGOS_MENTALSTATEFILE).log("fitness=" + (6 + iWhich));
            new InputDialog(this, 666, R.string.remarkspopup_title, R.string.remarkspopup_description, "",
                    R.string.remarkspopup_hint, new InputDialog.Listener() {

                        @Override
                        public void onClose(int id, String temp) {
                            SimpleLog.getInstance(SimpleLogType.TEXT, ARGOS_MENTALSTATEFILE)
                                    .log("remark=" + temp);
                            argosStopStep = 2;
                            new SleepAndWake(new SleepAndWake.Listener() {
                                @Override
                                public void onWake() {
                                    shouldFinish = (shouldFinish == 1) ? 2 : 0;
                                    sendMail(true);
                                }
                            }, 100);
                        }
                    }).show();
            break;
        }
        break;

    case FULLSTOP_POPUP:
        lastAskForActivityStart = System.currentTimeMillis();

        if (iWhich == 0) {
            ToastHelper.showToastLong(R.string.toast_pause);
            pauseActivity("onPopupResult");
            finishIt();
        } else {
            stopActivity("onPopupResult", true);
        }
        //         if (dialogId == FULLSTOP_POPUP) finishIt();

        break;
    case STOP_POPUP:
        lastAskForActivityStart = System.currentTimeMillis();
        if (iWhich == 0) {
            ToastHelper.showToastLong(R.string.toast_pause);
            pauseActivity("onPopupResult");
        } else {
            stopActivity("onPopupResult", false);
        }
        break;
    case SHARE_POPUP:
        switch (iWhich) {
        case 0:
            this.sendMail(false);
            break;
        case 1:
            //            if (SenseGlobals.isLite) {
            //               this.showLiteWarning();
            //            } else 
            if (!PreferenceKey.HTTPPOST.isTrue())
                showTweetWarning();
            else {
                String link = getString(R.string.tweet_msg, Globals.TAG,
                        PreferenceKey.SHARE_URL.getString() + "?device=" + SenseUserInfo.getDeviceId(),
                        TimeUtil.formatTime(System.currentTimeMillis(), "EEE dd MMM HH:mm:ss"));
                int session = HttpSender.getSession();
                if (session >= 0)
                    link += "&session=" + session;
                new Tweet(this, null).send(link);
            }
            break;
        case 2:
            //            if (SenseGlobals.isLite)
            //               this.showLiteWarning();
            //            else
            this.sendTP();
            break;
        case 3:
            if (!Value.fileTypes.contains(FileType.FIT)) {
                this.warnNoFit();
                break;
            }
            switch (new SendStravaMail(this).send()) {
            case SUCCES:
                break;
            case NOACCOUNT:
                this.warnAccount();
                break;
            case NOFILES:
                this.warnNoFilesToday();
                break;
            }
            break;
        case 4:
            StringBuffer buf = new StringBuffer();
            buf.append("\nApp version: " + UserInfo.appNameVersion() + "\n");
            buf.append("Android version: " + Build.VERSION.RELEASE + "\n");
            buf.append("Android incremental: " + Build.VERSION.INCREMENTAL + "\n");
            buf.append("Android SDK: " + Build.VERSION.SDK_INT + "\n");
            //buf.append("FINGERPRINT: "+Build.FINGERPRINT+ "\n");
            buf.append("Device manufacturer: " + Build.MANUFACTURER + "\n");
            buf.append("Device brand: " + Build.BRAND + "\n");
            buf.append("Device model: " + Build.MODEL + "\n");
            buf.append("Device board: " + Build.BOARD + "\n");
            buf.append("Device id: " + Build.DEVICE);

            new LogMail(this,
                    getString(R.string.reportmail, TimeUtil.formatTime(System.currentTimeMillis()), buf),
                    getString(R.string.mail_sending), getString(R.string.no_mail_to_send), null);
        }
        break;
    case INTERVAL_POPUP:
        switch (iWhich) {
        case 0:
            newInterval();
            break;
        case 1:
            new LapsDialog(this, Laps.getLaps() - 1, false).show();
        }
        break;
    case GPX_POPUP:
        ToastHelper.showToastLong(getString(R.string.get_gpx_file, sWhich + " " + sTag));
        getGPX(sTag);
        break;
    }

}