Merge "Fix issue #21572679: API Review: ActivityOptions, usage time report" into mnc-dev
diff --git a/api/current.txt b/api/current.txt
index c3761ad..72d740c 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -3762,8 +3762,8 @@
     method public void requestUsageTimeReport(android.app.PendingIntent);
     method public android.os.Bundle toBundle();
     method public void update(android.app.ActivityOptions);
-    field public static final java.lang.String EXTRA_USAGE_REPORT_PACKAGES = "android.package";
-    field public static final java.lang.String EXTRA_USAGE_REPORT_TIME = "android.time";
+    field public static final java.lang.String EXTRA_USAGE_TIME_REPORT = "android.usage_time";
+    field public static final java.lang.String EXTRA_USAGE_TIME_REPORT_PACKAGES = "android.usage_time_packages";
   }
 
   public class AlarmManager {
diff --git a/api/system-current.txt b/api/system-current.txt
index 43f7f95..401bd66 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -3855,8 +3855,8 @@
     method public void requestUsageTimeReport(android.app.PendingIntent);
     method public android.os.Bundle toBundle();
     method public void update(android.app.ActivityOptions);
-    field public static final java.lang.String EXTRA_USAGE_REPORT_PACKAGES = "android.package";
-    field public static final java.lang.String EXTRA_USAGE_REPORT_TIME = "android.time";
+    field public static final java.lang.String EXTRA_USAGE_TIME_REPORT = "android.usage_time";
+    field public static final java.lang.String EXTRA_USAGE_TIME_REPORT_PACKAGES = "android.usage_time_packages";
   }
 
   public class AlarmManager {
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java
index 9f23b43..6fb997e 100644
--- a/core/java/android/app/ActivityOptions.java
+++ b/core/java/android/app/ActivityOptions.java
@@ -41,16 +41,16 @@
 
     /**
      * A long in the extras delivered by {@link #requestUsageTimeReport} that contains
-     * the total time (in ms) the user spent in the app.
+     * the total time (in ms) the user spent in the app flow.
      */
-    public static final String EXTRA_USAGE_REPORT_TIME = "android.time";
+    public static final String EXTRA_USAGE_TIME_REPORT = "android.usage_time";
 
     /**
      * A Bundle in the extras delivered by {@link #requestUsageTimeReport} that contains
      * detailed information about the time spent in each package associated with the app;
      * each key is a package name, whose value is a long containing the time (in ms).
      */
-    public static final String EXTRA_USAGE_REPORT_PACKAGES = "android.package";
+    public static final String EXTRA_USAGE_TIME_REPORT_PACKAGES = "android.usage_time_packages";
 
     /**
      * The package name that created the options.
@@ -915,7 +915,7 @@
     /**
      * Ask the the system track that time the user spends in the app being launched, and
      * report it back once done.  The report will be sent to the given receiver, with
-     * the extras {@link #EXTRA_USAGE_REPORT_TIME} and {@link #EXTRA_USAGE_REPORT_PACKAGES}
+     * the extras {@link #EXTRA_USAGE_TIME_REPORT} and {@link #EXTRA_USAGE_TIME_REPORT_PACKAGES}
      * filled in.
      *
      * <p>The time interval tracked is from launching this activity until the user leaves
diff --git a/services/core/java/com/android/server/am/AppTimeTracker.java b/services/core/java/com/android/server/am/AppTimeTracker.java
index bddd66f..910f33d 100644
--- a/services/core/java/com/android/server/am/AppTimeTracker.java
+++ b/services/core/java/com/android/server/am/AppTimeTracker.java
@@ -80,12 +80,12 @@
     public void deliverResult(Context context) {
         stop();
         Bundle extras = new Bundle();
-        extras.putLong(ActivityOptions.EXTRA_USAGE_REPORT_TIME, mTotalTime);
+        extras.putLong(ActivityOptions.EXTRA_USAGE_TIME_REPORT, mTotalTime);
         Bundle pkgs = new Bundle();
         for (int i=mPackageTimes.size()-1; i>=0; i--) {
             pkgs.putLong(mPackageTimes.keyAt(i), mPackageTimes.valueAt(i).value);
         }
-        extras.putBundle(ActivityOptions.EXTRA_USAGE_REPORT_PACKAGES, pkgs);
+        extras.putBundle(ActivityOptions.EXTRA_USAGE_TIME_REPORT_PACKAGES, pkgs);
         Intent fillinIntent = new Intent();
         fillinIntent.putExtras(extras);
         try {
diff --git a/tests/ActivityTests/src/com/google/android/test/activity/TrackTimeReceiver.java b/tests/ActivityTests/src/com/google/android/test/activity/TrackTimeReceiver.java
index c30d33a..0cc0090 100644
--- a/tests/ActivityTests/src/com/google/android/test/activity/TrackTimeReceiver.java
+++ b/tests/ActivityTests/src/com/google/android/test/activity/TrackTimeReceiver.java
@@ -27,7 +27,7 @@
     @Override
     public void onReceive(Context context, Intent intent) {
         Bundle data = intent.getExtras();
-        data.getLong(ActivityOptions.EXTRA_USAGE_REPORT_TIME);
+        data.getLong(ActivityOptions.EXTRA_USAGE_TIME_REPORT);
         Log.i("ActivityTest", "Received time: " + data);
     }
 }