Merge "New ContentCapture constant: ActivityEvent.TYPE_ACTIVITY_DESTROYED"
diff --git a/api/system-current.txt b/api/system-current.txt
index 8a201a1..47e2b5b 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -6429,6 +6429,7 @@
method public int getEventType();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.service.contentcapture.ActivityEvent> CREATOR;
+ field public static final int TYPE_ACTIVITY_DESTROYED = 24; // 0x18
field public static final int TYPE_ACTIVITY_PAUSED = 2; // 0x2
field public static final int TYPE_ACTIVITY_RESUMED = 1; // 0x1
field public static final int TYPE_ACTIVITY_STOPPED = 23; // 0x17
diff --git a/api/test-current.txt b/api/test-current.txt
index b86257c..0fcf727 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -2394,6 +2394,7 @@
method public int getEventType();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.service.contentcapture.ActivityEvent> CREATOR;
+ field public static final int TYPE_ACTIVITY_DESTROYED = 24; // 0x18
field public static final int TYPE_ACTIVITY_PAUSED = 2; // 0x2
field public static final int TYPE_ACTIVITY_RESUMED = 1; // 0x1
field public static final int TYPE_ACTIVITY_STOPPED = 23; // 0x17
diff --git a/core/java/android/service/contentcapture/ActivityEvent.java b/core/java/android/service/contentcapture/ActivityEvent.java
index 5407c1d..fc781c2 100644
--- a/core/java/android/service/contentcapture/ActivityEvent.java
+++ b/core/java/android/service/contentcapture/ActivityEvent.java
@@ -52,11 +52,17 @@
*/
public static final int TYPE_ACTIVITY_STOPPED = Event.ACTIVITY_STOPPED;
+ /**
+ * The activity was destroyed.
+ */
+ public static final int TYPE_ACTIVITY_DESTROYED = Event.ACTIVITY_DESTROYED;
+
/** @hide */
@IntDef(prefix = { "TYPE_" }, value = {
TYPE_ACTIVITY_RESUMED,
TYPE_ACTIVITY_PAUSED,
- TYPE_ACTIVITY_STOPPED
+ TYPE_ACTIVITY_STOPPED,
+ TYPE_ACTIVITY_DESTROYED
})
@Retention(RetentionPolicy.SOURCE)
public @interface ActivityEventType{}
@@ -81,7 +87,8 @@
/**
* Gets the event type.
*
- * @return either {@link #TYPE_ACTIVITY_RESUMED} or {@value #TYPE_ACTIVITY_PAUSED}.
+ * @return either {@link #TYPE_ACTIVITY_RESUMED}, {@value #TYPE_ACTIVITY_PAUSED},
+ * {@value #TYPE_ACTIVITY_STOPPED}, or {@value #TYPE_ACTIVITY_DESTROYED}.
*/
@ActivityEventType
public int getEventType() {
@@ -97,6 +104,8 @@
return "ACTIVITY_PAUSED";
case TYPE_ACTIVITY_STOPPED:
return "ACTIVITY_STOPPED";
+ case TYPE_ACTIVITY_DESTROYED:
+ return "ACTIVITY_DESTROYED";
default:
return "UKNOWN_TYPE: " + type;
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 92b7c3c..97cc756 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -2937,7 +2937,8 @@
}
}
if (mContentCaptureService != null && (event == Event.ACTIVITY_PAUSED
- || event == Event.ACTIVITY_RESUMED || event == Event.ACTIVITY_STOPPED)) {
+ || event == Event.ACTIVITY_RESUMED || event == Event.ACTIVITY_STOPPED
+ || event == Event.ACTIVITY_DESTROYED)) {
mContentCaptureService.notifyActivityEvent(userId, activity, event);
}
}