Merge "Add new samples to build.gradle" into lmp-docs
diff --git a/system/AppUsageStatistics/Application/src/main/java/com/example/android/appusagestatistics/AppUsageStatisticsFragment.java b/system/AppUsageStatistics/Application/src/main/java/com/example/android/appusagestatistics/AppUsageStatisticsFragment.java
index 50a72e7..9f54d02 100644
--- a/system/AppUsageStatistics/Application/src/main/java/com/example/android/appusagestatistics/AppUsageStatisticsFragment.java
+++ b/system/AppUsageStatistics/Application/src/main/java/com/example/android/appusagestatistics/AppUsageStatisticsFragment.java
@@ -108,8 +108,9 @@
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
- StatsUsageInterval statsUsageInterval = StatsUsageInterval.getValue(strings[position]);
- if (statsUsageInterval != null ) {
+ StatsUsageInterval statsUsageInterval = StatsUsageInterval
+ .getValue(strings[position]);
+ if (statsUsageInterval != null) {
List<UsageStats> usageStatsList =
getUsageStatistics(statsUsageInterval.mInterval);
Collections.sort(usageStatsList, new LastTimeLaunchedComparatorDesc());
@@ -121,17 +122,18 @@
public void onNothingSelected(AdapterView<?> parent) {
}
});
- getUsageStatistics(UsageStatsManager.INTERVAL_DAILY);
}
/**
- * Returns the {@link #mRecyclerView} sorted by the timestamp of the last time used
- * including the time span specified by the intervalType argument.
+ * Returns the {@link #mRecyclerView} including the time span specified by the
+ * intervalType argument.
*
* @param intervalType The time interval by which the stats are aggregated.
* Corresponding to the value of {@link UsageStatsManager}.
* E.g. {@link UsageStatsManager#INTERVAL_DAILY}, {@link
* UsageStatsManager#INTERVAL_WEEKLY},
+ *
+ * @return A list of {@link android.app.usage.UsageStats}.
*/
public List<UsageStats> getUsageStatistics(int intervalType) {
// Get the app statistics since one year ago from the current time.
@@ -164,6 +166,7 @@
* @param usageStatsList A list of {@link UsageStats} from which update the
* {@link #mRecyclerView}.
*/
+ //VisibleForTesting
void updateAppsList(List<UsageStats> usageStatsList) {
List<CustomUsageStats> customUsageStatsList = new ArrayList<>();
for (int i = 0; i < usageStatsList.size(); i++) {
diff --git a/system/AppUsageStatistics/Application/src/main/res/values/strings.xml b/system/AppUsageStatistics/Application/src/main/res/values/strings.xml
index 2caaf90..df769b5 100644
--- a/system/AppUsageStatistics/Application/src/main/res/values/strings.xml
+++ b/system/AppUsageStatistics/Application/src/main/res/values/strings.xml
@@ -19,7 +19,7 @@
<string name="last_time_used">"Last time used: "</string>
<string name="time_span">"Time span: "</string>
<string name="explanation_access_to_appusage_is_not_enabled">Failed to retrieve app usage
- statistics. You may need to enable access "
- + "for this app through Settings > Security > Apps with usage access
+ statistics. You may need to enable access
+ for this app through Settings > Security > Apps with usage access
</string>
</resources>