use of com.intellij.openapi.application.ApplicationInfo in project android by JetBrains.
the class AndroidStudioUsageTracker method runDailyReports.
private static void runDailyReports() {
ApplicationInfo application = ApplicationInfo.getInstance();
UsageTracker.getInstance().log(AndroidStudioEvent.newBuilder().setCategory(AndroidStudioEvent.EventCategory.PING).setKind(AndroidStudioEvent.EventKind.STUDIO_PING).setProductDetails(ProductDetails.newBuilder().setProduct(ProductDetails.ProductKind.STUDIO).setBuild(application.getBuild().asString()).setVersion(application.getStrictVersion()).setOsArchitecture(CommonMetricsData.getOsArchitecture()).setChannel(lifecycleChannelFromUpdateSettings())).setMachineDetails(CommonMetricsData.getMachineDetails(new File(PathManager.getHomePath()))).setJvmDetails(CommonMetricsData.getJvmDetails()));
}
use of com.intellij.openapi.application.ApplicationInfo in project flutter-intellij by flutter.
the class FlutterInitializer method getAnalytics.
@NotNull
public static Analytics getAnalytics() {
if (analytics == null) {
final PropertiesComponent properties = PropertiesComponent.getInstance();
String clientId = properties.getValue(analyticsClientIdKey);
if (clientId == null) {
clientId = UUID.randomUUID().toString();
properties.setValue(analyticsClientIdKey, clientId);
}
final IdeaPluginDescriptor descriptor = PluginManager.getPlugin(FlutterUtils.getPluginId());
assert descriptor != null;
final ApplicationInfo info = ApplicationInfo.getInstance();
analytics = new Analytics(clientId, descriptor.getVersion(), info.getVersionName(), info.getFullVersion());
// Set up reporting prefs.
analytics.setCanSend(getCanReportAnalytics());
// Send initial loading hit.
analytics.sendScreenView("main");
FlutterSettings.getInstance().sendSettingsToAnalytics(analytics);
}
return analytics;
}
use of com.intellij.openapi.application.ApplicationInfo in project flutter-intellij by flutter.
the class FlutterErrorReportSubmitter method submitAsync.
@SuppressWarnings("deprecation")
@Override
public void submitAsync(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo, @NotNull Component parentComponent, @NotNull Consumer<SubmittedReportInfo> consumer) {
if (events.length == 0) {
consumer.consume(new SubmittedReportInfo(null, null, SubmittedReportInfo.SubmissionStatus.FAILED));
return;
}
final DataContext dataContext = DataManager.getInstance().getDataContext(parentComponent);
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
if (project == null) {
project = ProjectManager.getInstance().getDefaultProject();
}
final StringBuilder builder = new StringBuilder();
builder.append("Please file this bug report at https://github.com/flutter/flutter-intellij/issues/new.\n");
builder.append("\n");
builder.append("---\n");
builder.append("\n");
builder.append("## What happened\n");
builder.append("\n");
if (additionalInfo != null) {
builder.append(additionalInfo.trim()).append("\n");
} else {
builder.append("(please describe what you were doing when this exception occurred)\n");
}
builder.append("\n");
builder.append("## Version information\n");
builder.append("\n");
// IntelliJ version
final ApplicationInfo info = ApplicationInfo.getInstance();
builder.append(info.getVersionName()).append(" `").append(info.getFullVersion()).append("`");
final PluginId pid = FlutterUtils.getPluginId();
final IdeaPluginDescriptor flutterPlugin = PluginManager.getPlugin(pid);
// noinspection ConstantConditions
builder.append(" • Flutter plugin `").append(pid.getIdString()).append(' ').append(flutterPlugin.getVersion()).append("`");
final IdeaPluginDescriptor dartPlugin = PluginManager.getPlugin(PluginId.getId("Dart"));
if (dartPlugin != null) {
// noinspection ConstantConditions
builder.append(" • Dart plugin `").append(dartPlugin.getVersion()).append("`");
}
builder.append("\n\n");
final FlutterSdk sdk = FlutterSdk.getFlutterSdk(project);
if (sdk == null) {
builder.append("No Flutter sdk configured.\n");
} else {
final String flutterVersion = getFlutterVersion(sdk);
if (flutterVersion != null) {
builder.append(flutterVersion.trim()).append("\n");
} else {
builder.append("Error getting Flutter sdk information.\n");
}
}
builder.append("\n");
for (IdeaLoggingEvent event : events) {
builder.append("## Exception\n");
builder.append("\n");
builder.append(event.getMessage()).append("\n");
builder.append("\n");
if (event.getThrowable() != null) {
builder.append("```\n");
builder.append(event.getThrowableText().trim()).append("\n");
builder.append("```\n");
builder.append("\n");
FlutterInitializer.getAnalytics().sendException(event.getThrowable(), false);
}
}
final String text = builder.toString().trim() + "\n";
// Create scratch file.
final ScratchRootType scratchRoot = ScratchRootType.getInstance();
final VirtualFile file = scratchRoot.createScratchFile(project, "bug-report.md", Language.ANY, text);
if (file != null) {
// Open the file.
new OpenFileDescriptor(project, file).navigate(true);
} else {
consumer.consume(new SubmittedReportInfo(null, null, SubmittedReportInfo.SubmissionStatus.FAILED));
}
consumer.consume(new SubmittedReportInfo(null, "", SubmittedReportInfo.SubmissionStatus.NEW_ISSUE));
}
use of com.intellij.openapi.application.ApplicationInfo in project android by JetBrains.
the class AndroidStudioInitializer method setupAnalytics.
/*
* sets up collection of Android Studio specific analytics.
*/
private static void setupAnalytics() {
AndroidStudioUsageTracker.setup(JobScheduler.getScheduler());
ApplicationInfo application = ApplicationInfo.getInstance();
UsageTracker.getInstance().setVersion(application.getStrictVersion());
}
use of com.intellij.openapi.application.ApplicationInfo in project android by JetBrains.
the class GoogleCrash method getDefaultParameters.
@NotNull
private static Map<String, String> getDefaultParameters() {
Map<String, String> map = new HashMap<>();
ApplicationInfo applicationInfo = getApplicationInfo();
if (ANONYMIZED_UID != null) {
map.put("guid", ANONYMIZED_UID);
}
RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
map.put("ptime", Long.toString(runtimeMXBean.getUptime()));
// product specific key value pairs
map.put(KEY_VERSION, applicationInfo == null ? "0.0.0.0" : applicationInfo.getStrictVersion());
// must match registration with Crash
map.put(KEY_PRODUCT_ID, CrashReport.PRODUCT_ANDROID_STUDIO);
map.put("fullVersion", applicationInfo == null ? "0.0.0.0" : applicationInfo.getFullVersion());
map.put("osName", StringUtil.notNullize(SystemInfo.OS_NAME));
map.put("osVersion", StringUtil.notNullize(SystemInfo.OS_VERSION));
map.put("osArch", StringUtil.notNullize(SystemInfo.OS_ARCH));
map.put("locale", StringUtil.notNullize(LOCALE));
map.put("vmName", StringUtil.notNullize(runtimeMXBean.getVmName()));
map.put("vmVendor", StringUtil.notNullize(runtimeMXBean.getVmVendor()));
map.put("vmVersion", StringUtil.notNullize(runtimeMXBean.getVmVersion()));
MemoryUsage usage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
map.put("heapUsed", Long.toString(usage.getUsed()));
map.put("heapCommitted", Long.toString(usage.getCommitted()));
map.put("heapMax", Long.toString(usage.getMax()));
return map;
}
Aggregations