diff options
14 files changed, 162 insertions, 108 deletions
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index 1773ec2b17ee..76fe6b5f666d 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -1894,7 +1894,13 @@ public final class AutofillManager { final SyncResultReceiver receiver = new SyncResultReceiver(SYNC_CALLS_TIMEOUT_MS); mService.addClient(mServiceClient, client.autofillClientGetComponentName(), userId, receiver); - final int flags = receiver.getIntResult(); + int flags = 0; + try { + flags = receiver.getIntResult(); + } catch (SyncResultReceiver.TimeoutException e) { + Log.w(TAG, "Failed to initialize autofill: " + e); + return; + } mEnabled = (flags & FLAG_ADD_CLIENT_ENABLED) != 0; sDebug = (flags & FLAG_ADD_CLIENT_DEBUG) != 0; sVerbose = (flags & FLAG_ADD_CLIENT_VERBOSE) != 0; diff --git a/media/java/android/media/MediaRouter2Manager.java b/media/java/android/media/MediaRouter2Manager.java index e3c7336905d1..0dc019cc7abd 100644 --- a/media/java/android/media/MediaRouter2Manager.java +++ b/media/java/android/media/MediaRouter2Manager.java @@ -635,8 +635,11 @@ public final class MediaRouter2Manager { public List<MediaRoute2Info> getSelectedRoutes(@NonNull RoutingSessionInfo sessionInfo) { Objects.requireNonNull(sessionInfo, "sessionInfo must not be null"); - List<String> routeIds = sessionInfo.getSelectedRoutes(); - return getRoutesWithIds(routeIds); + synchronized (sLock) { + return sessionInfo.getSelectedRoutes().stream().map(mRoutes::get) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + } } /** @@ -646,8 +649,15 @@ public final class MediaRouter2Manager { public List<MediaRoute2Info> getSelectableRoutes(@NonNull RoutingSessionInfo sessionInfo) { Objects.requireNonNull(sessionInfo, "sessionInfo must not be null"); - List<String> routeIds = sessionInfo.getSelectableRoutes(); - return getRoutesWithIds(routeIds); + List<String> selectedRouteIds = sessionInfo.getSelectedRoutes(); + + synchronized (sLock) { + return sessionInfo.getSelectableRoutes().stream() + .filter(routeId -> !selectedRouteIds.contains(routeId)) + .map(mRoutes::get) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + } } /** @@ -657,8 +667,15 @@ public final class MediaRouter2Manager { public List<MediaRoute2Info> getDeselectableRoutes(@NonNull RoutingSessionInfo sessionInfo) { Objects.requireNonNull(sessionInfo, "sessionInfo must not be null"); - List<String> routeIds = sessionInfo.getDeselectableRoutes(); - return getRoutesWithIds(routeIds); + List<String> selectedRouteIds = sessionInfo.getSelectedRoutes(); + + synchronized (sLock) { + return sessionInfo.getDeselectableRoutes().stream() + .filter(routeId -> selectedRouteIds.contains(routeId)) + .map(mRoutes::get) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + } } /** @@ -840,14 +857,6 @@ public final class MediaRouter2Manager { sessionInfo.getOwnerPackageName()); } - private List<MediaRoute2Info> getRoutesWithIds(List<String> routeIds) { - synchronized (sLock) { - return routeIds.stream().map(mRoutes::get) - .filter(Objects::nonNull) - .collect(Collectors.toList()); - } - } - /** * Interface for receiving events about media routing changes. */ diff --git a/media/tests/MediaRouter/src/com/android/mediaroutertest/MediaRouter2ManagerTest.java b/media/tests/MediaRouter/src/com/android/mediaroutertest/MediaRouter2ManagerTest.java index 6a1e9656cf2c..eee797af40d7 100644 --- a/media/tests/MediaRouter/src/com/android/mediaroutertest/MediaRouter2ManagerTest.java +++ b/media/tests/MediaRouter/src/com/android/mediaroutertest/MediaRouter2ManagerTest.java @@ -26,6 +26,7 @@ import static com.android.mediaroutertest.StubMediaRoute2ProviderService.FEATURE import static com.android.mediaroutertest.StubMediaRoute2ProviderService.FEATURE_SPECIAL; import static com.android.mediaroutertest.StubMediaRoute2ProviderService.ROUTE_ID1; import static com.android.mediaroutertest.StubMediaRoute2ProviderService.ROUTE_ID2; +import static com.android.mediaroutertest.StubMediaRoute2ProviderService.ROUTE_ID4_TO_SELECT_AND_DESELECT; import static com.android.mediaroutertest.StubMediaRoute2ProviderService.ROUTE_ID5_TO_TRANSFER_TO; import static com.android.mediaroutertest.StubMediaRoute2ProviderService.ROUTE_ID_FIXED_VOLUME; import static com.android.mediaroutertest.StubMediaRoute2ProviderService.ROUTE_ID_SPECIAL_FEATURE; @@ -68,6 +69,7 @@ import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.function.Predicate; +import java.util.stream.Collectors; @RunWith(AndroidJUnit4.class) @SmallTest @@ -566,6 +568,41 @@ public class MediaRouter2ManagerTest { assertFalse(failureLatch.await(WAIT_TIME_MS, TimeUnit.MILLISECONDS)); } + /** + * Tests if getSelectableRoutes and getDeselectableRoutes filter routes based on + * selected routes + */ + @Test + public void testGetSelectableRoutes_notReturnsSelectedRoutes() throws Exception { + Map<String, MediaRoute2Info> routes = waitAndGetRoutesWithManager(FEATURES_ALL); + addRouterCallback(new RouteCallback() {}); + + CountDownLatch onSessionCreatedLatch = new CountDownLatch(1); + + addManagerCallback(new MediaRouter2Manager.Callback() { + @Override + public void onTransferred(RoutingSessionInfo oldSessionInfo, + RoutingSessionInfo newSessionInfo) { + assertNotNull(newSessionInfo); + List<String> selectedRoutes = mManager.getSelectedRoutes(newSessionInfo).stream() + .map(MediaRoute2Info::getId) + .collect(Collectors.toList()); + for (MediaRoute2Info selectableRoute : + mManager.getSelectableRoutes(newSessionInfo)) { + assertFalse(selectedRoutes.contains(selectableRoute.getId())); + } + for (MediaRoute2Info deselectableRoute : + mManager.getDeselectableRoutes(newSessionInfo)) { + assertTrue(selectedRoutes.contains(deselectableRoute.getId())); + } + onSessionCreatedLatch.countDown(); + } + }); + + mManager.selectRoute(mPackageName, routes.get(ROUTE_ID4_TO_SELECT_AND_DESELECT)); + assertTrue(onSessionCreatedLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)); + } + Map<String, MediaRoute2Info> waitAndGetRoutesWithManager(List<String> routeFeatures) throws Exception { CountDownLatch addedLatch = new CountDownLatch(1); diff --git a/packages/CarSystemUI/src/com/android/systemui/car/keyguard/CarKeyguardViewController.java b/packages/CarSystemUI/src/com/android/systemui/car/keyguard/CarKeyguardViewController.java index 06d14449aa0d..aee7643b69f7 100644 --- a/packages/CarSystemUI/src/com/android/systemui/car/keyguard/CarKeyguardViewController.java +++ b/packages/CarSystemUI/src/com/android/systemui/car/keyguard/CarKeyguardViewController.java @@ -171,6 +171,7 @@ public class CarKeyguardViewController extends OverlayViewController implements mKeyguardStateController.notifyKeyguardState(mShowing, /* occluded= */ false); mCarNavigationBarController.showAllKeyguardButtons(/* isSetUp= */ true); start(); + getOverlayViewGlobalStateController().setWindowFocusable(/* focusable= */ true); reset(/* hideBouncerWhenShowing= */ false); notifyKeyguardUpdateMonitor(); } @@ -185,6 +186,7 @@ public class CarKeyguardViewController extends OverlayViewController implements mBouncer.hide(/* destroyView= */ true); mCarNavigationBarController.hideAllKeyguardButtons(/* isSetUp= */ true); stop(); + getOverlayViewGlobalStateController().setWindowFocusable(/* focusable= */ false); mKeyguardStateController.notifyKeyguardDoneFading(); mViewMediatorCallback.keyguardGone(); notifyKeyguardUpdateMonitor(); @@ -229,7 +231,9 @@ public class CarKeyguardViewController extends OverlayViewController implements @Override public void dismissAndCollapse() { - hide(/* startTime= */ 0, /* fadeoutDuration= */ 0); + if (!mBouncer.isSecure()) { + hide(/* startTime= */ 0, /* fadeoutDuration= */ 0); + } } @Override @@ -241,7 +245,6 @@ public class CarKeyguardViewController extends OverlayViewController implements @Override public void setNeedsInput(boolean needsInput) { - getOverlayViewGlobalStateController().setWindowFocusable(needsInput); getOverlayViewGlobalStateController().setWindowNeedsInput(needsInput); } diff --git a/packages/SettingsLib/res/values/strings.xml b/packages/SettingsLib/res/values/strings.xml index 934f61091bcc..e42e43801936 100644 --- a/packages/SettingsLib/res/values/strings.xml +++ b/packages/SettingsLib/res/values/strings.xml @@ -1373,4 +1373,7 @@ <string name="cached_apps_freezer_enabled">Enabled</string> <!-- Developer setting dialog prompting the user to reboot after changing the app freezer setting [CHAR LIMIT=NONE]--> <string name="cached_apps_freezer_reboot_dialog_text">Your device must be rebooted for this change to apply. Reboot now or cancel.</string> + + <!-- A content description for work profile app [CHAR LIMIT=35] --> + <string name="accessibility_work_profile_app_description">Work <xliff:g id="app_name" example="Camera">%s</xliff:g></string> </resources> diff --git a/packages/SettingsLib/src/com/android/settingslib/applications/AppUtils.java b/packages/SettingsLib/src/com/android/settingslib/applications/AppUtils.java index ae3194df28fe..b1f2a397bde6 100644 --- a/packages/SettingsLib/src/com/android/settingslib/applications/AppUtils.java +++ b/packages/SettingsLib/src/com/android/settingslib/applications/AppUtils.java @@ -26,6 +26,7 @@ import android.hardware.usb.IUsbManager; import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserHandle; +import android.os.UserManager; import android.util.Log; import com.android.settingslib.R; @@ -129,7 +130,7 @@ public class AppUtils { */ public static boolean isHiddenSystemModule(Context context, String packageName) { return ApplicationsState.getInstance((Application) context.getApplicationContext()) - .isHiddenModule(packageName); + .isHiddenModule(packageName); } /** @@ -151,4 +152,17 @@ public class AppUtils { return false; } } + + /** + * Returns a content description of an app name which distinguishes a personal app from a + * work app for accessibility purpose. + * If the app is in a work profile, then add a "work" prefix to the app name. + */ + public static String getAppContentDescription(Context context, String packageName, + int userId) { + final CharSequence appLabel = getApplicationLabel(context.getPackageManager(), packageName); + return UserManager.get(context).isManagedProfile(userId) + ? context.getString(R.string.accessibility_work_profile_app_description, appLabel) + : appLabel.toString(); + } } diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java index 1bc026cd3b19..1aeb19bb4a9e 100644 --- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java @@ -260,7 +260,7 @@ final class AutofillManagerServiceImpl if (isEnabledLocked()) return FLAG_ADD_CLIENT_ENABLED; // Check if it's enabled for augmented autofill - if (isAugmentedAutofillServiceAvailableLocked() + if (componentName != null && isAugmentedAutofillServiceAvailableLocked() && isWhitelistedForAugmentedAutofillLocked(componentName)) { return FLAG_ADD_CLIENT_ENABLED_FOR_AUGMENTED_AUTOFILL_ONLY; } diff --git a/services/core/Android.bp b/services/core/Android.bp index 21ac3cd24089..cf85b1d012d2 100644 --- a/services/core/Android.bp +++ b/services/core/Android.bp @@ -130,6 +130,7 @@ java_library_static { "dnsresolver_aidl_interface-java", "netd_aidl_interfaces-platform-java", "overlayable_policy_aidl-java", + "SurfaceFlingerProperties", ], } diff --git a/services/core/java/com/android/server/media/BluetoothRouteProvider.java b/services/core/java/com/android/server/media/BluetoothRouteProvider.java index 3cf22c85f924..54958d347096 100644 --- a/services/core/java/com/android/server/media/BluetoothRouteProvider.java +++ b/services/core/java/com/android/server/media/BluetoothRouteProvider.java @@ -29,6 +29,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.media.AudioManager; import android.media.MediaRoute2Info; +import android.text.TextUtils; import android.util.Slog; import android.util.SparseBooleanArray; @@ -210,7 +211,11 @@ class BluetoothRouteProvider { newBtRoute.btDevice = device; // Current / Max volume will be set when connected. // TODO: Is there any BT device which has fixed volume? - newBtRoute.route = new MediaRoute2Info.Builder(device.getAddress(), device.getName()) + String deviceName = device.getName(); + if (TextUtils.isEmpty(deviceName)) { + deviceName = mContext.getResources().getText(R.string.unknownName).toString(); + } + newBtRoute.route = new MediaRoute2Info.Builder(device.getAddress(), deviceName) .addFeature(MediaRoute2Info.FEATURE_LIVE_AUDIO) .setConnectionState(MediaRoute2Info.CONNECTION_STATE_DISCONNECTED) .setDescription(mContext.getResources().getText( diff --git a/services/core/java/com/android/server/net/NetworkStatsService.java b/services/core/java/com/android/server/net/NetworkStatsService.java index 1951fc071d3a..adf017633c29 100644 --- a/services/core/java/com/android/server/net/NetworkStatsService.java +++ b/services/core/java/com/android/server/net/NetworkStatsService.java @@ -178,6 +178,9 @@ public class NetworkStatsService extends INetworkStatsService.Stub { // Perform polling, persist network, and register the global alert again. private static final int MSG_PERFORM_POLL_REGISTER_ALERT = 2; private static final int MSG_UPDATE_IFACES = 3; + // A message for broadcasting ACTION_NETWORK_STATS_UPDATED in handler thread to prevent + // deadlock. + private static final int MSG_BROADCAST_NETWORK_STATS_UPDATED = 4; /** Flags to control detail level of poll event. */ private static final int FLAG_PERSIST_NETWORK = 0x1; @@ -386,6 +389,13 @@ public class NetworkStatsService extends INetworkStatsService.Stub { registerGlobalAlert(); break; } + case MSG_BROADCAST_NETWORK_STATS_UPDATED: { + final Intent updatedIntent = new Intent(ACTION_NETWORK_STATS_UPDATED); + updatedIntent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); + mContext.sendBroadcastAsUser(updatedIntent, UserHandle.ALL, + READ_NETWORK_USAGE_HISTORY); + break; + } } } } @@ -1513,10 +1523,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub { } // finally, dispatch updated event to any listeners - final Intent updatedIntent = new Intent(ACTION_NETWORK_STATS_UPDATED); - updatedIntent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); - mContext.sendBroadcastAsUser(updatedIntent, UserHandle.ALL, - READ_NETWORK_USAGE_HISTORY); + mHandler.sendMessage(mHandler.obtainMessage(MSG_BROADCAST_NETWORK_STATS_UPDATED)); Trace.traceEnd(TRACE_TAG_NETWORK); } diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index ad806c2bcae7..4b427a24a1cc 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -570,7 +570,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A private final WindowState.UpdateReportedVisibilityResults mReportedVisibilityResults = new WindowState.UpdateReportedVisibilityResults(); - boolean mUseTransferredAnimation; + private boolean mUseTransferredAnimation; /** * @see #currentLaunchCanTurnScreenOn() @@ -3366,12 +3366,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } setClientVisible(fromActivity.mClientVisible); - transferAnimation(fromActivity); + if (fromActivity.isAnimating()) { + transferAnimation(fromActivity); - // When transferring an animation, we no longer need to apply an animation to the - // the token we transfer the animation over. Thus, set this flag to indicate we've - // transferred the animation. - mUseTransferredAnimation = true; + // When transferring an animation, we no longer need to apply an animation to + // the token we transfer the animation over. Thus, set this flag to indicate + // we've transferred the animation. + mUseTransferredAnimation = true; + } mWmService.updateFocusedWindowLocked( UPDATE_FOCUS_WILL_PLACE_SURFACES, true /*updateInputWindows*/); diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index ae0c9b15689a..814fa7287646 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -196,6 +196,7 @@ import android.provider.DeviceConfig; import android.provider.Settings; import android.service.vr.IVrManager; import android.service.vr.IVrStateCallbacks; +import android.sysprop.SurfaceFlingerProperties; import android.text.format.DateUtils; import android.util.ArrayMap; import android.util.ArraySet; @@ -305,7 +306,9 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.NoSuchElementException; import java.util.Objects; +import java.util.Optional; import java.util.function.Function; import java.util.function.Supplier; @@ -4692,6 +4695,11 @@ public class WindowManagerService extends IWindowManager.Stub } private static boolean queryWideColorGamutSupport() { + boolean defaultValue = false; + Optional<Boolean> hasWideColorProp = SurfaceFlingerProperties.has_wide_color_display(); + if (hasWideColorProp.isPresent()) { + return hasWideColorProp.get(); + } try { ISurfaceFlingerConfigs surfaceFlinger = ISurfaceFlingerConfigs.getService(); OptionalBool hasWideColor = surfaceFlinger.hasWideColorDisplay(); @@ -4700,11 +4708,18 @@ public class WindowManagerService extends IWindowManager.Stub } } catch (RemoteException e) { // Ignore, we're in big trouble if we can't talk to SurfaceFlinger's config store + } catch (NoSuchElementException e) { + return defaultValue; } return false; } private static boolean queryHdrSupport() { + boolean defaultValue = false; + Optional<Boolean> hasHdrProp = SurfaceFlingerProperties.has_HDR_display(); + if (hasHdrProp.isPresent()) { + return hasHdrProp.get(); + } try { ISurfaceFlingerConfigs surfaceFlinger = ISurfaceFlingerConfigs.getService(); OptionalBool hasHdr = surfaceFlinger.hasHDRDisplay(); @@ -4713,6 +4728,8 @@ public class WindowManagerService extends IWindowManager.Stub } } catch (RemoteException e) { // Ignore, we're in big trouble if we can't talk to SurfaceFlinger's config store + } catch (NoSuchElementException e) { + return defaultValue; } return false; } diff --git a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java index cf3cfecbf65e..5c21853b1f59 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java @@ -31,10 +31,12 @@ import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; +import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_AFTER_ANIM; import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_BEFORE_ANIM; import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_NONE; @@ -59,6 +61,8 @@ import android.view.WindowManager; import androidx.test.filters.FlakyTest; import androidx.test.filters.SmallTest; +import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -365,6 +369,30 @@ public class AppWindowTokenTests extends WindowTestsBase { assertHasStartingWindow(activity2); } + @Test + public void testTransferStartingWindowCanAnimate() { + final ActivityRecord activity1 = createIsolatedTestActivityRecord(); + final ActivityRecord activity2 = createIsolatedTestActivityRecord(); + activity1.addStartingWindow(mPackageName, + android.R.style.Theme, null, "Test", 0, 0, 0, 0, null, true, true, false, true, + false, false); + waitUntilHandlersIdle(); + activity2.addStartingWindow(mPackageName, + android.R.style.Theme, null, "Test", 0, 0, 0, 0, activity1.appToken.asBinder(), + true, true, false, true, false, false); + waitUntilHandlersIdle(); + assertNoStartingWindow(activity1); + assertHasStartingWindow(activity2); + + // Assert that bottom activity is allowed to do animation. + doReturn(true).when(activity2).okToAnimate(); + doReturn(true).when(activity2).isAnimating(); + final OnAnimationFinishedCallback onAnimationFinishedCallback = + mock(OnAnimationFinishedCallback.class); + assertTrue(activity2.applyAnimation(null, TRANSIT_ACTIVITY_OPEN, true, false, + onAnimationFinishedCallback)); + } + private ActivityRecord createIsolatedTestActivityRecord() { final ActivityStack taskStack = createTaskStackOnDisplay(mDisplayContent); final Task task = createTaskInStack(taskStack, 0 /* userId */); diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java index 28ae36abbb5b..d605ab25bd57 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java @@ -38,13 +38,11 @@ import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; -import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_SCREEN_DECOR; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; -import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL; @@ -346,82 +344,6 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { assertInsetByTopBottom(mWindow.getDecorFrame(), 0, 0); } - // TODO(b/118118435): remove after migration - @Test - public void layoutWindowLw_appDrawsBarsLegacy() { - assumeTrue(ViewRootImpl.sNewInsetsMode != ViewRootImpl.NEW_INSETS_MODE_FULL); - - mWindow.mAttrs.flags = - FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; - addWindow(mWindow); - - mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */); - mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames); - - assertInsetByTopBottom(mWindow.getParentFrame(), 0, 0); - assertInsetByTopBottom(mWindow.getStableFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT); - assertInsetByTopBottom(mWindow.getContentFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT); - assertInsetByTopBottom(mWindow.getDecorFrame(), 0, 0); - assertInsetBy(mWindow.getDisplayFrameLw(), 0, 0, 0, 0); - } - - // TODO(b/118118435): remove after migration - @Test - public void layoutWindowLw_appWontDrawBars() { - assumeTrue(ViewRootImpl.sNewInsetsMode != ViewRootImpl.NEW_INSETS_MODE_FULL); - - mWindow.mAttrs.flags = FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR; - addWindow(mWindow); - - mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */); - mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames); - - assertInsetByTopBottom(mWindow.getParentFrame(), 0, NAV_BAR_HEIGHT); - assertInsetByTopBottom(mWindow.getStableFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT); - assertInsetByTopBottom(mWindow.getContentFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT); - assertInsetByTopBottom(mWindow.getDecorFrame(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT); - assertInsetByTopBottom(mWindow.getDisplayFrameLw(), 0, NAV_BAR_HEIGHT); - } - - // TODO(b/118118435): remove after migration - @Test - public void layoutWindowLw_appWontDrawBars_forceStatusAndNav() throws Exception { - assumeTrue(ViewRootImpl.sNewInsetsMode != ViewRootImpl.NEW_INSETS_MODE_FULL); - - mWindow.mAttrs.flags = FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR; - mWindow.mAttrs.privateFlags = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS; - addWindow(mWindow); - - mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */); - mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames); - - assertInsetByTopBottom(mWindow.getParentFrame(), 0, 0); - assertInsetByTopBottom(mWindow.getStableFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT); - assertInsetByTopBottom(mWindow.getContentFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT); - assertInsetByTopBottom(mWindow.getDecorFrame(), 0, 0); - assertInsetByTopBottom(mWindow.getDisplayFrameLw(), 0, 0); - } - - // TODO(b/118118435): remove after migration (keyguard dialog is not special with the new logic) - @Test - public void layoutWindowLw_keyguardDialog_hideNav() { - mWindow.mAttrs.type = TYPE_KEYGUARD_DIALOG; - mWindow.mAttrs.flags = - FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; - mWindow.mAttrs.systemUiVisibility = SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; - mWindow.mAttrs.setFitInsetsTypes(0 /* types */); - addWindow(mWindow); - - mDisplayPolicy.beginLayoutLw(mFrames, 0 /* uiMode */); - mDisplayPolicy.layoutWindowLw(mWindow, null /* attached */, mFrames); - - assertInsetByTopBottom(mWindow.getParentFrame(), 0, 0); - assertInsetByTopBottom(mWindow.getStableFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT); - assertInsetByTopBottom(mWindow.getContentFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT); - assertInsetByTopBottom(mWindow.getDecorFrame(), 0, 0); - assertInsetByTopBottom(mWindow.getDisplayFrameLw(), 0, 0); - } - @Test public void layoutWindowLw_withDisplayCutout() { addDisplayCutout(); |