Loading core/api/test-current.txt +6 −5 Original line number Diff line number Diff line Loading @@ -3333,11 +3333,12 @@ package android.window { ctor public TaskFragmentOrganizer(@NonNull java.util.concurrent.Executor); method @NonNull public java.util.concurrent.Executor getExecutor(); method @NonNull public android.window.TaskFragmentOrganizerToken getOrganizerToken(); method public void onTaskFragmentAppeared(@NonNull android.window.TaskFragmentInfo); method public void onTaskFragmentError(@NonNull android.os.IBinder, @Nullable android.window.TaskFragmentInfo, int, @NonNull Throwable); method public void onTaskFragmentInfoChanged(@NonNull android.window.TaskFragmentInfo); method public void onTaskFragmentParentInfoChanged(@NonNull android.os.IBinder, @NonNull android.content.res.Configuration); method public void onTaskFragmentVanished(@NonNull android.window.TaskFragmentInfo); method public void onActivityReparentedToTask(@NonNull android.window.WindowContainerTransaction, int, @NonNull android.content.Intent, @NonNull android.os.IBinder); method public void onTaskFragmentAppeared(@NonNull android.window.WindowContainerTransaction, @NonNull android.window.TaskFragmentInfo); method public void onTaskFragmentError(@NonNull android.window.WindowContainerTransaction, @NonNull android.os.IBinder, @Nullable android.window.TaskFragmentInfo, int, @NonNull Throwable); method public void onTaskFragmentInfoChanged(@NonNull android.window.WindowContainerTransaction, @NonNull android.window.TaskFragmentInfo); method public void onTaskFragmentParentInfoChanged(@NonNull android.window.WindowContainerTransaction, int, @NonNull android.content.res.Configuration); method public void onTaskFragmentVanished(@NonNull android.window.WindowContainerTransaction, @NonNull android.window.TaskFragmentInfo); method @CallSuper public void registerOrganizer(); method @CallSuper public void unregisterOrganizer(); } Loading core/java/android/window/TaskFragmentOrganizer.java +37 −67 Original line number Diff line number Diff line Loading @@ -26,16 +26,15 @@ import static android.window.TaskFragmentTransaction.TYPE_TASK_FRAGMENT_VANISHED import android.annotation.CallSuper; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SuppressLint; import android.annotation.TestApi; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; import android.util.SparseArray; import android.view.RemoteAnimationDefinition; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Executor; Loading Loading @@ -74,12 +73,6 @@ public class TaskFragmentOrganizer extends WindowOrganizer { */ private final Executor mExecutor; // TODO(b/240519866): doing so to keep CTS compatibility. Remove in the next release. /** Map from Task id to client tokens of TaskFragments in the Task. */ private final SparseArray<List<IBinder>> mTaskIdToFragmentTokens = new SparseArray<>(); /** Map from Task id to Task configuration. */ private final SparseArray<Configuration> mTaskIdToConfigurations = new SparseArray<>(); public TaskFragmentOrganizer(@NonNull Executor executor) { mExecutor = executor; } Loading Loading @@ -150,35 +143,32 @@ public class TaskFragmentOrganizer extends WindowOrganizer { /** * Called when a TaskFragment is created and organized by this organizer. * * @param wct The {@link WindowContainerTransaction} to make any changes with if needed. No * need to call {@link #applyTransaction} as it will be applied by the caller. * @param taskFragmentInfo Info of the TaskFragment that is created. */ public void onTaskFragmentAppeared(@NonNull TaskFragmentInfo taskFragmentInfo) {} public void onTaskFragmentAppeared(@NonNull WindowContainerTransaction wct, @NonNull TaskFragmentInfo taskFragmentInfo) {} /** * Called when the status of an organized TaskFragment is changed. * * @param wct The {@link WindowContainerTransaction} to make any changes with if needed. No * need to call {@link #applyTransaction} as it will be applied by the caller. * @param taskFragmentInfo Info of the TaskFragment that is changed. */ public void onTaskFragmentInfoChanged(@NonNull TaskFragmentInfo taskFragmentInfo) {} public void onTaskFragmentInfoChanged(@NonNull WindowContainerTransaction wct, @NonNull TaskFragmentInfo taskFragmentInfo) {} /** * Called when an organized TaskFragment is removed. * * @param wct The {@link WindowContainerTransaction} to make any changes with if needed. No * need to call {@link #applyTransaction} as it will be applied by the caller. * @param taskFragmentInfo Info of the TaskFragment that is removed. */ public void onTaskFragmentVanished(@NonNull TaskFragmentInfo taskFragmentInfo) {} /** * Called when the parent leaf Task of organized TaskFragments is changed. * When the leaf Task is changed, the organizer may want to update the TaskFragments in one * transaction. * * For case like screen size change, it will trigger onTaskFragmentParentInfoChanged with new * Task bounds, but may not trigger onTaskFragmentInfoChanged because there can be an override * bounds. */ public void onTaskFragmentParentInfoChanged( @NonNull IBinder fragmentToken, @NonNull Configuration parentConfig) {} public void onTaskFragmentVanished(@NonNull WindowContainerTransaction wct, @NonNull TaskFragmentInfo taskFragmentInfo) {} /** * Called when the parent leaf Task of organized TaskFragments is changed. Loading @@ -189,25 +179,20 @@ public class TaskFragmentOrganizer extends WindowOrganizer { * Task bounds, but may not trigger onTaskFragmentInfoChanged because there can be an override * bounds. * * @param wct The {@link WindowContainerTransaction} to make any changes with if needed. No * need to call {@link #applyTransaction} as it will be applied by the caller. * @param taskId Id of the parent Task that is changed. * @param parentConfig Config of the parent Task. * @hide */ public void onTaskFragmentParentInfoChanged(int taskId, @NonNull Configuration parentConfig) { // TODO(b/240519866): doing so to keep CTS compatibility. Remove in the next release. final List<IBinder> tokens = mTaskIdToFragmentTokens.get(taskId); if (tokens == null || tokens.isEmpty()) { return; } for (int i = tokens.size() - 1; i >= 0; i--) { onTaskFragmentParentInfoChanged(tokens.get(i), parentConfig); } } public void onTaskFragmentParentInfoChanged(@NonNull WindowContainerTransaction wct, int taskId, @NonNull Configuration parentConfig) {} /** * Called when the {@link WindowContainerTransaction} created with * {@link WindowContainerTransaction#setErrorCallbackToken(IBinder)} failed on the server side. * * @param wct The {@link WindowContainerTransaction} to make any changes with if needed. No * need to call {@link #applyTransaction} as it will be applied by the caller. * @param errorCallbackToken token set in * {@link WindowContainerTransaction#setErrorCallbackToken(IBinder)} * @param taskFragmentInfo The {@link TaskFragmentInfo}. This could be {@code null} if no Loading @@ -216,7 +201,7 @@ public class TaskFragmentOrganizer extends WindowOrganizer { * transaction operation. * @param exception exception from the server side. */ public void onTaskFragmentError( public void onTaskFragmentError(@NonNull WindowContainerTransaction wct, @NonNull IBinder errorCallbackToken, @Nullable TaskFragmentInfo taskFragmentInfo, int opType, @NonNull Throwable exception) {} Loading @@ -226,6 +211,8 @@ public class TaskFragmentOrganizer extends WindowOrganizer { * original Task. In this case, we need to notify the organizer so that it can check if the * Activity matches any split rule. * * @param wct The {@link WindowContainerTransaction} to make any changes with if needed. No * need to call {@link #applyTransaction} as it will be applied by the caller. * @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 Loading @@ -233,61 +220,41 @@ public class TaskFragmentOrganizer extends WindowOrganizer { * 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 onActivityReparentedToTask(int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken) {} public void onActivityReparentedToTask(@NonNull WindowContainerTransaction wct, int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken) {} /** * Called when the transaction is ready so that the organizer can update the TaskFragments based * on the changes in transaction. * Note: {@link WindowOrganizer#applyTransaction} permission requirement is conditional for * {@link TaskFragmentOrganizer}. * @see com.android.server.wm.WindowOrganizerController#enforceTaskPermission * @hide */ @SuppressLint("AndroidFrameworkRequiresPermission") public void onTransactionReady(@NonNull TaskFragmentTransaction transaction) { final WindowContainerTransaction wct = new WindowContainerTransaction(); final List<TaskFragmentTransaction.Change> changes = transaction.getChanges(); for (TaskFragmentTransaction.Change change : changes) { // TODO(b/240519866): apply all changes in one WCT. final int taskId = change.getTaskId(); switch (change.getType()) { case TYPE_TASK_FRAGMENT_APPEARED: // TODO(b/240519866): doing so to keep CTS compatibility. Remove in the next // release. if (!mTaskIdToFragmentTokens.contains(taskId)) { mTaskIdToFragmentTokens.put(taskId, new ArrayList<>()); } mTaskIdToFragmentTokens.get(taskId).add(change.getTaskFragmentToken()); onTaskFragmentParentInfoChanged(change.getTaskFragmentToken(), mTaskIdToConfigurations.get(taskId)); onTaskFragmentAppeared(change.getTaskFragmentInfo()); onTaskFragmentAppeared(wct, change.getTaskFragmentInfo()); break; case TYPE_TASK_FRAGMENT_INFO_CHANGED: onTaskFragmentInfoChanged(change.getTaskFragmentInfo()); onTaskFragmentInfoChanged(wct, change.getTaskFragmentInfo()); break; case TYPE_TASK_FRAGMENT_VANISHED: // TODO(b/240519866): doing so to keep CTS compatibility. Remove in the next // release. if (mTaskIdToFragmentTokens.contains(taskId)) { final List<IBinder> tokens = mTaskIdToFragmentTokens.get(taskId); tokens.remove(change.getTaskFragmentToken()); if (tokens.isEmpty()) { mTaskIdToFragmentTokens.remove(taskId); mTaskIdToConfigurations.remove(taskId); } } onTaskFragmentVanished(change.getTaskFragmentInfo()); onTaskFragmentVanished(wct, change.getTaskFragmentInfo()); break; case TYPE_TASK_FRAGMENT_PARENT_INFO_CHANGED: // TODO(b/240519866): doing so to keep CTS compatibility. Remove in the next // release. mTaskIdToConfigurations.put(taskId, change.getTaskConfiguration()); onTaskFragmentParentInfoChanged(taskId, change.getTaskConfiguration()); onTaskFragmentParentInfoChanged(wct, taskId, change.getTaskConfiguration()); break; case TYPE_TASK_FRAGMENT_ERROR: final Bundle errorBundle = change.getErrorBundle(); onTaskFragmentError( wct, change.getErrorCallbackToken(), errorBundle.getParcelable( KEY_ERROR_CALLBACK_TASK_FRAGMENT_INFO, TaskFragmentInfo.class), Loading @@ -297,6 +264,7 @@ public class TaskFragmentOrganizer extends WindowOrganizer { break; case TYPE_ACTIVITY_REPARENTED_TO_TASK: onActivityReparentedToTask( wct, change.getTaskId(), change.getActivityIntent(), change.getActivityToken()); Loading @@ -306,6 +274,8 @@ public class TaskFragmentOrganizer extends WindowOrganizer { "Unknown TaskFragmentEvent=" + change.getType()); } } // TODO(b/240519866): notify TaskFragmentOrganizerController that the transition is done. applyTransaction(wct); } @Override Loading libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/JetpackTaskFragmentOrganizer.java +12 −19 Original line number Diff line number Diff line Loading @@ -271,56 +271,49 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer { } @Override public void onTaskFragmentAppeared(@NonNull TaskFragmentInfo taskFragmentInfo) { final WindowContainerTransaction wct = new WindowContainerTransaction(); public void onTaskFragmentAppeared(@NonNull WindowContainerTransaction wct, @NonNull TaskFragmentInfo taskFragmentInfo) { final IBinder fragmentToken = taskFragmentInfo.getFragmentToken(); mFragmentInfos.put(fragmentToken, taskFragmentInfo); mCallback.onTaskFragmentAppeared(wct, taskFragmentInfo); applyTransaction(wct); } @Override public void onTaskFragmentInfoChanged(@NonNull TaskFragmentInfo taskFragmentInfo) { final WindowContainerTransaction wct = new WindowContainerTransaction(); public void onTaskFragmentInfoChanged(@NonNull WindowContainerTransaction wct, @NonNull TaskFragmentInfo taskFragmentInfo) { final IBinder fragmentToken = taskFragmentInfo.getFragmentToken(); mFragmentInfos.put(fragmentToken, taskFragmentInfo); mCallback.onTaskFragmentInfoChanged(wct, taskFragmentInfo); applyTransaction(wct); } @Override public void onTaskFragmentVanished(@NonNull TaskFragmentInfo taskFragmentInfo) { final WindowContainerTransaction wct = new WindowContainerTransaction(); public void onTaskFragmentVanished(@NonNull WindowContainerTransaction wct, @NonNull TaskFragmentInfo taskFragmentInfo) { mFragmentInfos.remove(taskFragmentInfo.getFragmentToken()); mCallback.onTaskFragmentVanished(wct, taskFragmentInfo); applyTransaction(wct); } @Override public void onTaskFragmentParentInfoChanged(int taskId, @NonNull Configuration parentConfig) { final WindowContainerTransaction wct = new WindowContainerTransaction(); public void onTaskFragmentParentInfoChanged(@NonNull WindowContainerTransaction wct, int taskId, @NonNull Configuration parentConfig) { mCallback.onTaskFragmentParentInfoChanged(wct, taskId, parentConfig); applyTransaction(wct); } @Override public void onActivityReparentedToTask(int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken) { final WindowContainerTransaction wct = new WindowContainerTransaction(); public void onActivityReparentedToTask(@NonNull WindowContainerTransaction wct, int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken) { mCallback.onActivityReparentedToTask(wct, taskId, activityIntent, activityToken); applyTransaction(wct); } @Override public void onTaskFragmentError(@NonNull IBinder errorCallbackToken, public void onTaskFragmentError(@NonNull WindowContainerTransaction wct, @NonNull IBinder errorCallbackToken, @Nullable TaskFragmentInfo taskFragmentInfo, int opType, @NonNull Throwable exception) { final WindowContainerTransaction wct = new WindowContainerTransaction(); if (taskFragmentInfo != null) { final IBinder fragmentToken = taskFragmentInfo.getFragmentToken(); mFragmentInfos.put(fragmentToken, taskFragmentInfo); } mCallback.onTaskFragmentError(wct, taskFragmentInfo, opType); applyTransaction(wct); } } services/tests/wmtests/src/com/android/server/wm/TaskFragmentOrganizerControllerTest.java +35 −35 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
core/api/test-current.txt +6 −5 Original line number Diff line number Diff line Loading @@ -3333,11 +3333,12 @@ package android.window { ctor public TaskFragmentOrganizer(@NonNull java.util.concurrent.Executor); method @NonNull public java.util.concurrent.Executor getExecutor(); method @NonNull public android.window.TaskFragmentOrganizerToken getOrganizerToken(); method public void onTaskFragmentAppeared(@NonNull android.window.TaskFragmentInfo); method public void onTaskFragmentError(@NonNull android.os.IBinder, @Nullable android.window.TaskFragmentInfo, int, @NonNull Throwable); method public void onTaskFragmentInfoChanged(@NonNull android.window.TaskFragmentInfo); method public void onTaskFragmentParentInfoChanged(@NonNull android.os.IBinder, @NonNull android.content.res.Configuration); method public void onTaskFragmentVanished(@NonNull android.window.TaskFragmentInfo); method public void onActivityReparentedToTask(@NonNull android.window.WindowContainerTransaction, int, @NonNull android.content.Intent, @NonNull android.os.IBinder); method public void onTaskFragmentAppeared(@NonNull android.window.WindowContainerTransaction, @NonNull android.window.TaskFragmentInfo); method public void onTaskFragmentError(@NonNull android.window.WindowContainerTransaction, @NonNull android.os.IBinder, @Nullable android.window.TaskFragmentInfo, int, @NonNull Throwable); method public void onTaskFragmentInfoChanged(@NonNull android.window.WindowContainerTransaction, @NonNull android.window.TaskFragmentInfo); method public void onTaskFragmentParentInfoChanged(@NonNull android.window.WindowContainerTransaction, int, @NonNull android.content.res.Configuration); method public void onTaskFragmentVanished(@NonNull android.window.WindowContainerTransaction, @NonNull android.window.TaskFragmentInfo); method @CallSuper public void registerOrganizer(); method @CallSuper public void unregisterOrganizer(); } Loading
core/java/android/window/TaskFragmentOrganizer.java +37 −67 Original line number Diff line number Diff line Loading @@ -26,16 +26,15 @@ import static android.window.TaskFragmentTransaction.TYPE_TASK_FRAGMENT_VANISHED import android.annotation.CallSuper; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SuppressLint; import android.annotation.TestApi; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; import android.util.SparseArray; import android.view.RemoteAnimationDefinition; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Executor; Loading Loading @@ -74,12 +73,6 @@ public class TaskFragmentOrganizer extends WindowOrganizer { */ private final Executor mExecutor; // TODO(b/240519866): doing so to keep CTS compatibility. Remove in the next release. /** Map from Task id to client tokens of TaskFragments in the Task. */ private final SparseArray<List<IBinder>> mTaskIdToFragmentTokens = new SparseArray<>(); /** Map from Task id to Task configuration. */ private final SparseArray<Configuration> mTaskIdToConfigurations = new SparseArray<>(); public TaskFragmentOrganizer(@NonNull Executor executor) { mExecutor = executor; } Loading Loading @@ -150,35 +143,32 @@ public class TaskFragmentOrganizer extends WindowOrganizer { /** * Called when a TaskFragment is created and organized by this organizer. * * @param wct The {@link WindowContainerTransaction} to make any changes with if needed. No * need to call {@link #applyTransaction} as it will be applied by the caller. * @param taskFragmentInfo Info of the TaskFragment that is created. */ public void onTaskFragmentAppeared(@NonNull TaskFragmentInfo taskFragmentInfo) {} public void onTaskFragmentAppeared(@NonNull WindowContainerTransaction wct, @NonNull TaskFragmentInfo taskFragmentInfo) {} /** * Called when the status of an organized TaskFragment is changed. * * @param wct The {@link WindowContainerTransaction} to make any changes with if needed. No * need to call {@link #applyTransaction} as it will be applied by the caller. * @param taskFragmentInfo Info of the TaskFragment that is changed. */ public void onTaskFragmentInfoChanged(@NonNull TaskFragmentInfo taskFragmentInfo) {} public void onTaskFragmentInfoChanged(@NonNull WindowContainerTransaction wct, @NonNull TaskFragmentInfo taskFragmentInfo) {} /** * Called when an organized TaskFragment is removed. * * @param wct The {@link WindowContainerTransaction} to make any changes with if needed. No * need to call {@link #applyTransaction} as it will be applied by the caller. * @param taskFragmentInfo Info of the TaskFragment that is removed. */ public void onTaskFragmentVanished(@NonNull TaskFragmentInfo taskFragmentInfo) {} /** * Called when the parent leaf Task of organized TaskFragments is changed. * When the leaf Task is changed, the organizer may want to update the TaskFragments in one * transaction. * * For case like screen size change, it will trigger onTaskFragmentParentInfoChanged with new * Task bounds, but may not trigger onTaskFragmentInfoChanged because there can be an override * bounds. */ public void onTaskFragmentParentInfoChanged( @NonNull IBinder fragmentToken, @NonNull Configuration parentConfig) {} public void onTaskFragmentVanished(@NonNull WindowContainerTransaction wct, @NonNull TaskFragmentInfo taskFragmentInfo) {} /** * Called when the parent leaf Task of organized TaskFragments is changed. Loading @@ -189,25 +179,20 @@ public class TaskFragmentOrganizer extends WindowOrganizer { * Task bounds, but may not trigger onTaskFragmentInfoChanged because there can be an override * bounds. * * @param wct The {@link WindowContainerTransaction} to make any changes with if needed. No * need to call {@link #applyTransaction} as it will be applied by the caller. * @param taskId Id of the parent Task that is changed. * @param parentConfig Config of the parent Task. * @hide */ public void onTaskFragmentParentInfoChanged(int taskId, @NonNull Configuration parentConfig) { // TODO(b/240519866): doing so to keep CTS compatibility. Remove in the next release. final List<IBinder> tokens = mTaskIdToFragmentTokens.get(taskId); if (tokens == null || tokens.isEmpty()) { return; } for (int i = tokens.size() - 1; i >= 0; i--) { onTaskFragmentParentInfoChanged(tokens.get(i), parentConfig); } } public void onTaskFragmentParentInfoChanged(@NonNull WindowContainerTransaction wct, int taskId, @NonNull Configuration parentConfig) {} /** * Called when the {@link WindowContainerTransaction} created with * {@link WindowContainerTransaction#setErrorCallbackToken(IBinder)} failed on the server side. * * @param wct The {@link WindowContainerTransaction} to make any changes with if needed. No * need to call {@link #applyTransaction} as it will be applied by the caller. * @param errorCallbackToken token set in * {@link WindowContainerTransaction#setErrorCallbackToken(IBinder)} * @param taskFragmentInfo The {@link TaskFragmentInfo}. This could be {@code null} if no Loading @@ -216,7 +201,7 @@ public class TaskFragmentOrganizer extends WindowOrganizer { * transaction operation. * @param exception exception from the server side. */ public void onTaskFragmentError( public void onTaskFragmentError(@NonNull WindowContainerTransaction wct, @NonNull IBinder errorCallbackToken, @Nullable TaskFragmentInfo taskFragmentInfo, int opType, @NonNull Throwable exception) {} Loading @@ -226,6 +211,8 @@ public class TaskFragmentOrganizer extends WindowOrganizer { * original Task. In this case, we need to notify the organizer so that it can check if the * Activity matches any split rule. * * @param wct The {@link WindowContainerTransaction} to make any changes with if needed. No * need to call {@link #applyTransaction} as it will be applied by the caller. * @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 Loading @@ -233,61 +220,41 @@ public class TaskFragmentOrganizer extends WindowOrganizer { * 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 onActivityReparentedToTask(int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken) {} public void onActivityReparentedToTask(@NonNull WindowContainerTransaction wct, int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken) {} /** * Called when the transaction is ready so that the organizer can update the TaskFragments based * on the changes in transaction. * Note: {@link WindowOrganizer#applyTransaction} permission requirement is conditional for * {@link TaskFragmentOrganizer}. * @see com.android.server.wm.WindowOrganizerController#enforceTaskPermission * @hide */ @SuppressLint("AndroidFrameworkRequiresPermission") public void onTransactionReady(@NonNull TaskFragmentTransaction transaction) { final WindowContainerTransaction wct = new WindowContainerTransaction(); final List<TaskFragmentTransaction.Change> changes = transaction.getChanges(); for (TaskFragmentTransaction.Change change : changes) { // TODO(b/240519866): apply all changes in one WCT. final int taskId = change.getTaskId(); switch (change.getType()) { case TYPE_TASK_FRAGMENT_APPEARED: // TODO(b/240519866): doing so to keep CTS compatibility. Remove in the next // release. if (!mTaskIdToFragmentTokens.contains(taskId)) { mTaskIdToFragmentTokens.put(taskId, new ArrayList<>()); } mTaskIdToFragmentTokens.get(taskId).add(change.getTaskFragmentToken()); onTaskFragmentParentInfoChanged(change.getTaskFragmentToken(), mTaskIdToConfigurations.get(taskId)); onTaskFragmentAppeared(change.getTaskFragmentInfo()); onTaskFragmentAppeared(wct, change.getTaskFragmentInfo()); break; case TYPE_TASK_FRAGMENT_INFO_CHANGED: onTaskFragmentInfoChanged(change.getTaskFragmentInfo()); onTaskFragmentInfoChanged(wct, change.getTaskFragmentInfo()); break; case TYPE_TASK_FRAGMENT_VANISHED: // TODO(b/240519866): doing so to keep CTS compatibility. Remove in the next // release. if (mTaskIdToFragmentTokens.contains(taskId)) { final List<IBinder> tokens = mTaskIdToFragmentTokens.get(taskId); tokens.remove(change.getTaskFragmentToken()); if (tokens.isEmpty()) { mTaskIdToFragmentTokens.remove(taskId); mTaskIdToConfigurations.remove(taskId); } } onTaskFragmentVanished(change.getTaskFragmentInfo()); onTaskFragmentVanished(wct, change.getTaskFragmentInfo()); break; case TYPE_TASK_FRAGMENT_PARENT_INFO_CHANGED: // TODO(b/240519866): doing so to keep CTS compatibility. Remove in the next // release. mTaskIdToConfigurations.put(taskId, change.getTaskConfiguration()); onTaskFragmentParentInfoChanged(taskId, change.getTaskConfiguration()); onTaskFragmentParentInfoChanged(wct, taskId, change.getTaskConfiguration()); break; case TYPE_TASK_FRAGMENT_ERROR: final Bundle errorBundle = change.getErrorBundle(); onTaskFragmentError( wct, change.getErrorCallbackToken(), errorBundle.getParcelable( KEY_ERROR_CALLBACK_TASK_FRAGMENT_INFO, TaskFragmentInfo.class), Loading @@ -297,6 +264,7 @@ public class TaskFragmentOrganizer extends WindowOrganizer { break; case TYPE_ACTIVITY_REPARENTED_TO_TASK: onActivityReparentedToTask( wct, change.getTaskId(), change.getActivityIntent(), change.getActivityToken()); Loading @@ -306,6 +274,8 @@ public class TaskFragmentOrganizer extends WindowOrganizer { "Unknown TaskFragmentEvent=" + change.getType()); } } // TODO(b/240519866): notify TaskFragmentOrganizerController that the transition is done. applyTransaction(wct); } @Override Loading
libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/JetpackTaskFragmentOrganizer.java +12 −19 Original line number Diff line number Diff line Loading @@ -271,56 +271,49 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer { } @Override public void onTaskFragmentAppeared(@NonNull TaskFragmentInfo taskFragmentInfo) { final WindowContainerTransaction wct = new WindowContainerTransaction(); public void onTaskFragmentAppeared(@NonNull WindowContainerTransaction wct, @NonNull TaskFragmentInfo taskFragmentInfo) { final IBinder fragmentToken = taskFragmentInfo.getFragmentToken(); mFragmentInfos.put(fragmentToken, taskFragmentInfo); mCallback.onTaskFragmentAppeared(wct, taskFragmentInfo); applyTransaction(wct); } @Override public void onTaskFragmentInfoChanged(@NonNull TaskFragmentInfo taskFragmentInfo) { final WindowContainerTransaction wct = new WindowContainerTransaction(); public void onTaskFragmentInfoChanged(@NonNull WindowContainerTransaction wct, @NonNull TaskFragmentInfo taskFragmentInfo) { final IBinder fragmentToken = taskFragmentInfo.getFragmentToken(); mFragmentInfos.put(fragmentToken, taskFragmentInfo); mCallback.onTaskFragmentInfoChanged(wct, taskFragmentInfo); applyTransaction(wct); } @Override public void onTaskFragmentVanished(@NonNull TaskFragmentInfo taskFragmentInfo) { final WindowContainerTransaction wct = new WindowContainerTransaction(); public void onTaskFragmentVanished(@NonNull WindowContainerTransaction wct, @NonNull TaskFragmentInfo taskFragmentInfo) { mFragmentInfos.remove(taskFragmentInfo.getFragmentToken()); mCallback.onTaskFragmentVanished(wct, taskFragmentInfo); applyTransaction(wct); } @Override public void onTaskFragmentParentInfoChanged(int taskId, @NonNull Configuration parentConfig) { final WindowContainerTransaction wct = new WindowContainerTransaction(); public void onTaskFragmentParentInfoChanged(@NonNull WindowContainerTransaction wct, int taskId, @NonNull Configuration parentConfig) { mCallback.onTaskFragmentParentInfoChanged(wct, taskId, parentConfig); applyTransaction(wct); } @Override public void onActivityReparentedToTask(int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken) { final WindowContainerTransaction wct = new WindowContainerTransaction(); public void onActivityReparentedToTask(@NonNull WindowContainerTransaction wct, int taskId, @NonNull Intent activityIntent, @NonNull IBinder activityToken) { mCallback.onActivityReparentedToTask(wct, taskId, activityIntent, activityToken); applyTransaction(wct); } @Override public void onTaskFragmentError(@NonNull IBinder errorCallbackToken, public void onTaskFragmentError(@NonNull WindowContainerTransaction wct, @NonNull IBinder errorCallbackToken, @Nullable TaskFragmentInfo taskFragmentInfo, int opType, @NonNull Throwable exception) { final WindowContainerTransaction wct = new WindowContainerTransaction(); if (taskFragmentInfo != null) { final IBinder fragmentToken = taskFragmentInfo.getFragmentToken(); mFragmentInfos.put(fragmentToken, taskFragmentInfo); } mCallback.onTaskFragmentError(wct, taskFragmentInfo, opType); applyTransaction(wct); } }
services/tests/wmtests/src/com/android/server/wm/TaskFragmentOrganizerControllerTest.java +35 −35 File changed.Preview size limit exceeded, changes collapsed. Show changes