RecordingBuildListener implements TaskExecutionListener { @VisibleForTesting @NonNull static AndroidStudioStats.GradleTaskExecution.Type getExecutionType(@NonNull Class<?> taskClass) { String taskImpl = taskClass.getSimpleName(); if (taskImpl.endsWith("_Decorated")) { taskImpl = taskImpl.substring(0, taskImpl.length() - "_Decorated".length()); } String potentialExecutionTypeName = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, taskImpl); try { return AndroidStudioStats.GradleTaskExecution.Type.valueOf(potentialExecutionTypeName); } catch (IllegalArgumentException ignored) { return AndroidStudioStats.GradleTaskExecution.Type.UNKNOWN_TASK_TYPE; } } RecordingBuildListener(@NonNull Recorder recorder); @Override void beforeExecute(@NonNull Task task); @Override void afterExecute(@NonNull Task task, @NonNull TaskState taskState);  }
@Test public void checkTasksEnum() { assertThat( RecordingBuildListener.getExecutionType( org.gradle.api.tasks.compile.JavaCompile.class)) .named("JavaCompile") .isEqualTo(AndroidStudioStats.GradleTaskExecution.Type.JAVA_COMPILE); }