Merge "Notify fixed rotation transformed insets state" into rvc-dev am: 6a9cd11871
Change-Id: I656b7aec39e3ba375aa12208ffd612fb35e8418d
This commit is contained in:
@@ -1032,7 +1032,9 @@ public class DisplayPolicy {
|
|||||||
|
|
||||||
// In Gesture Nav, navigation bar frame is larger than frame to
|
// In Gesture Nav, navigation bar frame is larger than frame to
|
||||||
// calculate inset.
|
// calculate inset.
|
||||||
if (mNavigationBarPosition == NAV_BAR_BOTTOM) {
|
if (navigationBarPosition(displayFrames.mDisplayWidth,
|
||||||
|
displayFrames.mDisplayHeight,
|
||||||
|
displayFrames.mRotation) == NAV_BAR_BOTTOM) {
|
||||||
sTmpRect.set(displayFrames.mUnrestricted);
|
sTmpRect.set(displayFrames.mUnrestricted);
|
||||||
sTmpRect.intersectUnchecked(displayFrames.mDisplayCutoutSafe);
|
sTmpRect.intersectUnchecked(displayFrames.mDisplayCutoutSafe);
|
||||||
inOutFrame.top = sTmpRect.bottom
|
inOutFrame.top = sTmpRect.bottom
|
||||||
@@ -1234,10 +1236,7 @@ public class DisplayPolicy {
|
|||||||
* most recent layout, so they are not guaranteed to be correct.
|
* most recent layout, so they are not guaranteed to be correct.
|
||||||
*
|
*
|
||||||
* @param attrs The LayoutParams of the window.
|
* @param attrs The LayoutParams of the window.
|
||||||
* @param taskBounds The bounds of the task this window is on or {@code null} if no task is
|
* @param windowToken The token of the window.
|
||||||
* associated with the window.
|
|
||||||
* @param displayFrames display frames.
|
|
||||||
* @param floatingStack Whether the window's stack is floating.
|
|
||||||
* @param outFrame The frame of the window.
|
* @param outFrame The frame of the window.
|
||||||
* @param outContentInsets The areas covered by system windows, expressed as positive insets.
|
* @param outContentInsets The areas covered by system windows, expressed as positive insets.
|
||||||
* @param outStableInsets The areas covered by stable system windows irrespective of their
|
* @param outStableInsets The areas covered by stable system windows irrespective of their
|
||||||
@@ -1246,8 +1245,7 @@ public class DisplayPolicy {
|
|||||||
* @return Whether to always consume the system bars.
|
* @return Whether to always consume the system bars.
|
||||||
* See {@link #areSystemBarsForcedShownLw(WindowState)}.
|
* See {@link #areSystemBarsForcedShownLw(WindowState)}.
|
||||||
*/
|
*/
|
||||||
public boolean getLayoutHintLw(LayoutParams attrs, Rect taskBounds,
|
boolean getLayoutHint(LayoutParams attrs, WindowToken windowToken, Rect outFrame,
|
||||||
DisplayFrames displayFrames, boolean floatingStack, Rect outFrame,
|
|
||||||
Rect outContentInsets, Rect outStableInsets,
|
Rect outContentInsets, Rect outStableInsets,
|
||||||
DisplayCutout.ParcelableWrapper outDisplayCutout) {
|
DisplayCutout.ParcelableWrapper outDisplayCutout) {
|
||||||
final int fl = PolicyControl.getWindowFlags(null, attrs);
|
final int fl = PolicyControl.getWindowFlags(null, attrs);
|
||||||
@@ -1260,6 +1258,18 @@ public class DisplayPolicy {
|
|||||||
&& (fl & FLAG_LAYOUT_INSET_DECOR) != 0;
|
&& (fl & FLAG_LAYOUT_INSET_DECOR) != 0;
|
||||||
final boolean screenDecor = (pfl & PRIVATE_FLAG_IS_SCREEN_DECOR) != 0;
|
final boolean screenDecor = (pfl & PRIVATE_FLAG_IS_SCREEN_DECOR) != 0;
|
||||||
|
|
||||||
|
final boolean isFixedRotationTransforming =
|
||||||
|
windowToken != null && windowToken.isFixedRotationTransforming();
|
||||||
|
final ActivityRecord activity = windowToken != null ? windowToken.asActivityRecord() : null;
|
||||||
|
final Task task = activity != null ? activity.getTask() : null;
|
||||||
|
final Rect taskBounds = isFixedRotationTransforming
|
||||||
|
// Use token (activity) bounds if it is rotated because its task is not rotated.
|
||||||
|
? windowToken.getBounds()
|
||||||
|
: (task != null ? task.getBounds() : null);
|
||||||
|
final DisplayFrames displayFrames = isFixedRotationTransforming
|
||||||
|
? windowToken.getFixedRotationTransformDisplayFrames()
|
||||||
|
: mDisplayContent.mDisplayFrames;
|
||||||
|
|
||||||
if (layoutInScreenAndInsetDecor && !screenDecor) {
|
if (layoutInScreenAndInsetDecor && !screenDecor) {
|
||||||
if ((sysUiVis & SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0
|
if ((sysUiVis & SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0
|
||||||
|| (attrs.getFitInsetsTypes() & Type.navigationBars()) == 0) {
|
|| (attrs.getFitInsetsTypes() & Type.navigationBars()) == 0) {
|
||||||
@@ -1268,15 +1278,10 @@ public class DisplayPolicy {
|
|||||||
outFrame.set(displayFrames.mRestricted);
|
outFrame.set(displayFrames.mRestricted);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Rect sf;
|
final boolean isFloatingTask = task != null && task.isFloating();
|
||||||
if (floatingStack) {
|
final Rect sf = isFloatingTask ? null : displayFrames.mStable;
|
||||||
sf = null;
|
|
||||||
} else {
|
|
||||||
sf = displayFrames.mStable;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Rect cf;
|
final Rect cf;
|
||||||
if (floatingStack) {
|
if (isFloatingTask) {
|
||||||
cf = null;
|
cf = null;
|
||||||
} else if ((sysUiVis & View.SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0) {
|
} else if ((sysUiVis & View.SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0) {
|
||||||
if ((fl & FLAG_FULLSCREEN) != 0) {
|
if ((fl & FLAG_FULLSCREEN) != 0) {
|
||||||
@@ -1425,6 +1430,7 @@ public class DisplayPolicy {
|
|||||||
*/
|
*/
|
||||||
void simulateLayoutDisplay(DisplayFrames displayFrames, InsetsState insetsState, int uiMode) {
|
void simulateLayoutDisplay(DisplayFrames displayFrames, InsetsState insetsState, int uiMode) {
|
||||||
displayFrames.onBeginLayout();
|
displayFrames.onBeginLayout();
|
||||||
|
insetsState.setDisplayFrame(displayFrames.mUnrestricted);
|
||||||
final WindowFrames simulatedWindowFrames = new WindowFrames();
|
final WindowFrames simulatedWindowFrames = new WindowFrames();
|
||||||
if (mNavigationBar != null) {
|
if (mNavigationBar != null) {
|
||||||
simulateLayoutDecorWindow(
|
simulateLayoutDecorWindow(
|
||||||
|
|||||||
@@ -190,7 +190,10 @@ class InsetsSourceProvider {
|
|||||||
|
|
||||||
/** @return A new source computed by the specified window frame in the given display frames. */
|
/** @return A new source computed by the specified window frame in the given display frames. */
|
||||||
InsetsSource createSimulatedSource(DisplayFrames displayFrames, WindowFrames windowFrames) {
|
InsetsSource createSimulatedSource(DisplayFrames displayFrames, WindowFrames windowFrames) {
|
||||||
final InsetsSource source = new InsetsSource(mSource);
|
// Don't copy visible frame because it might not be calculated in the provided display
|
||||||
|
// frames and it is not significant for this usage.
|
||||||
|
final InsetsSource source = new InsetsSource(mSource.getType());
|
||||||
|
source.setVisible(mSource.isVisible());
|
||||||
mTmpRect.set(windowFrames.mFrame);
|
mTmpRect.set(windowFrames.mFrame);
|
||||||
if (mFrameProvider != null) {
|
if (mFrameProvider != null) {
|
||||||
mFrameProvider.accept(displayFrames, mWin, mTmpRect);
|
mFrameProvider.accept(displayFrames, mWin, mTmpRect);
|
||||||
|
|||||||
@@ -1645,23 +1645,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
prepareNoneTransitionForRelaunching(activity);
|
prepareNoneTransitionForRelaunching(activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
final DisplayFrames displayFrames = displayContent.mDisplayFrames;
|
if (displayPolicy.getLayoutHint(win.mAttrs, token, outFrame, outContentInsets,
|
||||||
// TODO: Not sure if onDisplayInfoUpdated() call is needed.
|
outStableInsets, outDisplayCutout)) {
|
||||||
final DisplayInfo displayInfo = displayContent.getDisplayInfo();
|
|
||||||
displayFrames.onDisplayInfoUpdated(displayInfo,
|
|
||||||
displayContent.calculateDisplayCutoutForRotation(displayInfo.rotation));
|
|
||||||
final Rect taskBounds;
|
|
||||||
final boolean floatingStack;
|
|
||||||
if (activity != null && activity.getTask() != null) {
|
|
||||||
taskBounds = mTmpRect;
|
|
||||||
tokenActivity.getTask().getBounds(mTmpRect);
|
|
||||||
floatingStack = activity.getTask().isFloating();
|
|
||||||
} else {
|
|
||||||
taskBounds = null;
|
|
||||||
floatingStack = false;
|
|
||||||
}
|
|
||||||
if (displayPolicy.getLayoutHintLw(win.mAttrs, taskBounds, displayFrames, floatingStack,
|
|
||||||
outFrame, outContentInsets, outStableInsets, outDisplayCutout)) {
|
|
||||||
res |= WindowManagerGlobal.ADD_FLAG_ALWAYS_CONSUME_SYSTEM_BARS;
|
res |= WindowManagerGlobal.ADD_FLAG_ALWAYS_CONSUME_SYSTEM_BARS;
|
||||||
}
|
}
|
||||||
outInsetsState.set(win.getInsetsState(),
|
outInsetsState.set(win.getInsetsState(),
|
||||||
@@ -8036,27 +8021,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
+ "could not be found!");
|
+ "could not be found!");
|
||||||
}
|
}
|
||||||
final WindowToken windowToken = dc.getWindowToken(attrs.token);
|
final WindowToken windowToken = dc.getWindowToken(attrs.token);
|
||||||
final ActivityRecord activity;
|
dc.getDisplayPolicy().getLayoutHint(attrs, windowToken, mTmpRect /* outFrame */,
|
||||||
if (windowToken != null && windowToken.asActivityRecord() != null) {
|
outContentInsets, outStableInsets, displayCutout);
|
||||||
activity = windowToken.asActivityRecord();
|
|
||||||
} else {
|
|
||||||
activity = null;
|
|
||||||
}
|
|
||||||
final Rect taskBounds;
|
|
||||||
final boolean floatingStack;
|
|
||||||
if (activity != null && activity.getTask() != null) {
|
|
||||||
final Task task = activity.getTask();
|
|
||||||
taskBounds = new Rect();
|
|
||||||
task.getBounds(taskBounds);
|
|
||||||
floatingStack = task.isFloating();
|
|
||||||
} else {
|
|
||||||
taskBounds = null;
|
|
||||||
floatingStack = false;
|
|
||||||
}
|
|
||||||
final DisplayFrames displayFrames = dc.mDisplayFrames;
|
|
||||||
final DisplayPolicy policy = dc.getDisplayPolicy();
|
|
||||||
policy.getLayoutHintLw(attrs, taskBounds, displayFrames, floatingStack,
|
|
||||||
new Rect(), outContentInsets, outStableInsets, displayCutout);
|
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
Binder.restoreCallingIdentity(origId);
|
Binder.restoreCallingIdentity(origId);
|
||||||
|
|||||||
@@ -1448,6 +1448,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return The display frames in use by this window. */
|
||||||
DisplayFrames getDisplayFrames(DisplayFrames originalFrames) {
|
DisplayFrames getDisplayFrames(DisplayFrames originalFrames) {
|
||||||
final DisplayFrames diplayFrames = mToken.getFixedRotationTransformDisplayFrames();
|
final DisplayFrames diplayFrames = mToken.getFixedRotationTransformDisplayFrames();
|
||||||
if (diplayFrames != null) {
|
if (diplayFrames != null) {
|
||||||
@@ -3495,8 +3496,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
*/
|
*/
|
||||||
void notifyInsetsChanged() {
|
void notifyInsetsChanged() {
|
||||||
try {
|
try {
|
||||||
mClient.insetsChanged(
|
mClient.insetsChanged(getInsetsState());
|
||||||
getDisplayContent().getInsetsPolicy().getInsetsForDispatch(this));
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.w(TAG, "Failed to deliver inset state change w=" + this, e);
|
Slog.w(TAG, "Failed to deliver inset state change w=" + this, e);
|
||||||
}
|
}
|
||||||
@@ -3506,9 +3506,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
public void notifyInsetsControlChanged() {
|
public void notifyInsetsControlChanged() {
|
||||||
final InsetsStateController stateController =
|
final InsetsStateController stateController =
|
||||||
getDisplayContent().getInsetsStateController();
|
getDisplayContent().getInsetsStateController();
|
||||||
final InsetsPolicy policy = getDisplayContent().getInsetsPolicy();
|
|
||||||
try {
|
try {
|
||||||
mClient.insetsControlChanged(policy.getInsetsForDispatch(this),
|
mClient.insetsControlChanged(getInsetsState(),
|
||||||
stateController.getControlsForDispatch(this));
|
stateController.getControlsForDispatch(this));
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.w(TAG, "Failed to deliver inset state change", e);
|
Slog.w(TAG, "Failed to deliver inset state change", e);
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import static org.junit.Assume.assumeTrue;
|
|||||||
import static org.mockito.Mockito.doNothing;
|
import static org.mockito.Mockito.doNothing;
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
|
|
||||||
|
import android.app.WindowConfiguration;
|
||||||
import android.graphics.Insets;
|
import android.graphics.Insets;
|
||||||
import android.graphics.PixelFormat;
|
import android.graphics.PixelFormat;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
@@ -855,9 +856,8 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
final DisplayCutout.ParcelableWrapper outDisplayCutout =
|
final DisplayCutout.ParcelableWrapper outDisplayCutout =
|
||||||
new DisplayCutout.ParcelableWrapper();
|
new DisplayCutout.ParcelableWrapper();
|
||||||
|
|
||||||
mDisplayPolicy.getLayoutHintLw(mWindow.mAttrs, null, mFrames,
|
mDisplayPolicy.getLayoutHint(mWindow.mAttrs, null /* windowToken */, outFrame,
|
||||||
false /* floatingStack */, outFrame, outContentInsets, outStableInsets,
|
outContentInsets, outStableInsets, outDisplayCutout);
|
||||||
outDisplayCutout);
|
|
||||||
|
|
||||||
assertThat(outFrame, is(mFrames.mUnrestricted));
|
assertThat(outFrame, is(mFrames.mUnrestricted));
|
||||||
assertThat(outContentInsets, is(new Rect(0, STATUS_BAR_HEIGHT, 0, NAV_BAR_HEIGHT)));
|
assertThat(outContentInsets, is(new Rect(0, STATUS_BAR_HEIGHT, 0, NAV_BAR_HEIGHT)));
|
||||||
@@ -874,6 +874,9 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
|
mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
|
||||||
|
|
||||||
final Rect taskBounds = new Rect(100, 100, 200, 200);
|
final Rect taskBounds = new Rect(100, 100, 200, 200);
|
||||||
|
final Task task = mWindow.getTask();
|
||||||
|
// Force the bounds because the task may resolve different bounds from Task#setBounds.
|
||||||
|
task.getWindowConfiguration().setBounds(taskBounds);
|
||||||
|
|
||||||
final Rect outFrame = new Rect();
|
final Rect outFrame = new Rect();
|
||||||
final Rect outContentInsets = new Rect();
|
final Rect outContentInsets = new Rect();
|
||||||
@@ -881,9 +884,8 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
final DisplayCutout.ParcelableWrapper outDisplayCutout =
|
final DisplayCutout.ParcelableWrapper outDisplayCutout =
|
||||||
new DisplayCutout.ParcelableWrapper();
|
new DisplayCutout.ParcelableWrapper();
|
||||||
|
|
||||||
mDisplayPolicy.getLayoutHintLw(mWindow.mAttrs, taskBounds, mFrames,
|
mDisplayPolicy.getLayoutHint(mWindow.mAttrs, mWindow.mToken, outFrame,
|
||||||
false /* floatingStack */, outFrame, outContentInsets, outStableInsets,
|
outContentInsets, outStableInsets, outDisplayCutout);
|
||||||
outDisplayCutout);
|
|
||||||
|
|
||||||
assertThat(outFrame, is(taskBounds));
|
assertThat(outFrame, is(taskBounds));
|
||||||
assertThat(outContentInsets, is(new Rect()));
|
assertThat(outContentInsets, is(new Rect()));
|
||||||
@@ -904,15 +906,20 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
final Rect taskBounds = new Rect(100, mFrames.mContent.bottom + 1,
|
final Rect taskBounds = new Rect(100, mFrames.mContent.bottom + 1,
|
||||||
200, mFrames.mContent.bottom + 10);
|
200, mFrames.mContent.bottom + 10);
|
||||||
|
|
||||||
|
final Task task = mWindow.getTask();
|
||||||
|
// Make the task floating.
|
||||||
|
task.setWindowingMode(WindowConfiguration.WINDOWING_MODE_FREEFORM);
|
||||||
|
// Force the bounds because the task may resolve different bounds from Task#setBounds.
|
||||||
|
task.getWindowConfiguration().setBounds(taskBounds);
|
||||||
|
|
||||||
final Rect outFrame = new Rect();
|
final Rect outFrame = new Rect();
|
||||||
final Rect outContentInsets = new Rect();
|
final Rect outContentInsets = new Rect();
|
||||||
final Rect outStableInsets = new Rect();
|
final Rect outStableInsets = new Rect();
|
||||||
final DisplayCutout.ParcelableWrapper outDisplayCutout =
|
final DisplayCutout.ParcelableWrapper outDisplayCutout =
|
||||||
new DisplayCutout.ParcelableWrapper();
|
new DisplayCutout.ParcelableWrapper();
|
||||||
|
|
||||||
mDisplayPolicy.getLayoutHintLw(mWindow.mAttrs, taskBounds, mFrames,
|
mDisplayPolicy.getLayoutHint(mWindow.mAttrs, mWindow.mToken, outFrame, outContentInsets,
|
||||||
true /* floatingStack */, outFrame, outContentInsets, outStableInsets,
|
outStableInsets, outDisplayCutout);
|
||||||
outDisplayCutout);
|
|
||||||
|
|
||||||
assertThat(outFrame, is(taskBounds));
|
assertThat(outFrame, is(taskBounds));
|
||||||
assertThat(outContentInsets, is(new Rect()));
|
assertThat(outContentInsets, is(new Rect()));
|
||||||
@@ -939,6 +946,8 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
final InsetsState simulatedInsetsState = new InsetsState();
|
final InsetsState simulatedInsetsState = new InsetsState();
|
||||||
final DisplayFrames simulatedDisplayFrames = createDisplayFrames();
|
final DisplayFrames simulatedDisplayFrames = createDisplayFrames();
|
||||||
mDisplayPolicy.beginLayoutLw(mFrames, uiMode);
|
mDisplayPolicy.beginLayoutLw(mFrames, uiMode);
|
||||||
|
// Force the display bounds because it is not synced with display frames in policy test.
|
||||||
|
mDisplayContent.getWindowConfiguration().setBounds(mFrames.mUnrestricted);
|
||||||
mDisplayContent.getInsetsStateController().onPostLayout();
|
mDisplayContent.getInsetsStateController().onPostLayout();
|
||||||
mDisplayPolicy.simulateLayoutDisplay(simulatedDisplayFrames, simulatedInsetsState, uiMode);
|
mDisplayPolicy.simulateLayoutDisplay(simulatedDisplayFrames, simulatedInsetsState, uiMode);
|
||||||
|
|
||||||
@@ -947,20 +956,18 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
final StringWriter simulatedFramesDump = new StringWriter();
|
final StringWriter simulatedFramesDump = new StringWriter();
|
||||||
simulatedDisplayFrames.dump(prefix, new PrintWriter(simulatedFramesDump));
|
simulatedDisplayFrames.dump(prefix, new PrintWriter(simulatedFramesDump));
|
||||||
|
|
||||||
assertEquals(realFramesDump.toString(), simulatedFramesDump.toString());
|
assertEquals(new ToStringComparatorWrapper<>(realFramesDump),
|
||||||
|
new ToStringComparatorWrapper<>(simulatedFramesDump));
|
||||||
|
|
||||||
final StringWriter realInsetsDump = new StringWriter();
|
|
||||||
final InsetsState realInsetsState = new InsetsState(
|
final InsetsState realInsetsState = new InsetsState(
|
||||||
mDisplayContent.getInsetsStateController().getRawInsetsState());
|
mDisplayContent.getInsetsStateController().getRawInsetsState());
|
||||||
// Exclude comparing IME insets because currently the simulated layout only focuses on the
|
// Exclude comparing IME insets because currently the simulated layout only focuses on the
|
||||||
// insets from status bar and navigation bar.
|
// insets from status bar and navigation bar.
|
||||||
realInsetsState.removeSource(InsetsState.ITYPE_IME);
|
realInsetsState.removeSource(InsetsState.ITYPE_IME);
|
||||||
realInsetsState.removeSource(InsetsState.ITYPE_CAPTION_BAR);
|
realInsetsState.removeSource(InsetsState.ITYPE_CAPTION_BAR);
|
||||||
realInsetsState.dump(prefix, new PrintWriter(realInsetsDump));
|
|
||||||
final StringWriter simulatedInsetsDump = new StringWriter();
|
|
||||||
simulatedInsetsState.dump(prefix, new PrintWriter(simulatedInsetsDump));
|
|
||||||
|
|
||||||
assertEquals(realInsetsDump.toString(), simulatedInsetsDump.toString());
|
assertEquals(new ToStringComparatorWrapper<>(realInsetsState),
|
||||||
|
new ToStringComparatorWrapper<>(simulatedInsetsState));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -60,4 +60,26 @@ class SystemServiceTestsBase {
|
|||||||
<T> T awaitInWmLock(Callable<T> callable) {
|
<T> T awaitInWmLock(Callable<T> callable) {
|
||||||
return mLockRule.waitForLocked(callable);
|
return mLockRule.waitForLocked(callable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility class to compare the output of T#toString. It is convenient to have readable output
|
||||||
|
* of assertion if the string content can represent the expected states.
|
||||||
|
*/
|
||||||
|
static class ToStringComparatorWrapper<T> {
|
||||||
|
final T mObject;
|
||||||
|
|
||||||
|
ToStringComparatorWrapper(T object) {
|
||||||
|
mObject = object;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
return mObject.toString().equals(obj.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return mObject.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user