Loading core/java/android/window/ITaskFragmentOrganizer.aidl +17 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.window; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; import android.os.IBinder; Loading Loading @@ -48,4 +49,20 @@ oneway interface ITaskFragmentOrganizer { * {@link TaskFragmentOrganizer#putExceptionInBundle}. */ void onTaskFragmentError(in IBinder errorCallbackToken, in Bundle exceptionBundle); /** * Called when an Activity is reparented to the Task with organized TaskFragment. For example, * when an Activity enters and then exits Picture-in-picture, it will be reparented back to its * orginial Task. In this case, we need to notify the organizer so that it can check if the * Activity matches any split rule. * * @param taskId The Task that the activity is reparented to. * @param activityIntent The intent that the activity is original launched with. * @param activityToken If the activity belongs to the same process as the organizer, this * will be the actual activity token; if the activity belongs to a * different process, the server will generate a temporary token that * the organizer can use to reparent the activity through * {@link WindowContainerTransaction} if needed. */ void onActivityReparentToTask(int taskId, in Intent activityIntent, in IBinder activityToken); } core/java/android/window/TaskFragmentOrganizer.java +27 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.window; import android.annotation.CallSuper; import android.annotation.NonNull; import android.annotation.TestApi; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; import android.os.IBinder; Loading Loading @@ -154,6 +155,24 @@ public class TaskFragmentOrganizer extends WindowOrganizer { public void onTaskFragmentError( @NonNull IBinder errorCallbackToken, @NonNull Throwable exception) {} /** * Called when an Activity is reparented to the Task with organized TaskFragment. For example, * when an Activity enters and then exits Picture-in-picture, it will be reparented back to its * orginial Task. In this case, we need to notify the organizer so that it can check if the * Activity matches any split rule. * * @param taskId The Task that the activity is reparented to. * @param activityIntent The intent that the activity is original launched with. * @param activityToken If the activity belongs to the same process as the organizer, this * will be the actual activity token; if the activity belongs to a * different process, the server will generate a temporary token that * the organizer can use to reparent the activity through * {@link WindowContainerTransaction} if needed. * @hide */ public void onActivityReparentToTask(int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken) {} @Override public void applyTransaction(@NonNull WindowContainerTransaction t) { t.setTaskFragmentOrganizer(mInterface); Loading Loading @@ -203,6 +222,14 @@ public class TaskFragmentOrganizer extends WindowOrganizer { errorCallbackToken, (Throwable) exceptionBundle.getSerializable(KEY_ERROR_CALLBACK_EXCEPTION))); } @Override public void onActivityReparentToTask(int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken) { mExecutor.execute( () -> TaskFragmentOrganizer.this.onActivityReparentToTask( taskId, activityIntent, activityToken)); } }; private final TaskFragmentOrganizerToken mToken = new TaskFragmentOrganizerToken(mInterface); Loading data/etc/services.core.protolog.json +6 −0 Original line number Diff line number Diff line Loading @@ -3031,6 +3031,12 @@ "group": "WM_DEBUG_FOCUS_LIGHT", "at": "com\/android\/server\/wm\/DisplayContent.java" }, "873160948": { "message": "Activity=%s reparent to taskId=%d", "level": "VERBOSE", "group": "WM_DEBUG_WINDOW_ORGANIZER", "at": "com\/android\/server\/wm\/TaskFragmentOrganizerController.java" }, "873914452": { "message": "goodToGo()", "level": "DEBUG", Loading libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/JetpackTaskFragmentOrganizer.java +10 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer { void onTaskFragmentVanished(@NonNull TaskFragmentInfo taskFragmentInfo); void onTaskFragmentParentInfoChanged(@NonNull IBinder fragmentToken, @NonNull Configuration parentConfig); void onActivityReparentToTask(int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken); } /** Loading Loading @@ -300,4 +302,12 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer { mCallback.onTaskFragmentParentInfoChanged(fragmentToken, parentConfig); } } @Override public void onActivityReparentToTask(int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken) { if (mCallback != null) { mCallback.onActivityReparentToTask(taskId, activityIntent, activityToken); } } } libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java +13 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,19 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen } } @Override public void onActivityReparentToTask(int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken) { // If the activity belongs to the current app process, we treat it as a new activity launch. final Activity activity = ActivityThread.currentActivityThread().getActivity(activityToken); if (activity != null) { onActivityCreated(activity); updateCallbackIfNecessary(); return; } // TODO: handle for activity in other process. } /** Called on receiving {@link #onTaskFragmentVanished(TaskFragmentInfo)} for cleanup. */ private void cleanupTaskFragment(@NonNull IBinder taskFragmentToken) { for (int i = mTaskContainers.size() - 1; i >= 0; i--) { Loading Loading
core/java/android/window/ITaskFragmentOrganizer.aidl +17 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.window; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; import android.os.IBinder; Loading Loading @@ -48,4 +49,20 @@ oneway interface ITaskFragmentOrganizer { * {@link TaskFragmentOrganizer#putExceptionInBundle}. */ void onTaskFragmentError(in IBinder errorCallbackToken, in Bundle exceptionBundle); /** * Called when an Activity is reparented to the Task with organized TaskFragment. For example, * when an Activity enters and then exits Picture-in-picture, it will be reparented back to its * orginial Task. In this case, we need to notify the organizer so that it can check if the * Activity matches any split rule. * * @param taskId The Task that the activity is reparented to. * @param activityIntent The intent that the activity is original launched with. * @param activityToken If the activity belongs to the same process as the organizer, this * will be the actual activity token; if the activity belongs to a * different process, the server will generate a temporary token that * the organizer can use to reparent the activity through * {@link WindowContainerTransaction} if needed. */ void onActivityReparentToTask(int taskId, in Intent activityIntent, in IBinder activityToken); }
core/java/android/window/TaskFragmentOrganizer.java +27 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.window; import android.annotation.CallSuper; import android.annotation.NonNull; import android.annotation.TestApi; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; import android.os.IBinder; Loading Loading @@ -154,6 +155,24 @@ public class TaskFragmentOrganizer extends WindowOrganizer { public void onTaskFragmentError( @NonNull IBinder errorCallbackToken, @NonNull Throwable exception) {} /** * Called when an Activity is reparented to the Task with organized TaskFragment. For example, * when an Activity enters and then exits Picture-in-picture, it will be reparented back to its * orginial Task. In this case, we need to notify the organizer so that it can check if the * Activity matches any split rule. * * @param taskId The Task that the activity is reparented to. * @param activityIntent The intent that the activity is original launched with. * @param activityToken If the activity belongs to the same process as the organizer, this * will be the actual activity token; if the activity belongs to a * different process, the server will generate a temporary token that * the organizer can use to reparent the activity through * {@link WindowContainerTransaction} if needed. * @hide */ public void onActivityReparentToTask(int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken) {} @Override public void applyTransaction(@NonNull WindowContainerTransaction t) { t.setTaskFragmentOrganizer(mInterface); Loading Loading @@ -203,6 +222,14 @@ public class TaskFragmentOrganizer extends WindowOrganizer { errorCallbackToken, (Throwable) exceptionBundle.getSerializable(KEY_ERROR_CALLBACK_EXCEPTION))); } @Override public void onActivityReparentToTask(int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken) { mExecutor.execute( () -> TaskFragmentOrganizer.this.onActivityReparentToTask( taskId, activityIntent, activityToken)); } }; private final TaskFragmentOrganizerToken mToken = new TaskFragmentOrganizerToken(mInterface); Loading
data/etc/services.core.protolog.json +6 −0 Original line number Diff line number Diff line Loading @@ -3031,6 +3031,12 @@ "group": "WM_DEBUG_FOCUS_LIGHT", "at": "com\/android\/server\/wm\/DisplayContent.java" }, "873160948": { "message": "Activity=%s reparent to taskId=%d", "level": "VERBOSE", "group": "WM_DEBUG_WINDOW_ORGANIZER", "at": "com\/android\/server\/wm\/TaskFragmentOrganizerController.java" }, "873914452": { "message": "goodToGo()", "level": "DEBUG", Loading
libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/JetpackTaskFragmentOrganizer.java +10 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer { void onTaskFragmentVanished(@NonNull TaskFragmentInfo taskFragmentInfo); void onTaskFragmentParentInfoChanged(@NonNull IBinder fragmentToken, @NonNull Configuration parentConfig); void onActivityReparentToTask(int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken); } /** Loading Loading @@ -300,4 +302,12 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer { mCallback.onTaskFragmentParentInfoChanged(fragmentToken, parentConfig); } } @Override public void onActivityReparentToTask(int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken) { if (mCallback != null) { mCallback.onActivityReparentToTask(taskId, activityIntent, activityToken); } } }
libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java +13 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,19 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen } } @Override public void onActivityReparentToTask(int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken) { // If the activity belongs to the current app process, we treat it as a new activity launch. final Activity activity = ActivityThread.currentActivityThread().getActivity(activityToken); if (activity != null) { onActivityCreated(activity); updateCallbackIfNecessary(); return; } // TODO: handle for activity in other process. } /** Called on receiving {@link #onTaskFragmentVanished(TaskFragmentInfo)} for cleanup. */ private void cleanupTaskFragment(@NonNull IBinder taskFragmentToken) { for (int i = mTaskContainers.size() - 1; i >= 0; i--) { Loading