|
| 1 | +/* |
| 2 | + * This file is part of HyperCeiler. |
| 3 | + * |
| 4 | + * HyperCeiler is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU Affero General Public License as |
| 6 | + * published by the Free Software Foundation, either version 3 of the |
| 7 | + * License. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU Affero General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU Affero General Public License |
| 15 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 16 | + * |
| 17 | + * Copyright (C) 2023-2024 HyperCeiler Contributions |
| 18 | + */ |
| 19 | + |
| 20 | +package com.sevtinge.hyperceiler.data; |
| 21 | + |
| 22 | +import android.app.ApplicationErrorReport.CrashInfo; |
| 23 | +import android.os.Parcel; |
| 24 | +import android.os.Parcelable; |
| 25 | + |
| 26 | +import androidx.annotation.NonNull; |
| 27 | + |
| 28 | +public class AppCrashInfo implements Parcelable { |
| 29 | + |
| 30 | + /** |
| 31 | + * The name of the exception handler that is installed. |
| 32 | + * @hide |
| 33 | + */ |
| 34 | + public String exceptionHandlerClassName; |
| 35 | + |
| 36 | + /** |
| 37 | + * Class name of the exception that caused the crash. |
| 38 | + */ |
| 39 | + public String exceptionClassName; |
| 40 | + |
| 41 | + /** |
| 42 | + * Message stored in the exception. |
| 43 | + */ |
| 44 | + public String exceptionMessage; |
| 45 | + |
| 46 | + /** |
| 47 | + * File which the exception was thrown from. |
| 48 | + */ |
| 49 | + public String throwFileName; |
| 50 | + |
| 51 | + /** |
| 52 | + * Class which the exception was thrown from. |
| 53 | + */ |
| 54 | + public String throwClassName; |
| 55 | + |
| 56 | + /** |
| 57 | + * Method which the exception was thrown from. |
| 58 | + */ |
| 59 | + public String throwMethodName; |
| 60 | + |
| 61 | + /** |
| 62 | + * Line number the exception was thrown from. |
| 63 | + */ |
| 64 | + public int throwLineNumber; |
| 65 | + |
| 66 | + /** |
| 67 | + * Stack trace. |
| 68 | + */ |
| 69 | + public String stackTrace; |
| 70 | + |
| 71 | + /** |
| 72 | + * Crash tag for some context. |
| 73 | + * @hide |
| 74 | + */ |
| 75 | + public String crashTag; |
| 76 | + |
| 77 | + public static final Creator<AppCrashInfo> CREATOR = new Creator<>() { |
| 78 | + @Override |
| 79 | + public AppCrashInfo createFromParcel(Parcel in) { |
| 80 | + return new AppCrashInfo(in); |
| 81 | + } |
| 82 | + |
| 83 | + @Override |
| 84 | + public AppCrashInfo[] newArray(int size) { |
| 85 | + return new AppCrashInfo[size]; |
| 86 | + } |
| 87 | + }; |
| 88 | + |
| 89 | + public AppCrashInfo() {} |
| 90 | + |
| 91 | + public AppCrashInfo(CrashInfo info) { |
| 92 | + exceptionMessage = info.exceptionMessage; |
| 93 | + throwMethodName = info.throwMethodName; |
| 94 | + throwFileName = info.throwFileName; |
| 95 | + exceptionClassName = info.exceptionClassName; |
| 96 | + throwClassName = info.throwClassName; |
| 97 | + throwLineNumber = info.throwLineNumber; |
| 98 | + stackTrace = info.stackTrace; |
| 99 | + } |
| 100 | + |
| 101 | + protected AppCrashInfo(Parcel in) { |
| 102 | + exceptionHandlerClassName = in.readString(); |
| 103 | + exceptionClassName = in.readString(); |
| 104 | + exceptionMessage = in.readString(); |
| 105 | + throwFileName = in.readString(); |
| 106 | + throwClassName = in.readString(); |
| 107 | + throwMethodName = in.readString(); |
| 108 | + throwLineNumber = in.readInt(); |
| 109 | + stackTrace = in.readString(); |
| 110 | + crashTag = in.readString(); |
| 111 | + } |
| 112 | + |
| 113 | + @Override |
| 114 | + public void writeToParcel(@NonNull Parcel dest, int flags) { |
| 115 | + dest.writeString(exceptionHandlerClassName); |
| 116 | + dest.writeString(exceptionClassName); |
| 117 | + dest.writeString(exceptionMessage); |
| 118 | + dest.writeString(throwFileName); |
| 119 | + dest.writeString(throwClassName); |
| 120 | + dest.writeString(throwMethodName); |
| 121 | + dest.writeInt(throwLineNumber); |
| 122 | + dest.writeString(stackTrace); |
| 123 | + dest.writeString(crashTag); |
| 124 | + } |
| 125 | + |
| 126 | + @Override |
| 127 | + public int describeContents() { |
| 128 | + return 0; |
| 129 | + } |
| 130 | + |
| 131 | + public String getExceptionHandlerClassName() { |
| 132 | + return exceptionHandlerClassName; |
| 133 | + } |
| 134 | + |
| 135 | + public void setExceptionHandlerClassName(String exceptionHandlerClassName) { |
| 136 | + this.exceptionHandlerClassName = exceptionHandlerClassName; |
| 137 | + } |
| 138 | + |
| 139 | + public String getExceptionClassName() { |
| 140 | + return exceptionClassName; |
| 141 | + } |
| 142 | + |
| 143 | + public void setExceptionClassName(String exceptionClassName) { |
| 144 | + this.exceptionClassName = exceptionClassName; |
| 145 | + } |
| 146 | + |
| 147 | + public String getExceptionMessage() { |
| 148 | + return exceptionMessage; |
| 149 | + } |
| 150 | + |
| 151 | + public void setExceptionMessage(String exceptionMessage) { |
| 152 | + this.exceptionMessage = exceptionMessage; |
| 153 | + } |
| 154 | + |
| 155 | + public String getThrowFileName() { |
| 156 | + return throwFileName; |
| 157 | + } |
| 158 | + |
| 159 | + public void setThrowFileName(String throwFileName) { |
| 160 | + this.throwFileName = throwFileName; |
| 161 | + } |
| 162 | + |
| 163 | + public String getThrowClassName() { |
| 164 | + return throwClassName; |
| 165 | + } |
| 166 | + |
| 167 | + public void setThrowClassName(String throwClassName) { |
| 168 | + this.throwClassName = throwClassName; |
| 169 | + } |
| 170 | + |
| 171 | + public String getThrowMethodName() { |
| 172 | + return throwMethodName; |
| 173 | + } |
| 174 | + |
| 175 | + public void setThrowMethodName(String throwMethodName) { |
| 176 | + this.throwMethodName = throwMethodName; |
| 177 | + } |
| 178 | + |
| 179 | + public int getThrowLineNumber() { |
| 180 | + return throwLineNumber; |
| 181 | + } |
| 182 | + |
| 183 | + public void setThrowLineNumber(int throwLineNumber) { |
| 184 | + this.throwLineNumber = throwLineNumber; |
| 185 | + } |
| 186 | + |
| 187 | + public String getStackTrace() { |
| 188 | + return stackTrace; |
| 189 | + } |
| 190 | + |
| 191 | + public void setStackTrace(String stackTrace) { |
| 192 | + this.stackTrace = stackTrace; |
| 193 | + } |
| 194 | + |
| 195 | + public String getCrashTag() { |
| 196 | + return crashTag; |
| 197 | + } |
| 198 | + |
| 199 | + public void setCrashTag(String crashTag) { |
| 200 | + this.crashTag = crashTag; |
| 201 | + } |
| 202 | +} |
0 commit comments