OSDN Git Service

Added android.service.contentcapture.ActivityEvent.TYPE_ACTIVITY_STOPPED
authorFelipe Leme <felipeal@google.com>
Thu, 14 Mar 2019 16:03:29 +0000 (09:03 -0700)
committerFelipe Leme <felipeal@google.com>
Thu, 14 Mar 2019 22:14:13 +0000 (15:14 -0700)
Test: atest ChildlessActivityTest#testLaunchAnotherActivity_onTopOfIt
Test: atest CtsContentCaptureServiceTestCases # sanity check

Fixes: 128546985

Change-Id: I98baf8332bec3e75e43a08a6785e5ec77cfb6f7d

api/system-current.txt
api/test-current.txt
core/java/android/service/contentcapture/ActivityEvent.java
services/core/java/com/android/server/am/ActivityManagerService.java

index c1979fd..889cfb1 100644 (file)
@@ -6440,6 +6440,7 @@ package android.service.contentcapture {
     field @NonNull public static final android.os.Parcelable.Creator<android.service.contentcapture.ActivityEvent> CREATOR;
     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
   }
 
   public abstract class ContentCaptureService extends android.app.Service {
index af93d17..f9025fd 100644 (file)
@@ -2397,6 +2397,7 @@ package android.service.contentcapture {
     field @NonNull public static final android.os.Parcelable.Creator<android.service.contentcapture.ActivityEvent> CREATOR;
     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
   }
 
   public abstract class ContentCaptureService extends android.app.Service {
index 7ac380d..5407c1d 100644 (file)
@@ -47,10 +47,16 @@ public final class ActivityEvent implements Parcelable {
      */
     public static final int TYPE_ACTIVITY_PAUSED = Event.ACTIVITY_PAUSED;
 
+    /**
+     * The activity stopped.
+     */
+    public static final int TYPE_ACTIVITY_STOPPED = Event.ACTIVITY_STOPPED;
+
     /** @hide */
     @IntDef(prefix = { "TYPE_" }, value = {
             TYPE_ACTIVITY_RESUMED,
-            TYPE_ACTIVITY_PAUSED
+            TYPE_ACTIVITY_PAUSED,
+            TYPE_ACTIVITY_STOPPED
     })
     @Retention(RetentionPolicy.SOURCE)
     public @interface ActivityEventType{}
@@ -89,6 +95,8 @@ public final class ActivityEvent implements Parcelable {
                 return "ACTIVITY_RESUMED";
             case TYPE_ACTIVITY_PAUSED:
                 return "ACTIVITY_PAUSED";
+            case TYPE_ACTIVITY_STOPPED:
+                return "ACTIVITY_STOPPED";
             default:
                 return "UKNOWN_TYPE: " + type;
         }
index 0a80d45..f92c7ff 100644 (file)
@@ -2931,8 +2931,8 @@ public class ActivityManagerService extends IActivityManager.Stub
                         taskRoot);
             }
         }
-        if (mContentCaptureService != null
-                && (event == Event.ACTIVITY_PAUSED || event == Event.ACTIVITY_RESUMED)) {
+        if (mContentCaptureService != null && (event == Event.ACTIVITY_PAUSED
+                || event == Event.ACTIVITY_RESUMED || event == Event.ACTIVITY_STOPPED)) {
             mContentCaptureService.notifyActivityEvent(userId, activity, event);
         }
     }