summaryrefslogtreecommitdiffstats
path: root/location/lib
diff options
context:
space:
mode:
authordestradaa <destradaa@google.com>2014-07-16 14:28:06 -0700
committerdestradaa <destradaa@google.com>2014-07-17 11:09:46 -0700
commit3b0224dc3c2e7ffb93dc56970395003d0e387545 (patch)
tree124600c9f791f7fc8df131c1a9cd07281df90985 /location/lib
parent69eef8a0d250ae1b50b510499014e109bd2c6112 (diff)
downloadframeworks_base-3b0224dc3c2e7ffb93dc56970395003d0e387545.zip
frameworks_base-3b0224dc3c2e7ffb93dc56970395003d0e387545.tar.gz
frameworks_base-3b0224dc3c2e7ffb93dc56970395003d0e387545.tar.bz2
Fix exceptions in ActivityRecognition platform stack.
b/16348349 Change-Id: I1f85283c86130b86389a1be7da49904658b0558c
Diffstat (limited to 'location/lib')
-rw-r--r--location/lib/java/com/android/location/provider/ActivityChangedEvent.java13
-rw-r--r--location/lib/java/com/android/location/provider/ActivityRecognitionEvent.java26
2 files changed, 39 insertions, 0 deletions
diff --git a/location/lib/java/com/android/location/provider/ActivityChangedEvent.java b/location/lib/java/com/android/location/provider/ActivityChangedEvent.java
index 8707a10..c7dfc88 100644
--- a/location/lib/java/com/android/location/provider/ActivityChangedEvent.java
+++ b/location/lib/java/com/android/location/provider/ActivityChangedEvent.java
@@ -40,4 +40,17 @@ public class ActivityChangedEvent {
public Iterable<ActivityRecognitionEvent> getActivityRecognitionEvents() {
return mActivityRecognitionEvents;
}
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder("[ ActivityChangedEvent:");
+
+ for (ActivityRecognitionEvent event : mActivityRecognitionEvents) {
+ builder.append("\n ");
+ builder.append(event.toString());
+ }
+ builder.append("\n]");
+
+ return builder.toString();
+ }
}
diff --git a/location/lib/java/com/android/location/provider/ActivityRecognitionEvent.java b/location/lib/java/com/android/location/provider/ActivityRecognitionEvent.java
index 8c719ce..a39cff2 100644
--- a/location/lib/java/com/android/location/provider/ActivityRecognitionEvent.java
+++ b/location/lib/java/com/android/location/provider/ActivityRecognitionEvent.java
@@ -41,4 +41,30 @@ public class ActivityRecognitionEvent {
public long getTimestampNs() {
return mTimestampNs;
}
+
+ @Override
+ public String toString() {
+ String eventString;
+ switch (mEventType) {
+ case ActivityRecognitionProvider.EVENT_TYPE_ENTER:
+ eventString = "Enter";
+ break;
+ case ActivityRecognitionProvider.EVENT_TYPE_EXIT:
+ eventString = "Exit";
+ break;
+ case ActivityRecognitionProvider.EVENT_TYPE_FLUSH_COMPLETE:
+ eventString = "FlushComplete";
+ break;
+ default:
+ eventString = "<Invalid>";
+ break;
+ }
+
+ return String.format(
+ "Activity='%s', EventType=%s(%s), TimestampNs=%s",
+ mActivity,
+ eventString,
+ mEventType,
+ mTimestampNs);
+ }
}