Merge "Add a new Insets type for overlapping windows." into tm-qpr-dev
This commit is contained in:
@@ -90,8 +90,10 @@ public class InsetsState implements Parcelable {
|
|||||||
ITYPE_IME,
|
ITYPE_IME,
|
||||||
ITYPE_CLIMATE_BAR,
|
ITYPE_CLIMATE_BAR,
|
||||||
ITYPE_EXTRA_NAVIGATION_BAR,
|
ITYPE_EXTRA_NAVIGATION_BAR,
|
||||||
ITYPE_LOCAL_NAVIGATION_BAR_1,
|
ITYPE_LEFT_GENERIC_OVERLAY,
|
||||||
ITYPE_LOCAL_NAVIGATION_BAR_2
|
ITYPE_TOP_GENERIC_OVERLAY,
|
||||||
|
ITYPE_RIGHT_GENERIC_OVERLAY,
|
||||||
|
ITYPE_BOTTOM_GENERIC_OVERLAY
|
||||||
})
|
})
|
||||||
public @interface InternalInsetsType {}
|
public @interface InternalInsetsType {}
|
||||||
|
|
||||||
@@ -135,10 +137,12 @@ public class InsetsState implements Parcelable {
|
|||||||
public static final int ITYPE_EXTRA_NAVIGATION_BAR = 21;
|
public static final int ITYPE_EXTRA_NAVIGATION_BAR = 21;
|
||||||
|
|
||||||
/** Additional types for local insets. **/
|
/** Additional types for local insets. **/
|
||||||
public static final int ITYPE_LOCAL_NAVIGATION_BAR_1 = 22;
|
public static final int ITYPE_LEFT_GENERIC_OVERLAY = 22;
|
||||||
public static final int ITYPE_LOCAL_NAVIGATION_BAR_2 = 23;
|
public static final int ITYPE_TOP_GENERIC_OVERLAY = 23;
|
||||||
|
public static final int ITYPE_RIGHT_GENERIC_OVERLAY = 24;
|
||||||
|
public static final int ITYPE_BOTTOM_GENERIC_OVERLAY = 25;
|
||||||
|
|
||||||
static final int LAST_TYPE = ITYPE_LOCAL_NAVIGATION_BAR_2;
|
static final int LAST_TYPE = ITYPE_BOTTOM_GENERIC_OVERLAY;
|
||||||
public static final int SIZE = LAST_TYPE + 1;
|
public static final int SIZE = LAST_TYPE + 1;
|
||||||
|
|
||||||
// Derived types
|
// Derived types
|
||||||
@@ -698,8 +702,12 @@ public class InsetsState implements Parcelable {
|
|||||||
if ((types & Type.NAVIGATION_BARS) != 0) {
|
if ((types & Type.NAVIGATION_BARS) != 0) {
|
||||||
result.add(ITYPE_NAVIGATION_BAR);
|
result.add(ITYPE_NAVIGATION_BAR);
|
||||||
result.add(ITYPE_EXTRA_NAVIGATION_BAR);
|
result.add(ITYPE_EXTRA_NAVIGATION_BAR);
|
||||||
result.add(ITYPE_LOCAL_NAVIGATION_BAR_1);
|
}
|
||||||
result.add(ITYPE_LOCAL_NAVIGATION_BAR_2);
|
if ((types & Type.GENERIC_OVERLAYS) != 0) {
|
||||||
|
result.add(ITYPE_LEFT_GENERIC_OVERLAY);
|
||||||
|
result.add(ITYPE_TOP_GENERIC_OVERLAY);
|
||||||
|
result.add(ITYPE_RIGHT_GENERIC_OVERLAY);
|
||||||
|
result.add(ITYPE_BOTTOM_GENERIC_OVERLAY);
|
||||||
}
|
}
|
||||||
if ((types & Type.CAPTION_BAR) != 0) {
|
if ((types & Type.CAPTION_BAR) != 0) {
|
||||||
result.add(ITYPE_CAPTION_BAR);
|
result.add(ITYPE_CAPTION_BAR);
|
||||||
@@ -740,9 +748,12 @@ public class InsetsState implements Parcelable {
|
|||||||
return Type.STATUS_BARS;
|
return Type.STATUS_BARS;
|
||||||
case ITYPE_NAVIGATION_BAR:
|
case ITYPE_NAVIGATION_BAR:
|
||||||
case ITYPE_EXTRA_NAVIGATION_BAR:
|
case ITYPE_EXTRA_NAVIGATION_BAR:
|
||||||
case ITYPE_LOCAL_NAVIGATION_BAR_1:
|
|
||||||
case ITYPE_LOCAL_NAVIGATION_BAR_2:
|
|
||||||
return Type.NAVIGATION_BARS;
|
return Type.NAVIGATION_BARS;
|
||||||
|
case ITYPE_LEFT_GENERIC_OVERLAY:
|
||||||
|
case ITYPE_TOP_GENERIC_OVERLAY:
|
||||||
|
case ITYPE_RIGHT_GENERIC_OVERLAY:
|
||||||
|
case ITYPE_BOTTOM_GENERIC_OVERLAY:
|
||||||
|
return Type.GENERIC_OVERLAYS;
|
||||||
case ITYPE_CAPTION_BAR:
|
case ITYPE_CAPTION_BAR:
|
||||||
return Type.CAPTION_BAR;
|
return Type.CAPTION_BAR;
|
||||||
case ITYPE_IME:
|
case ITYPE_IME:
|
||||||
@@ -861,10 +872,14 @@ public class InsetsState implements Parcelable {
|
|||||||
return "ITYPE_CLIMATE_BAR";
|
return "ITYPE_CLIMATE_BAR";
|
||||||
case ITYPE_EXTRA_NAVIGATION_BAR:
|
case ITYPE_EXTRA_NAVIGATION_BAR:
|
||||||
return "ITYPE_EXTRA_NAVIGATION_BAR";
|
return "ITYPE_EXTRA_NAVIGATION_BAR";
|
||||||
case ITYPE_LOCAL_NAVIGATION_BAR_1:
|
case ITYPE_LEFT_GENERIC_OVERLAY:
|
||||||
return "ITYPE_LOCAL_NAVIGATION_BAR_1";
|
return "ITYPE_LEFT_GENERIC_OVERLAY";
|
||||||
case ITYPE_LOCAL_NAVIGATION_BAR_2:
|
case ITYPE_TOP_GENERIC_OVERLAY:
|
||||||
return "ITYPE_LOCAL_NAVIGATION_BAR_2";
|
return "ITYPE_TOP_GENERIC_OVERLAY";
|
||||||
|
case ITYPE_RIGHT_GENERIC_OVERLAY:
|
||||||
|
return "ITYPE_RIGHT_GENERIC_OVERLAY";
|
||||||
|
case ITYPE_BOTTOM_GENERIC_OVERLAY:
|
||||||
|
return "ITYPE_BOTTOM_GENERIC_OVERLAY";
|
||||||
default:
|
default:
|
||||||
return "ITYPE_UNKNOWN_" + type;
|
return "ITYPE_UNKNOWN_" + type;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1423,9 +1423,11 @@ public final class WindowInsets {
|
|||||||
|
|
||||||
static final int DISPLAY_CUTOUT = 1 << 7;
|
static final int DISPLAY_CUTOUT = 1 << 7;
|
||||||
|
|
||||||
static final int LAST = 1 << 8;
|
static final int WINDOW_DECOR = 1 << 8;
|
||||||
static final int SIZE = 9;
|
|
||||||
static final int WINDOW_DECOR = LAST;
|
static final int GENERIC_OVERLAYS = 1 << 9;
|
||||||
|
static final int LAST = GENERIC_OVERLAYS;
|
||||||
|
static final int SIZE = 10;
|
||||||
|
|
||||||
static int indexOf(@InsetsType int type) {
|
static int indexOf(@InsetsType int type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -1447,6 +1449,8 @@ public final class WindowInsets {
|
|||||||
return 7;
|
return 7;
|
||||||
case WINDOW_DECOR:
|
case WINDOW_DECOR:
|
||||||
return 8;
|
return 8;
|
||||||
|
case GENERIC_OVERLAYS:
|
||||||
|
return 9;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("type needs to be >= FIRST and <= LAST,"
|
throw new IllegalArgumentException("type needs to be >= FIRST and <= LAST,"
|
||||||
+ " type=" + type);
|
+ " type=" + type);
|
||||||
@@ -1482,6 +1486,9 @@ public final class WindowInsets {
|
|||||||
if ((types & WINDOW_DECOR) != 0) {
|
if ((types & WINDOW_DECOR) != 0) {
|
||||||
result.append("windowDecor |");
|
result.append("windowDecor |");
|
||||||
}
|
}
|
||||||
|
if ((types & GENERIC_OVERLAYS) != 0) {
|
||||||
|
result.append("genericOverlays |");
|
||||||
|
}
|
||||||
if (result.length() > 0) {
|
if (result.length() > 0) {
|
||||||
result.delete(result.length() - 2, result.length());
|
result.delete(result.length() - 2, result.length());
|
||||||
}
|
}
|
||||||
@@ -1494,7 +1501,8 @@ public final class WindowInsets {
|
|||||||
/** @hide */
|
/** @hide */
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef(flag = true, value = {STATUS_BARS, NAVIGATION_BARS, CAPTION_BAR, IME, WINDOW_DECOR,
|
@IntDef(flag = true, value = {STATUS_BARS, NAVIGATION_BARS, CAPTION_BAR, IME, WINDOW_DECOR,
|
||||||
SYSTEM_GESTURES, MANDATORY_SYSTEM_GESTURES, TAPPABLE_ELEMENT, DISPLAY_CUTOUT})
|
SYSTEM_GESTURES, MANDATORY_SYSTEM_GESTURES, TAPPABLE_ELEMENT, DISPLAY_CUTOUT,
|
||||||
|
GENERIC_OVERLAYS})
|
||||||
public @interface InsetsType {
|
public @interface InsetsType {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1586,7 +1594,7 @@ public final class WindowInsets {
|
|||||||
* {@link #navigationBars()}, but not {@link #ime()}.
|
* {@link #navigationBars()}, but not {@link #ime()}.
|
||||||
*/
|
*/
|
||||||
public static @InsetsType int systemBars() {
|
public static @InsetsType int systemBars() {
|
||||||
return STATUS_BARS | NAVIGATION_BARS | CAPTION_BAR;
|
return STATUS_BARS | NAVIGATION_BARS | CAPTION_BAR | GENERIC_OVERLAYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
|
|||||||
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
|
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
|
||||||
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET;
|
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET;
|
||||||
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
||||||
import static android.view.InsetsState.ITYPE_LOCAL_NAVIGATION_BAR_1;
|
import static android.view.InsetsState.ITYPE_BOTTOM_GENERIC_OVERLAY;
|
||||||
import static android.view.InsetsState.ITYPE_LOCAL_NAVIGATION_BAR_2;
|
import static android.view.InsetsState.ITYPE_TOP_GENERIC_OVERLAY;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
|
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
|
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
|
||||||
import static android.view.WindowManager.TRANSIT_CLOSE;
|
import static android.view.WindowManager.TRANSIT_CLOSE;
|
||||||
@@ -1302,40 +1302,42 @@ public class WindowContainerTests extends WindowTestsBase {
|
|||||||
TYPE_BASE_APPLICATION);
|
TYPE_BASE_APPLICATION);
|
||||||
attrs2.setTitle("AppWindow2");
|
attrs2.setTitle("AppWindow2");
|
||||||
activity2.addWindow(createWindowState(attrs2, activity2));
|
activity2.addWindow(createWindowState(attrs2, activity2));
|
||||||
Rect navigationBarInsetsRect1 = new Rect(0, 200, 1080, 700);
|
Rect genericOverlayInsetsRect1 = new Rect(0, 200, 1080, 700);
|
||||||
Rect navigationBarInsetsRect2 = new Rect(0, 0, 1080, 200);
|
Rect genericOverlayInsetsRect2 = new Rect(0, 0, 1080, 200);
|
||||||
|
|
||||||
rootTask.addLocalRectInsetsSourceProvider(navigationBarInsetsRect1,
|
rootTask.addLocalRectInsetsSourceProvider(genericOverlayInsetsRect1,
|
||||||
new int[]{ITYPE_LOCAL_NAVIGATION_BAR_1});
|
new int[]{ITYPE_TOP_GENERIC_OVERLAY});
|
||||||
container.addLocalRectInsetsSourceProvider(navigationBarInsetsRect2,
|
container.addLocalRectInsetsSourceProvider(genericOverlayInsetsRect2,
|
||||||
new int[]{ITYPE_LOCAL_NAVIGATION_BAR_2});
|
new int[]{ITYPE_BOTTOM_GENERIC_OVERLAY});
|
||||||
|
|
||||||
InsetsSource navigationBarInsetsProvider1Source = new InsetsSource(
|
InsetsSource genericOverlayInsetsProvider1Source = new InsetsSource(
|
||||||
ITYPE_LOCAL_NAVIGATION_BAR_1);
|
ITYPE_TOP_GENERIC_OVERLAY);
|
||||||
navigationBarInsetsProvider1Source.setFrame(navigationBarInsetsRect1);
|
genericOverlayInsetsProvider1Source.setFrame(genericOverlayInsetsRect1);
|
||||||
navigationBarInsetsProvider1Source.setVisible(true);
|
genericOverlayInsetsProvider1Source.setVisible(true);
|
||||||
InsetsSource navigationBarInsetsProvider2Source = new InsetsSource(
|
InsetsSource genericOverlayInsetsProvider2Source = new InsetsSource(
|
||||||
ITYPE_LOCAL_NAVIGATION_BAR_2);
|
ITYPE_BOTTOM_GENERIC_OVERLAY);
|
||||||
navigationBarInsetsProvider2Source.setFrame(navigationBarInsetsRect2);
|
genericOverlayInsetsProvider2Source.setFrame(genericOverlayInsetsRect2);
|
||||||
navigationBarInsetsProvider2Source.setVisible(true);
|
genericOverlayInsetsProvider2Source.setVisible(true);
|
||||||
|
|
||||||
activity0.forAllWindows(window -> {
|
activity0.forAllWindows(window -> {
|
||||||
assertEquals(navigationBarInsetsRect1,
|
assertEquals(genericOverlayInsetsRect1,
|
||||||
window.getInsetsState().peekSource(ITYPE_LOCAL_NAVIGATION_BAR_1).getFrame());
|
window.getInsetsState().peekSource(ITYPE_TOP_GENERIC_OVERLAY).getFrame());
|
||||||
assertEquals(null,
|
assertEquals(null,
|
||||||
window.getInsetsState().peekSource(ITYPE_LOCAL_NAVIGATION_BAR_2));
|
window.getInsetsState().peekSource(ITYPE_BOTTOM_GENERIC_OVERLAY));
|
||||||
}, true);
|
}, true);
|
||||||
activity1.forAllWindows(window -> {
|
activity1.forAllWindows(window -> {
|
||||||
assertEquals(navigationBarInsetsRect1,
|
assertEquals(genericOverlayInsetsRect1,
|
||||||
window.getInsetsState().peekSource(ITYPE_LOCAL_NAVIGATION_BAR_1).getFrame());
|
window.getInsetsState().peekSource(ITYPE_TOP_GENERIC_OVERLAY).getFrame());
|
||||||
assertEquals(navigationBarInsetsRect2,
|
assertEquals(genericOverlayInsetsRect2,
|
||||||
window.getInsetsState().peekSource(ITYPE_LOCAL_NAVIGATION_BAR_2).getFrame());
|
window.getInsetsState().peekSource(ITYPE_BOTTOM_GENERIC_OVERLAY)
|
||||||
|
.getFrame());
|
||||||
}, true);
|
}, true);
|
||||||
activity2.forAllWindows(window -> {
|
activity2.forAllWindows(window -> {
|
||||||
assertEquals(navigationBarInsetsRect1,
|
assertEquals(genericOverlayInsetsRect1,
|
||||||
window.getInsetsState().peekSource(ITYPE_LOCAL_NAVIGATION_BAR_1).getFrame());
|
window.getInsetsState().peekSource(ITYPE_TOP_GENERIC_OVERLAY).getFrame());
|
||||||
assertEquals(navigationBarInsetsRect2,
|
assertEquals(genericOverlayInsetsRect2,
|
||||||
window.getInsetsState().peekSource(ITYPE_LOCAL_NAVIGATION_BAR_2).getFrame());
|
window.getInsetsState().peekSource(ITYPE_BOTTOM_GENERIC_OVERLAY)
|
||||||
|
.getFrame());
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1344,7 +1346,7 @@ public class WindowContainerTests extends WindowTestsBase {
|
|||||||
/*
|
/*
|
||||||
___ rootTask ________________________________________
|
___ rootTask ________________________________________
|
||||||
| | |
|
| | |
|
||||||
activity0 navigationBarInsetsProvider1 navigationBarInsetsProvider2
|
activity0 genericOverlayInsetsProvider1 genericOverlayInsetsProvider2
|
||||||
*/
|
*/
|
||||||
final Task rootTask = createTask(mDisplayContent);
|
final Task rootTask = createTask(mDisplayContent);
|
||||||
|
|
||||||
@@ -1355,22 +1357,22 @@ public class WindowContainerTests extends WindowTestsBase {
|
|||||||
attrs.setTitle("AppWindow0");
|
attrs.setTitle("AppWindow0");
|
||||||
activity0.addWindow(createWindowState(attrs, activity0));
|
activity0.addWindow(createWindowState(attrs, activity0));
|
||||||
|
|
||||||
Rect navigationBarInsetsRect1 = new Rect(0, 200, 1080, 700);
|
Rect genericOverlayInsetsRect1 = new Rect(0, 200, 1080, 700);
|
||||||
Rect navigationBarInsetsRect2 = new Rect(0, 0, 1080, 200);
|
Rect genericOverlayInsetsRect2 = new Rect(0, 0, 1080, 200);
|
||||||
|
|
||||||
rootTask.addLocalRectInsetsSourceProvider(navigationBarInsetsRect1,
|
rootTask.addLocalRectInsetsSourceProvider(genericOverlayInsetsRect1,
|
||||||
new int[]{ITYPE_LOCAL_NAVIGATION_BAR_1});
|
new int[]{ITYPE_TOP_GENERIC_OVERLAY});
|
||||||
activity0.forAllWindows(window -> {
|
activity0.forAllWindows(window -> {
|
||||||
assertEquals(navigationBarInsetsRect1,
|
assertEquals(genericOverlayInsetsRect1,
|
||||||
window.getInsetsState().peekSource(ITYPE_LOCAL_NAVIGATION_BAR_1).getFrame());
|
window.getInsetsState().peekSource(ITYPE_TOP_GENERIC_OVERLAY).getFrame());
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
rootTask.addLocalRectInsetsSourceProvider(navigationBarInsetsRect2,
|
rootTask.addLocalRectInsetsSourceProvider(genericOverlayInsetsRect2,
|
||||||
new int[]{ITYPE_LOCAL_NAVIGATION_BAR_1});
|
new int[]{ITYPE_TOP_GENERIC_OVERLAY});
|
||||||
|
|
||||||
activity0.forAllWindows(window -> {
|
activity0.forAllWindows(window -> {
|
||||||
assertEquals(navigationBarInsetsRect2,
|
assertEquals(genericOverlayInsetsRect2,
|
||||||
window.getInsetsState().peekSource(ITYPE_LOCAL_NAVIGATION_BAR_1).getFrame());
|
window.getInsetsState().peekSource(ITYPE_TOP_GENERIC_OVERLAY).getFrame());
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1412,30 +1414,32 @@ public class WindowContainerTests extends WindowTestsBase {
|
|||||||
Rect navigationBarInsetsRect2 = new Rect(0, 0, 1080, 200);
|
Rect navigationBarInsetsRect2 = new Rect(0, 0, 1080, 200);
|
||||||
|
|
||||||
rootTask.addLocalRectInsetsSourceProvider(navigationBarInsetsRect1,
|
rootTask.addLocalRectInsetsSourceProvider(navigationBarInsetsRect1,
|
||||||
new int[]{ITYPE_LOCAL_NAVIGATION_BAR_1});
|
new int[]{ITYPE_TOP_GENERIC_OVERLAY});
|
||||||
container.addLocalRectInsetsSourceProvider(navigationBarInsetsRect2,
|
container.addLocalRectInsetsSourceProvider(navigationBarInsetsRect2,
|
||||||
new int[]{ITYPE_LOCAL_NAVIGATION_BAR_2});
|
new int[]{ITYPE_BOTTOM_GENERIC_OVERLAY});
|
||||||
mDisplayContent.getInsetsStateController().onPostLayout();
|
mDisplayContent.getInsetsStateController().onPostLayout();
|
||||||
rootTask.removeLocalInsetsSourceProvider(new int[]{ITYPE_LOCAL_NAVIGATION_BAR_1});
|
rootTask.removeLocalInsetsSourceProvider(new int[]{ITYPE_TOP_GENERIC_OVERLAY});
|
||||||
mDisplayContent.getInsetsStateController().onPostLayout();
|
mDisplayContent.getInsetsStateController().onPostLayout();
|
||||||
|
|
||||||
activity0.forAllWindows(window -> {
|
activity0.forAllWindows(window -> {
|
||||||
assertEquals(null,
|
assertEquals(null,
|
||||||
window.getInsetsState().peekSource(ITYPE_LOCAL_NAVIGATION_BAR_1));
|
window.getInsetsState().peekSource(ITYPE_TOP_GENERIC_OVERLAY));
|
||||||
assertEquals(null,
|
assertEquals(null,
|
||||||
window.getInsetsState().peekSource(ITYPE_LOCAL_NAVIGATION_BAR_2));
|
window.getInsetsState().peekSource(ITYPE_BOTTOM_GENERIC_OVERLAY));
|
||||||
}, true);
|
}, true);
|
||||||
activity1.forAllWindows(window -> {
|
activity1.forAllWindows(window -> {
|
||||||
assertEquals(null,
|
assertEquals(null,
|
||||||
window.getInsetsState().peekSource(ITYPE_LOCAL_NAVIGATION_BAR_1));
|
window.getInsetsState().peekSource(ITYPE_TOP_GENERIC_OVERLAY));
|
||||||
assertEquals(navigationBarInsetsRect2,
|
assertEquals(navigationBarInsetsRect2,
|
||||||
window.getInsetsState().peekSource(ITYPE_LOCAL_NAVIGATION_BAR_2).getFrame());
|
window.getInsetsState().peekSource(ITYPE_BOTTOM_GENERIC_OVERLAY)
|
||||||
|
.getFrame());
|
||||||
}, true);
|
}, true);
|
||||||
activity2.forAllWindows(window -> {
|
activity2.forAllWindows(window -> {
|
||||||
assertEquals(null,
|
assertEquals(null,
|
||||||
window.getInsetsState().peekSource(ITYPE_LOCAL_NAVIGATION_BAR_1));
|
window.getInsetsState().peekSource(ITYPE_TOP_GENERIC_OVERLAY));
|
||||||
assertEquals(navigationBarInsetsRect2,
|
assertEquals(navigationBarInsetsRect2,
|
||||||
window.getInsetsState().peekSource(ITYPE_LOCAL_NAVIGATION_BAR_2).getFrame());
|
window.getInsetsState().peekSource(ITYPE_BOTTOM_GENERIC_OVERLAY)
|
||||||
|
.getFrame());
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET;
|
|||||||
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
||||||
import static android.content.res.Configuration.SCREEN_HEIGHT_DP_UNDEFINED;
|
import static android.content.res.Configuration.SCREEN_HEIGHT_DP_UNDEFINED;
|
||||||
import static android.content.res.Configuration.SCREEN_WIDTH_DP_UNDEFINED;
|
import static android.content.res.Configuration.SCREEN_WIDTH_DP_UNDEFINED;
|
||||||
import static android.view.InsetsState.ITYPE_LOCAL_NAVIGATION_BAR_1;
|
import static android.view.InsetsState.ITYPE_TOP_GENERIC_OVERLAY;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
|
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
|
||||||
|
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
|
||||||
@@ -779,11 +779,11 @@ public class WindowOrganizerTests extends WindowTestsBase {
|
|||||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||||
wct.addRectInsetsProvider(navigationBarInsetsReceiverTask.mRemoteToken
|
wct.addRectInsetsProvider(navigationBarInsetsReceiverTask.mRemoteToken
|
||||||
.toWindowContainerToken(), navigationBarInsetsProviderRect,
|
.toWindowContainerToken(), navigationBarInsetsProviderRect,
|
||||||
new int[]{ITYPE_LOCAL_NAVIGATION_BAR_1});
|
new int[]{ITYPE_TOP_GENERIC_OVERLAY});
|
||||||
mWm.mAtmService.mWindowOrganizerController.applyTransaction(wct);
|
mWm.mAtmService.mWindowOrganizerController.applyTransaction(wct);
|
||||||
|
|
||||||
assertThat(navigationBarInsetsReceiverTask.mLocalInsetsSourceProviders
|
assertThat(navigationBarInsetsReceiverTask.mLocalInsetsSourceProviders
|
||||||
.valueAt(0).getSource().getType()).isEqualTo(ITYPE_LOCAL_NAVIGATION_BAR_1);
|
.valueAt(0).getSource().getType()).isEqualTo(ITYPE_TOP_GENERIC_OVERLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -799,12 +799,12 @@ public class WindowOrganizerTests extends WindowTestsBase {
|
|||||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||||
wct.addRectInsetsProvider(navigationBarInsetsReceiverTask.mRemoteToken
|
wct.addRectInsetsProvider(navigationBarInsetsReceiverTask.mRemoteToken
|
||||||
.toWindowContainerToken(), navigationBarInsetsProviderRect,
|
.toWindowContainerToken(), navigationBarInsetsProviderRect,
|
||||||
new int[]{ITYPE_LOCAL_NAVIGATION_BAR_1});
|
new int[]{ITYPE_TOP_GENERIC_OVERLAY});
|
||||||
mWm.mAtmService.mWindowOrganizerController.applyTransaction(wct);
|
mWm.mAtmService.mWindowOrganizerController.applyTransaction(wct);
|
||||||
|
|
||||||
final WindowContainerTransaction wct2 = new WindowContainerTransaction();
|
final WindowContainerTransaction wct2 = new WindowContainerTransaction();
|
||||||
wct2.removeInsetsProvider(navigationBarInsetsReceiverTask.mRemoteToken
|
wct2.removeInsetsProvider(navigationBarInsetsReceiverTask.mRemoteToken
|
||||||
.toWindowContainerToken(), new int[]{ITYPE_LOCAL_NAVIGATION_BAR_1});
|
.toWindowContainerToken(), new int[]{ITYPE_TOP_GENERIC_OVERLAY});
|
||||||
mWm.mAtmService.mWindowOrganizerController.applyTransaction(wct2);
|
mWm.mAtmService.mWindowOrganizerController.applyTransaction(wct2);
|
||||||
|
|
||||||
assertThat(navigationBarInsetsReceiverTask.mLocalInsetsSourceProviders.size()).isEqualTo(0);
|
assertThat(navigationBarInsetsReceiverTask.mLocalInsetsSourceProviders.size()).isEqualTo(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user