Notify when task changes requested orientation.

This allows listener know task's orientation request change before
handling display rotation through IDisplayWindowRotationController if
they can register a local TaskStackListener.

Bug: 150409355
Test: atest WmTests:TaskStackChangedListenerTest#testNotifyTaskRequestedOrientationChanged
Change-Id: Id7bfc3e63329ce26d454b7e9c143e084e04dd365
This commit is contained in:
Garfield Tan
2020-03-03 16:07:07 -08:00
parent b8ad491e6d
commit afa0de8a91
7 changed files with 105 additions and 0 deletions

View File

@@ -205,4 +205,15 @@ oneway interface ITaskStackListener {
* @param {@code true} if the task got focus, {@code false} if it lost it.
*/
void onTaskFocusChanged(int taskId, boolean focused);
/**
* Called when a task changes its requested orientation. It is different from {@link
* #onActivityRequestedOrientationChanged(int, int)} in the sense that this method is called
* when a task changes requested orientation due to activity launch, dimiss or reparenting.
*
* @param taskId id of the task.
* @param requestedOrientation the new requested orientation of this task as screen orientations
* in {@link android.content.pm.ActivityInfo}.
*/
void onTaskRequestedOrientationChanged(int taskId, int requestedOrientation);
}

View File

@@ -195,4 +195,8 @@ public abstract class TaskStackListener extends ITaskStackListener.Stub {
@Override
public void onTaskFocusChanged(int taskId, boolean focused) {
}
@Override
public void onTaskRequestedOrientationChanged(int taskId, int requestedOrientation) {
}
}