Merge "Update display layout when requesting display rotate" into udc-dev
This commit is contained in:
@@ -79,7 +79,7 @@ public class DisplayChangeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Query all listeners for changes that should happen on display change. */
|
/** Query all listeners for changes that should happen on display change. */
|
||||||
public void dispatchOnDisplayChange(WindowContainerTransaction outWct, int displayId,
|
void dispatchOnDisplayChange(WindowContainerTransaction outWct, int displayId,
|
||||||
int fromRotation, int toRotation, DisplayAreaInfo newDisplayAreaInfo) {
|
int fromRotation, int toRotation, DisplayAreaInfo newDisplayAreaInfo) {
|
||||||
for (OnDisplayChangingListener c : mDisplayChangeListener) {
|
for (OnDisplayChangingListener c : mDisplayChangeListener) {
|
||||||
c.onDisplayChange(displayId, fromRotation, toRotation, newDisplayAreaInfo, outWct);
|
c.onDisplayChange(displayId, fromRotation, toRotation, newDisplayAreaInfo, outWct);
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import android.view.Display;
|
|||||||
import android.view.IDisplayWindowListener;
|
import android.view.IDisplayWindowListener;
|
||||||
import android.view.IWindowManager;
|
import android.view.IWindowManager;
|
||||||
import android.view.InsetsState;
|
import android.view.InsetsState;
|
||||||
|
import android.window.WindowContainerTransaction;
|
||||||
|
|
||||||
import androidx.annotation.BinderThread;
|
import androidx.annotation.BinderThread;
|
||||||
|
|
||||||
@@ -85,11 +86,6 @@ public class DisplayController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the DisplayChangeController. */
|
|
||||||
public DisplayChangeController getChangeController() {
|
|
||||||
return mChangeController;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a display by id from DisplayManager.
|
* Gets a display by id from DisplayManager.
|
||||||
*/
|
*/
|
||||||
@@ -195,6 +191,26 @@ public class DisplayController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Called when a display rotate requested. */
|
||||||
|
public void onDisplayRotateRequested(WindowContainerTransaction wct, int displayId,
|
||||||
|
int fromRotation, int toRotation) {
|
||||||
|
synchronized (mDisplays) {
|
||||||
|
final DisplayRecord dr = mDisplays.get(displayId);
|
||||||
|
if (dr == null) {
|
||||||
|
Slog.w(TAG, "Skipping Display rotate on non-added display.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dr.mDisplayLayout != null) {
|
||||||
|
dr.mDisplayLayout.rotateTo(dr.mContext.getResources(), toRotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
mChangeController.dispatchOnDisplayChange(
|
||||||
|
wct, displayId, fromRotation, toRotation, null /* newDisplayAreaInfo */);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void onDisplayConfigurationChanged(int displayId, Configuration newConfig) {
|
private void onDisplayConfigurationChanged(int displayId, Configuration newConfig) {
|
||||||
synchronized (mDisplays) {
|
synchronized (mDisplays) {
|
||||||
final DisplayRecord dr = mDisplays.get(displayId);
|
final DisplayRecord dr = mDisplays.get(displayId);
|
||||||
|
|||||||
@@ -1085,9 +1085,8 @@ public class Transitions implements RemoteCallable<Transitions>,
|
|||||||
if (wct == null) {
|
if (wct == null) {
|
||||||
wct = new WindowContainerTransaction();
|
wct = new WindowContainerTransaction();
|
||||||
}
|
}
|
||||||
mDisplayController.getChangeController().dispatchOnDisplayChange(wct,
|
mDisplayController.onDisplayRotateRequested(wct, change.getDisplayId(),
|
||||||
change.getDisplayId(), change.getStartRotation(),
|
change.getStartRotation(), change.getEndRotation());
|
||||||
change.getEndRotation(), null /* newDisplayAreaInfo */);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user