Loading api/system-current.txt +11 −0 Original line number Diff line number Diff line Loading @@ -6437,9 +6437,20 @@ package android.service.carrier { package android.service.contentcapture { public final class ActivityEvent implements android.os.Parcelable { method public int describeContents(); method @NonNull public android.content.ComponentName getComponentName(); 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_PAUSED = 2; // 0x2 field public static final int TYPE_ACTIVITY_RESUMED = 1; // 0x1 } public abstract class ContentCaptureService extends android.app.Service { ctor public ContentCaptureService(); method public final void disableContentCaptureServices(); method public void onActivityEvent(@NonNull android.service.contentcapture.ActivityEvent); method public void onActivitySnapshot(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.service.contentcapture.SnapshotData); method public void onConnected(); method public void onContentCaptureEvent(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.view.contentcapture.ContentCaptureEvent); Loading api/test-current.txt +11 −0 Original line number Diff line number Diff line Loading @@ -2297,9 +2297,20 @@ package android.service.autofill.augmented { package android.service.contentcapture { public final class ActivityEvent implements android.os.Parcelable { method public int describeContents(); method @NonNull public android.content.ComponentName getComponentName(); 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_PAUSED = 2; // 0x2 field public static final int TYPE_ACTIVITY_RESUMED = 1; // 0x1 } public abstract class ContentCaptureService extends android.app.Service { ctor public ContentCaptureService(); method public final void disableContentCaptureServices(); method public void onActivityEvent(@NonNull android.service.contentcapture.ActivityEvent); method public void onActivitySnapshot(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.service.contentcapture.SnapshotData); method public void onConnected(); method public void onContentCaptureEvent(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.view.contentcapture.ContentCaptureEvent); Loading core/java/android/service/contentcapture/ActivityEvent.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /** * Copyright (c) 2019, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.service.contentcapture; parcelable ActivityEvent; core/java/android/service/contentcapture/ActivityEvent.java 0 → 100644 +131 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.service.contentcapture; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.SystemApi; import android.annotation.TestApi; import android.app.usage.UsageEvents.Event; import android.content.ComponentName; import android.os.Parcel; import android.os.Parcelable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Represents an activity-level event that is not associated with a session. * * @hide */ @SystemApi @TestApi public final class ActivityEvent implements Parcelable { /** * The activity resumed. */ public static final int TYPE_ACTIVITY_RESUMED = Event.ACTIVITY_RESUMED; /** * The activity paused. */ public static final int TYPE_ACTIVITY_PAUSED = Event.ACTIVITY_PAUSED; /** @hide */ @IntDef(prefix = { "TYPE_" }, value = { TYPE_ACTIVITY_RESUMED, TYPE_ACTIVITY_PAUSED }) @Retention(RetentionPolicy.SOURCE) public @interface ActivityEventType{} private final @NonNull ComponentName mComponentName; private final @ActivityEventType int mType; /** @hide */ public ActivityEvent(@NonNull ComponentName componentName, @ActivityEventType int type) { mComponentName = componentName; mType = type; } /** * Gests the {@link ComponentName} of the activity associated with the event. */ @NonNull public ComponentName getComponentName() { return mComponentName; } /** * Gets the event type. * * @return either {@link #TYPE_ACTIVITY_RESUMED} or {@value #TYPE_ACTIVITY_PAUSED}. */ @ActivityEventType public int getEventType() { return mType; } /** @hide */ public static String getTypeAsString(@ActivityEventType int type) { switch (type) { case TYPE_ACTIVITY_RESUMED: return "ACTIVITY_RESUMED"; case TYPE_ACTIVITY_PAUSED: return "ACTIVITY_PAUSED"; default: return "UKNOWN_TYPE: " + type; } } @Override public String toString() { return new StringBuilder("ActivityEvent[").append(mComponentName.toShortString()) .append("]:").append(getTypeAsString(mType)).toString(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(@NonNull Parcel parcel, int flags) { parcel.writeParcelable(mComponentName, flags); parcel.writeInt(mType); } public static final @android.annotation.NonNull Creator<ActivityEvent> CREATOR = new Creator<ActivityEvent>() { @Override @NonNull public ActivityEvent createFromParcel(@NonNull Parcel parcel) { final ComponentName componentName = parcel.readParcelable(null); final int eventType = parcel.readInt(); return new ActivityEvent(componentName, eventType); } @Override @NonNull public ActivityEvent[] newArray(int size) { return new ActivityEvent[size]; } }; } core/java/android/service/contentcapture/ContentCaptureService.java +26 −1 Original line number Diff line number Diff line Loading @@ -126,6 +126,13 @@ public abstract class ContentCaptureService extends Service { obtainMessage(ContentCaptureService::handleOnUserDataRemovalRequest, ContentCaptureService.this, request)); } @Override public void onActivityEvent(ActivityEvent event) { mHandler.sendMessage(obtainMessage(ContentCaptureService::handleOnActivityEvent, ContentCaptureService.this, event)); } }; /** Loading Loading @@ -247,7 +254,21 @@ public abstract class ContentCaptureService extends Service { * @param snapshotData the data */ public void onActivitySnapshot(@NonNull ContentCaptureSessionId sessionId, @NonNull SnapshotData snapshotData) {} @NonNull SnapshotData snapshotData) { if (sVerbose) Log.v(TAG, "onActivitySnapshot(id=" + sessionId + ")"); } /** * Notifies the service of an activity-level event that is not associated with a session. * * <p>This method can be used to track some high-level events for all activities, even those * that are not whitelisted for Content Capture. * * @param event high-level activity event */ public void onActivityEvent(@NonNull ActivityEvent event) { if (sVerbose) Log.v(TAG, "onActivityEvent(): " + event); } /** * Destroys the content capture session. Loading Loading @@ -383,6 +404,10 @@ public abstract class ContentCaptureService extends Service { onUserDataRemovalRequest(request); } private void handleOnActivityEvent(@NonNull ActivityEvent event) { onActivityEvent(event); } /** * Checks if the given {@code uid} owns the session associated with the event. */ Loading Loading
api/system-current.txt +11 −0 Original line number Diff line number Diff line Loading @@ -6437,9 +6437,20 @@ package android.service.carrier { package android.service.contentcapture { public final class ActivityEvent implements android.os.Parcelable { method public int describeContents(); method @NonNull public android.content.ComponentName getComponentName(); 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_PAUSED = 2; // 0x2 field public static final int TYPE_ACTIVITY_RESUMED = 1; // 0x1 } public abstract class ContentCaptureService extends android.app.Service { ctor public ContentCaptureService(); method public final void disableContentCaptureServices(); method public void onActivityEvent(@NonNull android.service.contentcapture.ActivityEvent); method public void onActivitySnapshot(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.service.contentcapture.SnapshotData); method public void onConnected(); method public void onContentCaptureEvent(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.view.contentcapture.ContentCaptureEvent); Loading
api/test-current.txt +11 −0 Original line number Diff line number Diff line Loading @@ -2297,9 +2297,20 @@ package android.service.autofill.augmented { package android.service.contentcapture { public final class ActivityEvent implements android.os.Parcelable { method public int describeContents(); method @NonNull public android.content.ComponentName getComponentName(); 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_PAUSED = 2; // 0x2 field public static final int TYPE_ACTIVITY_RESUMED = 1; // 0x1 } public abstract class ContentCaptureService extends android.app.Service { ctor public ContentCaptureService(); method public final void disableContentCaptureServices(); method public void onActivityEvent(@NonNull android.service.contentcapture.ActivityEvent); method public void onActivitySnapshot(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.service.contentcapture.SnapshotData); method public void onConnected(); method public void onContentCaptureEvent(@NonNull android.view.contentcapture.ContentCaptureSessionId, @NonNull android.view.contentcapture.ContentCaptureEvent); Loading
core/java/android/service/contentcapture/ActivityEvent.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /** * Copyright (c) 2019, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.service.contentcapture; parcelable ActivityEvent;
core/java/android/service/contentcapture/ActivityEvent.java 0 → 100644 +131 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.service.contentcapture; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.SystemApi; import android.annotation.TestApi; import android.app.usage.UsageEvents.Event; import android.content.ComponentName; import android.os.Parcel; import android.os.Parcelable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Represents an activity-level event that is not associated with a session. * * @hide */ @SystemApi @TestApi public final class ActivityEvent implements Parcelable { /** * The activity resumed. */ public static final int TYPE_ACTIVITY_RESUMED = Event.ACTIVITY_RESUMED; /** * The activity paused. */ public static final int TYPE_ACTIVITY_PAUSED = Event.ACTIVITY_PAUSED; /** @hide */ @IntDef(prefix = { "TYPE_" }, value = { TYPE_ACTIVITY_RESUMED, TYPE_ACTIVITY_PAUSED }) @Retention(RetentionPolicy.SOURCE) public @interface ActivityEventType{} private final @NonNull ComponentName mComponentName; private final @ActivityEventType int mType; /** @hide */ public ActivityEvent(@NonNull ComponentName componentName, @ActivityEventType int type) { mComponentName = componentName; mType = type; } /** * Gests the {@link ComponentName} of the activity associated with the event. */ @NonNull public ComponentName getComponentName() { return mComponentName; } /** * Gets the event type. * * @return either {@link #TYPE_ACTIVITY_RESUMED} or {@value #TYPE_ACTIVITY_PAUSED}. */ @ActivityEventType public int getEventType() { return mType; } /** @hide */ public static String getTypeAsString(@ActivityEventType int type) { switch (type) { case TYPE_ACTIVITY_RESUMED: return "ACTIVITY_RESUMED"; case TYPE_ACTIVITY_PAUSED: return "ACTIVITY_PAUSED"; default: return "UKNOWN_TYPE: " + type; } } @Override public String toString() { return new StringBuilder("ActivityEvent[").append(mComponentName.toShortString()) .append("]:").append(getTypeAsString(mType)).toString(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(@NonNull Parcel parcel, int flags) { parcel.writeParcelable(mComponentName, flags); parcel.writeInt(mType); } public static final @android.annotation.NonNull Creator<ActivityEvent> CREATOR = new Creator<ActivityEvent>() { @Override @NonNull public ActivityEvent createFromParcel(@NonNull Parcel parcel) { final ComponentName componentName = parcel.readParcelable(null); final int eventType = parcel.readInt(); return new ActivityEvent(componentName, eventType); } @Override @NonNull public ActivityEvent[] newArray(int size) { return new ActivityEvent[size]; } }; }
core/java/android/service/contentcapture/ContentCaptureService.java +26 −1 Original line number Diff line number Diff line Loading @@ -126,6 +126,13 @@ public abstract class ContentCaptureService extends Service { obtainMessage(ContentCaptureService::handleOnUserDataRemovalRequest, ContentCaptureService.this, request)); } @Override public void onActivityEvent(ActivityEvent event) { mHandler.sendMessage(obtainMessage(ContentCaptureService::handleOnActivityEvent, ContentCaptureService.this, event)); } }; /** Loading Loading @@ -247,7 +254,21 @@ public abstract class ContentCaptureService extends Service { * @param snapshotData the data */ public void onActivitySnapshot(@NonNull ContentCaptureSessionId sessionId, @NonNull SnapshotData snapshotData) {} @NonNull SnapshotData snapshotData) { if (sVerbose) Log.v(TAG, "onActivitySnapshot(id=" + sessionId + ")"); } /** * Notifies the service of an activity-level event that is not associated with a session. * * <p>This method can be used to track some high-level events for all activities, even those * that are not whitelisted for Content Capture. * * @param event high-level activity event */ public void onActivityEvent(@NonNull ActivityEvent event) { if (sVerbose) Log.v(TAG, "onActivityEvent(): " + event); } /** * Destroys the content capture session. Loading Loading @@ -383,6 +404,10 @@ public abstract class ContentCaptureService extends Service { onUserDataRemovalRequest(request); } private void handleOnActivityEvent(@NonNull ActivityEvent event) { onActivityEvent(event); } /** * Checks if the given {@code uid} owns the session associated with the event. */ Loading