Android Open Source - androiddevice.info Error






From Project

Back to project page androiddevice.info.

License

The source code is released under:

GNU General Public License

If you think the Android project androiddevice.info listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package info.androiddevice.deviceinventory;
/* w  w w  .j  a v a  2 s . co m*/
import android.content.Context;
import android.content.pm.PackageInfo;
import android.os.Build;

import java.util.HashMap;
import java.util.LinkedHashMap;

public class Error {
    String packagename;
    String versionname;
    String versioncode;
    String model;
    String androidversion;
    String board;
    String device;
    String brand;
    String stacktrace;

    public Error(PackageInfo packageinfo, Throwable exception) {
        packagename = packageinfo.packageName;
        versionname = packageinfo.versionName;
        versioncode = Integer.toString(packageinfo.versionCode);
        model = Build.MODEL;
        androidversion = Build.VERSION.RELEASE;
        board = Build.BOARD;
        device = Build.DEVICE;
        brand = Build.BRAND;
        stacktrace = getStacktrace(exception);
    }

    private String getStacktrace(Throwable exception) {
        Throwable current = exception;
        StringBuilder result = new StringBuilder();

        do {
            result.append(current.toString() + "\n");
            for(StackTraceElement elem : current.getStackTrace()) {
                result.append(" at " + elem.toString() + "\n");
            }

            current = current.getCause();
            if(current != null) {
                result.append("\n");
                result.append("Caused by:\n");
                result.append("\n");
            }
        } while(current != null);
        return result.toString();
    }

    @Override
    public String toString() {
        return "Error{" +
                "packagename='" + packagename + '\'' +
                ", versionname='" + versionname + '\'' +
                ", versioncode='" + versioncode + '\'' +
                ", model='" + model + '\'' +
                ", androidversion='" + androidversion + '\'' +
                ", board='" + board + '\'' +
                ", device='" + device + '\'' +
                ", brand='" + brand + '\'' +
                ", stacktrace='" + stacktrace + '\'' +
                '}';
    }
}




Java Source Code List

android.system.ErrnoException.java
android.system.Os.java
android.system.StructStat.java
info.androiddevice.deviceinventory.Application.java
info.androiddevice.deviceinventory.DeviceInformation.java
info.androiddevice.deviceinventory.Error.java
info.androiddevice.deviceinventory.info.CpuinfoProperty.java
info.androiddevice.deviceinventory.info.DirProperty.java
info.androiddevice.deviceinventory.info.DisplayProperty.java
info.androiddevice.deviceinventory.info.EnvironmentProperty.java
info.androiddevice.deviceinventory.info.FeaturesProperty.java
info.androiddevice.deviceinventory.info.FileProperty.java
info.androiddevice.deviceinventory.info.GetPropProperty.java
info.androiddevice.deviceinventory.info.JavaSystemProperty.java
info.androiddevice.deviceinventory.info.MeminfoProperty.java
info.androiddevice.deviceinventory.info.MountsProperty.java
info.androiddevice.deviceinventory.info.NameProperty.java
info.androiddevice.deviceinventory.info.OtacertsProperty.java
info.androiddevice.deviceinventory.info.PackageSigProperty.java
info.androiddevice.deviceinventory.info.Property.java
info.androiddevice.deviceinventory.info.SharedLibraryNamesProperty.java
info.androiddevice.deviceinventory.info.UsbProperty.java
info.androiddevice.deviceinventory.info.Utils.java
info.androiddevice.deviceinventory.info.VersionProperty.java
info.androiddevice.deviceinventory.submission.DeviceInformationListAdapter.java
info.androiddevice.deviceinventory.submission.MainActivity.java
libcore.io.ErrnoException.java
libcore.io.Libcore.java
libcore.io.Os.java
libcore.io.StructStat.java
name.unused.android.utils.systemproperties.SystemProperty.java
name.unused.android.utils.systemproperties.exception.NoSuchPropertyException.java