am 54d729b7: Merge "Fix issue #21572679: API Review: ActivityOptions, usage time report" into mnc-dev

* commit '54d729b73f54798d3112129894cb6fe8ef75920b':
  Fix issue #21572679: API Review: ActivityOptions, usage time report
This commit is contained in:
Dianne Hackborn
2015-06-08 19:56:00 +00:00
committed by Android Git Automerger
5 changed files with 11 additions and 11 deletions

View File

@@ -3762,8 +3762,8 @@ package android.app {
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 {

View File

@@ -3855,8 +3855,8 @@ package android.app {
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 {

View File

@@ -41,16 +41,16 @@ public class ActivityOptions {
/**
* 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 @@ public class ActivityOptions {
/**
* 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

View File

@@ -80,12 +80,12 @@ public class AppTimeTracker {
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 {

View File

@@ -27,7 +27,7 @@ public class TrackTimeReceiver extends BroadcastReceiver {
@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);
}
}