Add new callback for when activity rotates

Launcher needs to distinguish display changes
that result naturally vs apps that launch
in a fixed portrait/landscape rotation during
the quickstep gesture.This callback helps anticipate
if a subseqent onDisplayChanged() will
have resulted from a natural rotation or not.

Bug: 154580671
Change-Id: I59ee7985a9f367e8fc5826c08476c1a25d1426b0
This commit is contained in:
Vinit Nayak
2020-05-06 13:44:29 -07:00
parent 273c839a06
commit 66bf45ffa8
6 changed files with 49 additions and 0 deletions

View File

@@ -114,4 +114,7 @@ public abstract class TaskStackChangeListener {
/** @see ITaskStackListener#onRecentTaskListFrozenChanged(boolean) */
public void onRecentTaskListFrozenChanged(boolean frozen) { }
/** @see ITaskStackListener#onActivityRotation()*/
public void onActivityRotation() { }
}

View File

@@ -237,6 +237,11 @@ public class TaskStackChangeListeners extends TaskStackListener {
mHandler.obtainMessage(H.ON_TASK_DESCRIPTION_CHANGED, taskInfo).sendToTarget();
}
@Override
public void onActivityRotation() {
mHandler.obtainMessage(H.ON_ACTIVITY_ROTATION).sendToTarget();
}
private final class H extends Handler {
private static final int ON_TASK_STACK_CHANGED = 1;
private static final int ON_TASK_SNAPSHOT_CHANGED = 2;
@@ -260,6 +265,7 @@ public class TaskStackChangeListeners extends TaskStackListener {
private static final int ON_SINGLE_TASK_DISPLAY_EMPTY = 22;
private static final int ON_TASK_LIST_FROZEN_UNFROZEN = 23;
private static final int ON_TASK_DESCRIPTION_CHANGED = 24;
private static final int ON_ACTIVITY_ROTATION = 25;
public H(Looper looper) {
@@ -427,6 +433,12 @@ public class TaskStackChangeListeners extends TaskStackListener {
}
break;
}
case ON_ACTIVITY_ROTATION: {
for (int i = mTaskStackListeners.size() - 1; i >= 0; i--) {
mTaskStackListeners.get(i).onActivityRotation();
}
break;
}
}
}
if (msg.obj instanceof SomeArgs) {