reject outlier for install time measurement

bug: 8791958
Change-Id: I930773ba1c40488ba300c56660474269abcf2b6e
diff --git a/suite/pts/hostTests/uihost/src/com/android/pts/uihost/InstallTimeTest.java b/suite/pts/hostTests/uihost/src/com/android/pts/uihost/InstallTimeTest.java
index 55e9b40..b6f8f40 100644
--- a/suite/pts/hostTests/uihost/src/com/android/pts/uihost/InstallTimeTest.java
+++ b/suite/pts/hostTests/uihost/src/com/android/pts/uihost/InstallTimeTest.java
@@ -17,6 +17,7 @@
 package com.android.pts.uihost;
 
 import com.android.cts.tradefed.build.CtsBuildHelper;
+import com.android.ddmlib.Log;
 import com.android.pts.util.HostReportLog;
 import com.android.pts.util.MeasureRun;
 import com.android.pts.util.MeasureTime;
@@ -40,8 +41,10 @@
     private CtsBuildHelper mBuild;
     private ITestDevice mDevice;
 
+    private static final String TAG = "InstallTimeTest";
     static final String PACKAGE = "com.replica.replicaisland";
     static final String APK = "com.replica.replicaisland.apk";
+    private static final double OUTLIER_THRESHOLD = 0.1;
 
     @Override
     public void setBuild(IBuildInfo buildInfo) {
@@ -80,7 +83,10 @@
         });
         report.printArray("install time", result, ResultType.LOWER_BETTER,
                 ResultUnit.MS);
-        StatResult stat = Stat.getStat(result);
+        Stat.StatResult stat = Stat.getStatWithOutlierRejection(result, OUTLIER_THRESHOLD);
+        if (stat.mDataCount != result.length) {
+            Log.w(TAG, "rejecting " + (result.length - stat.mDataCount) + " outliers");
+        }
         report.printSummary("install time", stat.mAverage, ResultType.LOWER_BETTER,
                 ResultUnit.MS);
         report.deliverReportToHost();