Snap for 5822255 from 980e8766cf58058d823f7d9bc7af5089e2bb276e to r-keystone-qcom-release

Change-Id: I7dd55e74661ac696bf648b8055f1a209cc40ed8d
diff --git a/Android.bp b/Android.bp
index 5490ef0..2672103 100644
--- a/Android.bp
+++ b/Android.bp
@@ -34,7 +34,7 @@
     // Use Dagger2 annotation processor
     plugins: ["dagger2-compiler"],
 
-    java_version: "1.7",
+    java_version: "1.8",
 }
 
 // build caliper target api jar
@@ -54,7 +54,7 @@
     ],
     sdk_version: "core_current",
 
-    java_version: "1.7",
+    java_version: "1.8",
 }
 
 // build caliper tests
@@ -81,7 +81,7 @@
     // Use Dagger2 annotation processor
     plugins: ["dagger2-compiler"],
 
-    java_version: "1.7",
+    java_version: "1.8",
 }
 
 // build caliper examples
@@ -98,7 +98,7 @@
         "mockito",
     ],
 
-    java_version: "1.7",
+    java_version: "1.8",
 }
 
 // Build host dependencies.
diff --git a/caliper/src/main/java/com/google/caliper/json/GsonModule.java b/caliper/src/main/java/com/google/caliper/json/GsonModule.java
index 491dcca..70ba1a7 100644
--- a/caliper/src/main/java/com/google/caliper/json/GsonModule.java
+++ b/caliper/src/main/java/com/google/caliper/json/GsonModule.java
@@ -23,7 +23,7 @@
 import com.google.gson.internal.bind.TypeAdapters;
 import dagger.Module;
 import dagger.Provides;
-import dagger.Provides.Type;
+import dagger.multibindings.IntoSet;
 import org.joda.time.Instant;
 import java.util.Set;
 
@@ -34,22 +34,26 @@
 @Module
 public final class GsonModule {
 
-  @Provides(type = Type.SET)
+  @Provides
+  @IntoSet
   static TypeAdapterFactory provideImmutableListTypeAdapterFactory() {
     return new ImmutableListTypeAdatperFactory();
   }
 
-  @Provides(type = Type.SET)
+  @Provides
+  @IntoSet
   static TypeAdapterFactory provideImmutableMapTypeAdapterFactory() {
     return new ImmutableMapTypeAdapterFactory();
   }
 
-  @Provides(type = Type.SET)
+  @Provides
+  @IntoSet
   static TypeAdapterFactory provideNaturallySortedMapTypeAdapterFactory() {
     return new NaturallySortedMapTypeAdapterFactory();
   }
 
-  @Provides(type = Type.SET)
+  @Provides
+  @IntoSet
   static TypeAdapterFactory provideImmutableMultimapTypeAdapterFactory() {
     return new ImmutableMultimapTypeAdapterFactory();
   }
@@ -59,7 +63,8 @@
     return new AnnotationExclusionStrategy();
   }
 
-  @Provides(type = Type.SET)
+  @Provides
+  @IntoSet
   static TypeAdapterFactory provideTypeAdapterFactoryForInstant(
       InstantTypeAdapter typeAdapter) {
     return TypeAdapters.newFactory(Instant.class, typeAdapter);
diff --git a/caliper/src/main/java/com/google/caliper/runner/ExperimentingCaliperRun.java b/caliper/src/main/java/com/google/caliper/runner/ExperimentingCaliperRun.java
index 5214193..e57e1b0 100644
--- a/caliper/src/main/java/com/google/caliper/runner/ExperimentingCaliperRun.java
+++ b/caliper/src/main/java/com/google/caliper/runner/ExperimentingCaliperRun.java
@@ -30,7 +30,6 @@
 import com.google.common.collect.Lists;
 import com.google.common.collect.Queues;
 import com.google.common.util.concurrent.AsyncFunction;
-import com.google.common.util.concurrent.FutureFallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
@@ -58,9 +57,9 @@
 
   private static final Logger logger = Logger.getLogger(ExperimentingCaliperRun.class.getName());
 
-  private static final FutureFallback<Object> FALLBACK_TO_NULL = new FutureFallback<Object>() {
+  private static final AsyncFunction<Throwable, Object> FALLBACK_TO_NULL = new AsyncFunction<Throwable, Object>() {
     final ListenableFuture<Object> nullFuture = Futures.immediateFuture(null);
-    @Override public ListenableFuture<Object> create(Throwable t) throws Exception {
+    @Override public ListenableFuture<Object> apply(Throwable t) throws Exception {
       return nullFuture;
     }
   };
@@ -220,16 +219,16 @@
       // each of these trials can only start after all prior trials have finished, so we use
       // Futures.transform to force the sequencing.
       ListenableFuture<TrialResult> current =
-          Futures.transform(
+          Futures.transformAsync(
               previous,
               new AsyncFunction<Object, TrialResult>() {
                 @Override public ListenableFuture<TrialResult> apply(Object ignored) {
                   return executor.submit(scheduledTrial.trialTask());
                 }
-              });
+              }, MoreExecutors.directExecutor());
       pendingTrials.add(current);
       // ignore failure of the prior task.
-      previous = Futures.withFallback(current, FALLBACK_TO_NULL);
+      previous = Futures.catchingAsync(current, Throwable.class, FALLBACK_TO_NULL, MoreExecutors.directExecutor());
     }
     return pendingTrials;
   }
diff --git a/caliper/src/main/java/com/google/caliper/runner/ExperimentingRunnerModule.java b/caliper/src/main/java/com/google/caliper/runner/ExperimentingRunnerModule.java
index 7abcbd9..4477a61 100644
--- a/caliper/src/main/java/com/google/caliper/runner/ExperimentingRunnerModule.java
+++ b/caliper/src/main/java/com/google/caliper/runner/ExperimentingRunnerModule.java
@@ -39,7 +39,8 @@
 import dagger.MapKey;
 import dagger.Module;
 import dagger.Provides;
-import dagger.Provides.Type;
+import dagger.multibindings.IntoMap;
+import dagger.multibindings.IntoSet;
 
 import java.io.PrintWriter;
 import java.lang.reflect.Method;
@@ -60,12 +61,14 @@
 final class ExperimentingRunnerModule {
   private static final String RUNNER_MAX_PARALLELISM_OPTION = "runner.maxParallelism";
 
-  @Provides(type = Type.SET)
+  @Provides
+  @IntoSet
   static Service provideServerSocketService(ServerSocketService impl) {
     return impl;
   }
 
-  @Provides(type = Type.SET)
+  @Provides
+  @IntoSet
   static Service provideTrialOutputFactoryService(TrialOutputFactoryService impl) {
     return impl;
   }
@@ -102,13 +105,15 @@
     Class<? extends ResultProcessor> value();
   }
 
-  @Provides(type = Type.MAP)
+  @Provides
+  @IntoMap
   @ResultProcessorClassKey(OutputFileDumper.class)
   static ResultProcessor provideOutputFileDumper(OutputFileDumper impl) {
     return impl;
   }
 
-  @Provides(type = Type.MAP)
+  @Provides
+  @IntoMap
   @ResultProcessorClassKey(HttpUploader.class)
   static ResultProcessor provideHttpUploader(HttpUploader impl) {
     return impl;
@@ -157,19 +162,22 @@
     Class<? extends Instrument> value();
   }
 
-  @Provides(type = Type.MAP)
+  @Provides
+  @IntoMap
   @InstrumentClassKey(ArbitraryMeasurementInstrument.class)
   static Instrument provideArbitraryMeasurementInstrument() {
     return new ArbitraryMeasurementInstrument();
   }
 
-  @Provides(type = Type.MAP)
+  @Provides
+  @IntoMap
   @InstrumentClassKey(AllocationInstrument.class)
   static Instrument provideAllocationInstrument() {
     return new AllocationInstrument();
   }
 
-  @Provides(type = Type.MAP)
+  @Provides
+  @IntoMap
   @InstrumentClassKey(RuntimeInstrument.class)
   static Instrument provideRuntimeInstrument(
       @NanoTimeGranularity ShortDuration nanoTimeGranularity) {
diff --git a/caliper/src/main/java/com/google/caliper/runner/StreamService.java b/caliper/src/main/java/com/google/caliper/runner/StreamService.java
index a5852d0..4b8928a 100644
--- a/caliper/src/main/java/com/google/caliper/runner/StreamService.java
+++ b/caliper/src/main/java/com/google/caliper/runner/StreamService.java
@@ -158,11 +158,11 @@
     Charset processCharset = Charset.defaultCharset();
     runningReadStreams.addAndGet(2);
     openStreams.addAndGet(1);
-    streamExecutor.submit(
+    ListenableFuture possiblyIgnoredError1 = streamExecutor.submit(
         threadRenaming("worker-stderr", 
             new StreamReader("stderr", 
                 new InputStreamReader(process.getErrorStream(), processCharset))));
-    streamExecutor.submit(
+    ListenableFuture possiblyIgnoredError2 = streamExecutor.submit(
         threadRenaming("worker-stdout",
             new StreamReader("stdout", 
                 new InputStreamReader(process.getInputStream(), processCharset))));
@@ -176,7 +176,7 @@
               socketWriter = openedSocket.writer();
               runningReadStreams.addAndGet(1);
               openStreams.addAndGet(1);
-              streamExecutor.submit(threadRenaming("worker-socket",
+              ListenableFuture possiblyIgnoredError = streamExecutor.submit(threadRenaming("worker-socket",
                   new SocketStreamReader(openedSocket.reader())));
             } catch (ExecutionException e) {
               notifyFailed(e.getCause());
@@ -250,7 +250,7 @@
     // Experimentally, even with well behaved processes there is some time between when all streams
     // are closed as part of process shutdown and when the process has exited. So to not fail 
     // flakily when shutting down normally we need to do a timed wait
-    streamExecutor.submit(new Callable<Void>() {
+    ListenableFuture possiblyIgnoredError = streamExecutor.submit(new Callable<Void>() {
       @Override public Void call() throws Exception {
         boolean threw = true;
         try {
diff --git a/caliper/src/main/java/com/google/caliper/worker/WorkerModule.java b/caliper/src/main/java/com/google/caliper/worker/WorkerModule.java
index 1f7e201..56a5f6e 100644
--- a/caliper/src/main/java/com/google/caliper/worker/WorkerModule.java
+++ b/caliper/src/main/java/com/google/caliper/worker/WorkerModule.java
@@ -26,7 +26,7 @@
 import dagger.MapKey;
 import dagger.Module;
 import dagger.Provides;
-import dagger.Provides.Type;
+import dagger.multibindings.IntoMap;
 
 import java.util.Map;
 import java.util.Random;
@@ -80,37 +80,43 @@
     Class<? extends Worker> value();
   }
 
-  @Provides(type = Type.MAP)
+  @Provides
+  @IntoMap
   @WorkerClassKey(ArbitraryMeasurementWorker.class)
   static Worker provideArbitraryMeasurementWorker(ArbitraryMeasurementWorker impl) {
     return impl;
   }
 
-  @Provides(type = Type.MAP)
+  @Provides
+  @IntoMap
   @WorkerClassKey(MicrobenchmarkAllocationWorker.class)
   static Worker provideMicrobenchmarkAllocationWorker(MicrobenchmarkAllocationWorker impl) {
     return impl;
   }
 
-  @Provides(type = Type.MAP)
+  @Provides
+  @IntoMap
   @WorkerClassKey(MacrobenchmarkWorker.class)
   static Worker provideMacrobenchmarkWorker(MacrobenchmarkWorker impl) {
     return impl;
   }
 
-  @Provides(type = Type.MAP)
+  @Provides
+  @IntoMap
   @WorkerClassKey(MacrobenchmarkAllocationWorker.class)
   static Worker provideMacrobenchmarkAllocationWorker(MacrobenchmarkAllocationWorker impl) {
     return impl;
   }
 
-  @Provides(type = Type.MAP)
+  @Provides
+  @IntoMap
   @WorkerClassKey(RuntimeWorker.Micro.class)
   static Worker provideRuntimeWorkerMicro(RuntimeWorker.Micro impl) {
     return impl;
   }
 
-  @Provides(type = Type.MAP)
+  @Provides
+  @IntoMap
   @WorkerClassKey(RuntimeWorker.Pico.class)
   static Worker provideRuntimeWorkerPico(RuntimeWorker.Pico impl) {
     return impl;