Loading core/java/android/app/ITaskStackListener.aidl +10 −0 Original line number Diff line number Diff line Loading @@ -216,4 +216,14 @@ oneway interface ITaskStackListener { * in {@link android.content.pm.ActivityInfo}. */ void onTaskRequestedOrientationChanged(int taskId, int requestedOrientation); /** * Called when a rotation is about to start on the foreground activity. * This applies for: * * free sensor rotation * * forced rotation * * rotation settings set through adb command line * * rotation that occurs when rotation tile is toggled in quick settings */ void onActivityRotation(); } core/java/android/app/TaskStackListener.java +4 −0 Original line number Diff line number Diff line Loading @@ -199,4 +199,8 @@ public abstract class TaskStackListener extends ITaskStackListener.Stub { @Override public void onTaskRequestedOrientationChanged(int taskId, int requestedOrientation) { } @Override public void onActivityRotation() { } } packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListener.java +3 −0 Original line number Diff line number Diff line Loading @@ -114,4 +114,7 @@ public abstract class TaskStackChangeListener { /** @see ITaskStackListener#onRecentTaskListFrozenChanged(boolean) */ public void onRecentTaskListFrozenChanged(boolean frozen) { } /** @see ITaskStackListener#onActivityRotation()*/ public void onActivityRotation() { } } packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListeners.java +12 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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) { Loading Loading @@ -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) { Loading services/core/java/com/android/server/wm/TaskChangeNotificationController.java +15 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ class TaskChangeNotificationController { private static final int NOTIFY_TASK_LIST_FROZEN_UNFROZEN_MSG = 26; private static final int NOTIFY_TASK_FOCUS_CHANGED_MSG = 27; private static final int NOTIFY_TASK_REQUESTED_ORIENTATION_CHANGED_MSG = 28; private static final int NOTIFY_ACTIVITY_ROTATED_MSG = 29; // Delay in notifying task stack change listeners (in millis) private static final int NOTIFY_TASK_STACK_CHANGE_LISTENERS_DELAY = 100; Loading Loading @@ -183,6 +184,10 @@ class TaskChangeNotificationController { l.onTaskRequestedOrientationChanged(m.arg1, m.arg2); }; private final TaskStackConsumer mNotifyOnActivityRotation = (l, m) -> { l.onActivityRotation(); }; @FunctionalInterface public interface TaskStackConsumer { void accept(ITaskStackListener t, Message m) throws RemoteException; Loading Loading @@ -277,6 +282,9 @@ class TaskChangeNotificationController { case NOTIFY_TASK_REQUESTED_ORIENTATION_CHANGED_MSG: forAllRemoteListeners(mNotifyTaskRequestedOrientationChanged, msg); break; case NOTIFY_ACTIVITY_ROTATED_MSG: forAllRemoteListeners(mNotifyOnActivityRotation, msg); break; } if (msg.obj instanceof SomeArgs) { ((SomeArgs) msg.obj).recycle(); Loading Loading @@ -574,4 +582,11 @@ class TaskChangeNotificationController { forAllLocalListeners(mNotifyTaskRequestedOrientationChanged, msg); msg.sendToTarget(); } /** @see android.app.ITaskStackListener#onActivityRotation() */ void notifyOnActivityRotation() { final Message msg = mHandler.obtainMessage(NOTIFY_ACTIVITY_ROTATED_MSG); forAllLocalListeners(mNotifyOnActivityRotation, msg); msg.sendToTarget(); } } Loading
core/java/android/app/ITaskStackListener.aidl +10 −0 Original line number Diff line number Diff line Loading @@ -216,4 +216,14 @@ oneway interface ITaskStackListener { * in {@link android.content.pm.ActivityInfo}. */ void onTaskRequestedOrientationChanged(int taskId, int requestedOrientation); /** * Called when a rotation is about to start on the foreground activity. * This applies for: * * free sensor rotation * * forced rotation * * rotation settings set through adb command line * * rotation that occurs when rotation tile is toggled in quick settings */ void onActivityRotation(); }
core/java/android/app/TaskStackListener.java +4 −0 Original line number Diff line number Diff line Loading @@ -199,4 +199,8 @@ public abstract class TaskStackListener extends ITaskStackListener.Stub { @Override public void onTaskRequestedOrientationChanged(int taskId, int requestedOrientation) { } @Override public void onActivityRotation() { } }
packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListener.java +3 −0 Original line number Diff line number Diff line Loading @@ -114,4 +114,7 @@ public abstract class TaskStackChangeListener { /** @see ITaskStackListener#onRecentTaskListFrozenChanged(boolean) */ public void onRecentTaskListFrozenChanged(boolean frozen) { } /** @see ITaskStackListener#onActivityRotation()*/ public void onActivityRotation() { } }
packages/SystemUI/shared/src/com/android/systemui/shared/system/TaskStackChangeListeners.java +12 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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) { Loading Loading @@ -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) { Loading
services/core/java/com/android/server/wm/TaskChangeNotificationController.java +15 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ class TaskChangeNotificationController { private static final int NOTIFY_TASK_LIST_FROZEN_UNFROZEN_MSG = 26; private static final int NOTIFY_TASK_FOCUS_CHANGED_MSG = 27; private static final int NOTIFY_TASK_REQUESTED_ORIENTATION_CHANGED_MSG = 28; private static final int NOTIFY_ACTIVITY_ROTATED_MSG = 29; // Delay in notifying task stack change listeners (in millis) private static final int NOTIFY_TASK_STACK_CHANGE_LISTENERS_DELAY = 100; Loading Loading @@ -183,6 +184,10 @@ class TaskChangeNotificationController { l.onTaskRequestedOrientationChanged(m.arg1, m.arg2); }; private final TaskStackConsumer mNotifyOnActivityRotation = (l, m) -> { l.onActivityRotation(); }; @FunctionalInterface public interface TaskStackConsumer { void accept(ITaskStackListener t, Message m) throws RemoteException; Loading Loading @@ -277,6 +282,9 @@ class TaskChangeNotificationController { case NOTIFY_TASK_REQUESTED_ORIENTATION_CHANGED_MSG: forAllRemoteListeners(mNotifyTaskRequestedOrientationChanged, msg); break; case NOTIFY_ACTIVITY_ROTATED_MSG: forAllRemoteListeners(mNotifyOnActivityRotation, msg); break; } if (msg.obj instanceof SomeArgs) { ((SomeArgs) msg.obj).recycle(); Loading Loading @@ -574,4 +582,11 @@ class TaskChangeNotificationController { forAllLocalListeners(mNotifyTaskRequestedOrientationChanged, msg); msg.sendToTarget(); } /** @see android.app.ITaskStackListener#onActivityRotation() */ void notifyOnActivityRotation() { final Message msg = mHandler.obtainMessage(NOTIFY_ACTIVITY_ROTATED_MSG); forAllLocalListeners(mNotifyOnActivityRotation, msg); msg.sendToTarget(); } }