-
-
Notifications
You must be signed in to change notification settings - Fork 427
/
OperatingSystem.java
115 lines (94 loc) · 2.98 KB
/
OperatingSystem.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package io.sentry.protocol;
import io.sentry.IUnknownPropertiesConsumer;
import io.sentry.util.CollectionUtils;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
public final class OperatingSystem implements IUnknownPropertiesConsumer, Cloneable {
public static final String TYPE = "os";
/** Name of the operating system. */
private @Nullable String name;
/** Version of the operating system. */
private @Nullable String version;
/**
* Unprocessed operating system info.
*
* <p>An unprocessed description string obtained by the operating system. For some well-known
* runtimes, Sentry will attempt to parse `name` and `version` from this string, if they are not
* explicitly given.
*/
private @Nullable String rawDescription;
/** Internal build number of the operating system. */
private @Nullable String build;
/**
* Current kernel version.
*
* <p>This is typically the entire output of the `uname` syscall.
*/
private @Nullable String kernelVersion;
/** Indicator if the OS is rooted (mobile mostly). */
private @Nullable Boolean rooted;
@SuppressWarnings("unused")
private @Nullable Map<String, @NotNull Object> unknown;
public @Nullable String getName() {
return name;
}
public void setName(final @Nullable String name) {
this.name = name;
}
public @Nullable String getVersion() {
return version;
}
public void setVersion(final @Nullable String version) {
this.version = version;
}
public @Nullable String getRawDescription() {
return rawDescription;
}
public void setRawDescription(final @Nullable String rawDescription) {
this.rawDescription = rawDescription;
}
public @Nullable String getBuild() {
return build;
}
public void setBuild(final @Nullable String build) {
this.build = build;
}
public @Nullable String getKernelVersion() {
return kernelVersion;
}
public void setKernelVersion(final @Nullable String kernelVersion) {
this.kernelVersion = kernelVersion;
}
public @Nullable Boolean isRooted() {
return rooted;
}
public void setRooted(final @Nullable Boolean rooted) {
this.rooted = rooted;
}
@TestOnly
@Nullable
Map<String, Object> getUnknown() {
return unknown;
}
@ApiStatus.Internal
@Override
public void acceptUnknownProperties(final @NotNull Map<String, Object> unknown) {
this.unknown = new ConcurrentHashMap<>(unknown);
}
/**
* Clones an OperatingSystem aka deep copy
*
* @return the cloned OperatingSystem
* @throws CloneNotSupportedException if object is not cloneable
*/
@Override
public @NotNull OperatingSystem clone() throws CloneNotSupportedException {
final OperatingSystem clone = (OperatingSystem) super.clone();
clone.unknown = CollectionUtils.newConcurrentHashMap(unknown);
return clone;
}
}