Loading core/api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -3448,7 +3448,7 @@ package android.companion.virtual { } public static interface VirtualDeviceManager.ActivityListener { method @FlaggedApi("android.companion.virtualdevice.flags.activity_control_api") public default void onActivityLaunchBlocked(int, @NonNull android.content.ComponentName, int); method @FlaggedApi("android.companion.virtualdevice.flags.activity_control_api") public default void onActivityLaunchBlocked(int, @NonNull android.content.ComponentName, int, @Nullable android.content.IntentSender); method public void onDisplayEmpty(int); method @Deprecated public void onTopActivityChanged(int, @NonNull android.content.ComponentName); method public default void onTopActivityChanged(int, @NonNull android.content.ComponentName, int); core/java/android/companion/virtual/IVirtualDeviceActivityListener.aidl +4 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.companion.virtual; import android.content.ComponentName; import android.content.IntentSender; /** * Interface to listen for activity changes in a virtual device. Loading Loading @@ -48,6 +49,8 @@ oneway interface IVirtualDeviceActivityListener { * @param displayId The display ID on which the activity tried to launch. * @param componentName The component name of the blocked activity. * @param userId The user ID associated with the blocked activity. * @param intentSender The original sender of the intent. */ void onActivityLaunchBlocked(int displayId, in ComponentName componentName, int userId); void onActivityLaunchBlocked(int displayId, in ComponentName componentName, int userId, in IntentSender intentSender); } core/java/android/companion/virtual/VirtualDeviceInternal.java +7 −4 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.IntentSender; import android.hardware.display.DisplayManagerGlobal; import android.hardware.display.IVirtualDisplayCallback; import android.hardware.display.VirtualDisplay; Loading Loading @@ -135,13 +136,14 @@ public class VirtualDeviceInternal { @Override public void onActivityLaunchBlocked(int displayId, ComponentName componentName, @UserIdInt int userId) { @UserIdInt int userId, IntentSender intentSender) { final long token = Binder.clearCallingIdentity(); try { synchronized (mActivityListenersLock) { for (int i = 0; i < mActivityListeners.size(); i++) { mActivityListeners.valueAt(i) .onActivityLaunchBlocked(displayId, componentName, userId); .onActivityLaunchBlocked( displayId, componentName, userId, intentSender); } } } finally { Loading Loading @@ -593,9 +595,10 @@ public class VirtualDeviceInternal { } public void onActivityLaunchBlocked(int displayId, ComponentName componentName, @UserIdInt int userId) { @UserIdInt int userId, IntentSender intentSender) { mExecutor.execute(() -> mActivityListener.onActivityLaunchBlocked(displayId, componentName, userId)); mActivityListener.onActivityLaunchBlocked( displayId, componentName, userId, intentSender)); } } Loading core/java/android/companion/virtual/VirtualDeviceManager.java +7 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.IntentSender; import android.graphics.Point; import android.hardware.display.DisplayManager; import android.hardware.display.DisplayManager.VirtualDisplayFlag; Loading Loading @@ -1264,13 +1265,18 @@ public final class VirtualDeviceManager { * @param displayId The display ID on which the activity tried to launch. * @param componentName The component name of the blocked activity. * @param userId The user ID associated with the blocked activity. * @param intentSender The original sender of the intent. May be {@code null} if the sender * expects an activity result to be reported. In that case * {@link android.app.Activity#RESULT_CANCELED} was already reported back because the * launch was blocked. This {@link IntentSender} can be used to relaunch the blocked * activity to a different display. * * @see VirtualDeviceParams#POLICY_TYPE_ACTIVITY * @see VirtualDevice#addActivityPolicyExemption(ComponentName) */ @FlaggedApi(android.companion.virtualdevice.flags.Flags.FLAG_ACTIVITY_CONTROL_API) default void onActivityLaunchBlocked(int displayId, @NonNull ComponentName componentName, @UserIdInt int userId) {} @UserIdInt int userId, @Nullable IntentSender intentSender) {} } /** Loading core/java/android/window/DisplayWindowPolicyController.java +7 −1 Original line number Diff line number Diff line Loading @@ -25,12 +25,14 @@ import android.annotation.UserIdInt; import android.app.WindowConfiguration; import android.content.ComponentName; import android.content.Intent; import android.content.IntentSender; import android.content.pm.ActivityInfo; import android.util.ArraySet; import java.io.PrintWriter; import java.util.List; import java.util.Set; import java.util.function.Supplier; /** * Abstract class to control the policies of the windows that can be displayed on the virtual Loading Loading @@ -136,10 +138,14 @@ public abstract class DisplayWindowPolicyController { * Returns {@code true} if the given activity can be launched on this virtual display in the * configuration defined by the rest of the arguments. If the given intent would be intercepted * by the display owner then this means that the activity cannot be launched. * * The intentSender argument can provide an IntentSender for the original intent to be passed * to any activity listeners, in case the activity cannot be launched. */ public abstract boolean canActivityBeLaunched(@NonNull ActivityInfo activityInfo, @Nullable Intent intent, @WindowConfiguration.WindowingMode int windowingMode, int launchingFromDisplayId, boolean isNewTask); int launchingFromDisplayId, boolean isNewTask, boolean isResultExpected, @Nullable Supplier<IntentSender> intentSender); /** * Returns {@code true} if the given activity can be launched on this virtual display in the Loading Loading
core/api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -3448,7 +3448,7 @@ package android.companion.virtual { } public static interface VirtualDeviceManager.ActivityListener { method @FlaggedApi("android.companion.virtualdevice.flags.activity_control_api") public default void onActivityLaunchBlocked(int, @NonNull android.content.ComponentName, int); method @FlaggedApi("android.companion.virtualdevice.flags.activity_control_api") public default void onActivityLaunchBlocked(int, @NonNull android.content.ComponentName, int, @Nullable android.content.IntentSender); method public void onDisplayEmpty(int); method @Deprecated public void onTopActivityChanged(int, @NonNull android.content.ComponentName); method public default void onTopActivityChanged(int, @NonNull android.content.ComponentName, int);
core/java/android/companion/virtual/IVirtualDeviceActivityListener.aidl +4 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.companion.virtual; import android.content.ComponentName; import android.content.IntentSender; /** * Interface to listen for activity changes in a virtual device. Loading Loading @@ -48,6 +49,8 @@ oneway interface IVirtualDeviceActivityListener { * @param displayId The display ID on which the activity tried to launch. * @param componentName The component name of the blocked activity. * @param userId The user ID associated with the blocked activity. * @param intentSender The original sender of the intent. */ void onActivityLaunchBlocked(int displayId, in ComponentName componentName, int userId); void onActivityLaunchBlocked(int displayId, in ComponentName componentName, int userId, in IntentSender intentSender); }
core/java/android/companion/virtual/VirtualDeviceInternal.java +7 −4 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.IntentSender; import android.hardware.display.DisplayManagerGlobal; import android.hardware.display.IVirtualDisplayCallback; import android.hardware.display.VirtualDisplay; Loading Loading @@ -135,13 +136,14 @@ public class VirtualDeviceInternal { @Override public void onActivityLaunchBlocked(int displayId, ComponentName componentName, @UserIdInt int userId) { @UserIdInt int userId, IntentSender intentSender) { final long token = Binder.clearCallingIdentity(); try { synchronized (mActivityListenersLock) { for (int i = 0; i < mActivityListeners.size(); i++) { mActivityListeners.valueAt(i) .onActivityLaunchBlocked(displayId, componentName, userId); .onActivityLaunchBlocked( displayId, componentName, userId, intentSender); } } } finally { Loading Loading @@ -593,9 +595,10 @@ public class VirtualDeviceInternal { } public void onActivityLaunchBlocked(int displayId, ComponentName componentName, @UserIdInt int userId) { @UserIdInt int userId, IntentSender intentSender) { mExecutor.execute(() -> mActivityListener.onActivityLaunchBlocked(displayId, componentName, userId)); mActivityListener.onActivityLaunchBlocked( displayId, componentName, userId, intentSender)); } } Loading
core/java/android/companion/virtual/VirtualDeviceManager.java +7 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.IntentSender; import android.graphics.Point; import android.hardware.display.DisplayManager; import android.hardware.display.DisplayManager.VirtualDisplayFlag; Loading Loading @@ -1264,13 +1265,18 @@ public final class VirtualDeviceManager { * @param displayId The display ID on which the activity tried to launch. * @param componentName The component name of the blocked activity. * @param userId The user ID associated with the blocked activity. * @param intentSender The original sender of the intent. May be {@code null} if the sender * expects an activity result to be reported. In that case * {@link android.app.Activity#RESULT_CANCELED} was already reported back because the * launch was blocked. This {@link IntentSender} can be used to relaunch the blocked * activity to a different display. * * @see VirtualDeviceParams#POLICY_TYPE_ACTIVITY * @see VirtualDevice#addActivityPolicyExemption(ComponentName) */ @FlaggedApi(android.companion.virtualdevice.flags.Flags.FLAG_ACTIVITY_CONTROL_API) default void onActivityLaunchBlocked(int displayId, @NonNull ComponentName componentName, @UserIdInt int userId) {} @UserIdInt int userId, @Nullable IntentSender intentSender) {} } /** Loading
core/java/android/window/DisplayWindowPolicyController.java +7 −1 Original line number Diff line number Diff line Loading @@ -25,12 +25,14 @@ import android.annotation.UserIdInt; import android.app.WindowConfiguration; import android.content.ComponentName; import android.content.Intent; import android.content.IntentSender; import android.content.pm.ActivityInfo; import android.util.ArraySet; import java.io.PrintWriter; import java.util.List; import java.util.Set; import java.util.function.Supplier; /** * Abstract class to control the policies of the windows that can be displayed on the virtual Loading Loading @@ -136,10 +138,14 @@ public abstract class DisplayWindowPolicyController { * Returns {@code true} if the given activity can be launched on this virtual display in the * configuration defined by the rest of the arguments. If the given intent would be intercepted * by the display owner then this means that the activity cannot be launched. * * The intentSender argument can provide an IntentSender for the original intent to be passed * to any activity listeners, in case the activity cannot be launched. */ public abstract boolean canActivityBeLaunched(@NonNull ActivityInfo activityInfo, @Nullable Intent intent, @WindowConfiguration.WindowingMode int windowingMode, int launchingFromDisplayId, boolean isNewTask); int launchingFromDisplayId, boolean isNewTask, boolean isResultExpected, @Nullable Supplier<IntentSender> intentSender); /** * Returns {@code true} if the given activity can be launched on this virtual display in the Loading