Merge "Consolidate disabling fixed-rotation when IME may visible on activity" into sc-dev
This commit is contained in:
@@ -647,6 +647,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
private boolean mLastContainsDismissKeyguardWindow;
|
private boolean mLastContainsDismissKeyguardWindow;
|
||||||
private boolean mLastContainsTurnScreenOnWindow;
|
private boolean mLastContainsTurnScreenOnWindow;
|
||||||
|
|
||||||
|
/** Whether the IME is showing when transitioning away from this activity. */
|
||||||
|
boolean mLastImeShown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flag to determine if this AR is in the process of closing or entering PIP. This is needed
|
* A flag to determine if this AR is in the process of closing or entering PIP. This is needed
|
||||||
* to help AR know that the app is in the process of closing but hasn't yet started closing on
|
* to help AR know that the app is in the process of closing but hasn't yet started closing on
|
||||||
@@ -4722,6 +4725,15 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
setClientVisible(visible);
|
setClientVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!visible) {
|
||||||
|
final InsetsControlTarget imeInputTarget = mDisplayContent.getImeTarget(
|
||||||
|
DisplayContent.IME_TARGET_INPUT);
|
||||||
|
mLastImeShown = imeInputTarget != null && imeInputTarget.getWindow() != null
|
||||||
|
&& imeInputTarget.getWindow().mActivityRecord == this
|
||||||
|
&& mDisplayContent.mInputMethodWindow != null
|
||||||
|
&& mDisplayContent.mInputMethodWindow.isVisible();
|
||||||
|
}
|
||||||
|
|
||||||
final DisplayContent displayContent = getDisplayContent();
|
final DisplayContent displayContent = getDisplayContent();
|
||||||
if (!displayContent.mClosingApps.contains(this)
|
if (!displayContent.mClosingApps.contains(this)
|
||||||
&& !displayContent.mOpeningApps.contains(this)) {
|
&& !displayContent.mOpeningApps.contains(this)) {
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
|
|||||||
import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
|
import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
|
||||||
import static android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH;
|
import static android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH;
|
||||||
import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
|
import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
|
||||||
|
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN;
|
||||||
|
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
|
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
|
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_BOOT_PROGRESS;
|
import static android.view.WindowManager.LayoutParams.TYPE_BOOT_PROGRESS;
|
||||||
@@ -208,6 +210,7 @@ import android.view.Surface.Rotation;
|
|||||||
import android.view.SurfaceControl;
|
import android.view.SurfaceControl;
|
||||||
import android.view.SurfaceControl.Transaction;
|
import android.view.SurfaceControl.Transaction;
|
||||||
import android.view.SurfaceSession;
|
import android.view.SurfaceSession;
|
||||||
|
import android.view.View;
|
||||||
import android.view.WindowInsets;
|
import android.view.WindowInsets;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.WindowManager.DisplayImePolicy;
|
import android.view.WindowManager.DisplayImePolicy;
|
||||||
@@ -1549,9 +1552,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
// to cover the activity configuration change.
|
// to cover the activity configuration change.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((r.mStartingData != null && r.mStartingData.hasImeSurface())
|
if (r.attachedToProcess() && mayImeShowOnLaunchingActivity(r)) {
|
||||||
|| (mInsetsStateController.getImeSourceProvider()
|
|
||||||
.getSource().getVisibleFrame() != null)) {
|
|
||||||
// Currently it is unknown that when will IME window be ready. Reject the case to
|
// Currently it is unknown that when will IME window be ready. Reject the case to
|
||||||
// avoid flickering by showing IME in inconsistent orientation.
|
// avoid flickering by showing IME in inconsistent orientation.
|
||||||
return false;
|
return false;
|
||||||
@@ -1607,6 +1608,24 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns {@code true} if the IME is possible to show on the launching activity. */
|
||||||
|
private boolean mayImeShowOnLaunchingActivity(@NonNull ActivityRecord r) {
|
||||||
|
final WindowState win = r.findMainWindow();
|
||||||
|
if (win == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// See InputMethodManagerService#shouldRestoreImeVisibility that we expecting the IME
|
||||||
|
// should be hidden when the window set the hidden softInputMode.
|
||||||
|
final int softInputMode = win.mAttrs.softInputMode;
|
||||||
|
switch (softInputMode & WindowManager.LayoutParams.SOFT_INPUT_MASK_STATE) {
|
||||||
|
case SOFT_INPUT_STATE_ALWAYS_HIDDEN:
|
||||||
|
case SOFT_INPUT_STATE_HIDDEN:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return r.mLastImeShown && mInputMethodWindow != null && mInputMethodWindow.mHasSurface
|
||||||
|
&& mInputMethodWindow.mViewVisibility == View.VISIBLE;
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns {@code true} if the top activity is transformed with the new rotation of display. */
|
/** Returns {@code true} if the top activity is transformed with the new rotation of display. */
|
||||||
boolean hasTopFixedRotationLaunchingApp() {
|
boolean hasTopFixedRotationLaunchingApp() {
|
||||||
return mFixedRotationLaunchingApp != null
|
return mFixedRotationLaunchingApp != null
|
||||||
|
|||||||
@@ -443,7 +443,8 @@ class TaskSnapshotController {
|
|||||||
} else {
|
} else {
|
||||||
excludeLayers = new SurfaceControl[0];
|
excludeLayers = new SurfaceControl[0];
|
||||||
}
|
}
|
||||||
builder.setHasImeSurface(!excludeIme && imeWindow != null && imeWindow.isDrawn());
|
builder.setHasImeSurface(!excludeIme && imeWindow != null && imeWindow.isVisible());
|
||||||
|
|
||||||
final SurfaceControl.ScreenshotHardwareBuffer screenshotBuffer =
|
final SurfaceControl.ScreenshotHardwareBuffer screenshotBuffer =
|
||||||
SurfaceControl.captureLayersExcluding(
|
SurfaceControl.captureLayersExcluding(
|
||||||
task.getSurfaceControl(), mTmpRect, scaleFraction,
|
task.getSurfaceControl(), mTmpRect, scaleFraction,
|
||||||
|
|||||||
@@ -214,8 +214,8 @@ public class TaskSnapshotControllerTest extends WindowTestsBase {
|
|||||||
spyOn(mDisplayContent);
|
spyOn(mDisplayContent);
|
||||||
spyOn(mDisplayContent.mInputMethodWindow);
|
spyOn(mDisplayContent.mInputMethodWindow);
|
||||||
when(task.getDisplayContent().shouldImeAttachedToApp()).thenReturn(true);
|
when(task.getDisplayContent().shouldImeAttachedToApp()).thenReturn(true);
|
||||||
// Intentionally set the IME window is in drawn state.
|
// Intentionally set the IME window is in visible state.
|
||||||
doReturn(true).when(mDisplayContent.mInputMethodWindow).isDrawn();
|
doReturn(true).when(mDisplayContent.mInputMethodWindow).isVisible();
|
||||||
// Verify no NPE happens when calling createTaskSnapshot.
|
// Verify no NPE happens when calling createTaskSnapshot.
|
||||||
try {
|
try {
|
||||||
final TaskSnapshot.Builder builder = new TaskSnapshot.Builder();
|
final TaskSnapshot.Builder builder = new TaskSnapshot.Builder();
|
||||||
|
|||||||
Reference in New Issue
Block a user