Loading libs/WindowManager/Jetpack/src/androidx/window/extensions/WindowExtensionsImpl.java +1 −8 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package androidx.window.extensions; import android.app.ActivityThread; import android.app.Application; import android.content.Context; import android.window.TaskFragmentOrganizer; import androidx.annotation.NonNull; import androidx.window.common.DeviceStateManagerFoldingFeatureProducer; Loading Loading @@ -81,13 +80,7 @@ public class WindowExtensionsImpl implements WindowExtensions { Context context = getApplication(); DeviceStateManagerFoldingFeatureProducer producer = getFoldingFeatureProducer(); // TODO(b/263263909) Use the organizer to tell if an Activity is embededed. // Need to improve our Dependency Injection and centralize the logic. TaskFragmentOrganizer organizer = new TaskFragmentOrganizer(command -> { throw new RuntimeException("Not allowed!"); }); mWindowLayoutComponent = new WindowLayoutComponentImpl(context, organizer, producer); mWindowLayoutComponent = new WindowLayoutComponentImpl(context, producer); } } } Loading libs/WindowManager/Jetpack/src/androidx/window/extensions/layout/WindowLayoutComponentImpl.java +5 −40 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import static androidx.window.util.ExtensionHelper.rotateRectToDisplayRotation; import static androidx.window.util.ExtensionHelper.transformToWindowSpaceRect; import android.app.Activity; import android.app.ActivityClient; import android.app.Application; import android.app.WindowConfiguration; import android.content.ComponentCallbacks; Loading @@ -34,8 +33,6 @@ import android.graphics.Rect; import android.os.Bundle; import android.os.IBinder; import android.util.ArrayMap; import android.view.WindowManager; import android.window.TaskFragmentOrganizer; import androidx.annotation.GuardedBy; import androidx.annotation.NonNull; Loading @@ -51,7 +48,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; /** Loading Loading @@ -85,16 +81,12 @@ public class WindowLayoutComponentImpl implements WindowLayoutComponent { private final Map<java.util.function.Consumer<WindowLayoutInfo>, Consumer<WindowLayoutInfo>> mJavaToExtConsumers = new ArrayMap<>(); private final TaskFragmentOrganizer mTaskFragmentOrganizer; public WindowLayoutComponentImpl(@NonNull Context context, @NonNull TaskFragmentOrganizer taskFragmentOrganizer, @NonNull DeviceStateManagerFoldingFeatureProducer foldingFeatureProducer) { ((Application) context.getApplicationContext()) .registerActivityLifecycleCallbacks(new NotifyOnConfigurationChanged()); mFoldingFeatureProducer = foldingFeatureProducer; mFoldingFeatureProducer.addDataChangedCallback(this::onDisplayFeaturesChanged); mTaskFragmentOrganizer = taskFragmentOrganizer; } /** Registers to listen to {@link CommonFoldingFeature} changes */ Loading Loading @@ -382,38 +374,11 @@ public class WindowLayoutComponentImpl implements WindowLayoutComponent { // Display features are not supported on secondary displays. return false; } final int windowingMode; IBinder activityToken = context.getActivityToken(); if (activityToken != null) { final Configuration taskConfig = ActivityClient.getInstance().getTaskConfiguration( activityToken); if (taskConfig == null) { // If we cannot determine the task configuration for any reason, it is likely that // we won't be able to determine its position correctly as well. DisplayFeatures' // bounds in this case can't be computed correctly, so we should skip. return false; } final Rect taskBounds = taskConfig.windowConfiguration.getBounds(); final WindowManager windowManager = Objects.requireNonNull( context.getSystemService(WindowManager.class)); final Rect maxBounds = windowManager.getMaximumWindowMetrics().getBounds(); boolean isTaskExpanded = maxBounds.equals(taskBounds); /* * We need to proxy being in full screen because when a user enters PiP and exits PiP * the task windowingMode will report multi-window/pinned until the transition is * finished in WM Shell. * maxBounds == taskWindowBounds is a proxy check to verify the window is full screen */ return isTaskExpanded; } else { // TODO(b/242674941): use task windowing mode for window context that associates with // activity. windowingMode = context.getResources().getConfiguration().windowConfiguration .getWindowingMode(); } // It is recommended not to report any display features in multi-window mode, since it // won't be possible to synchronize the display feature positions with window movement. return !WindowConfiguration.inMultiWindowMode(windowingMode); // We do not report folding features for Activities in PiP because the bounds are // not updated fast enough and the window is too small for the UI to adapt. return context.getResources().getConfiguration().windowConfiguration .getWindowingMode() != WindowConfiguration.WINDOWING_MODE_PINNED; } @GuardedBy("mLock") Loading Loading
libs/WindowManager/Jetpack/src/androidx/window/extensions/WindowExtensionsImpl.java +1 −8 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package androidx.window.extensions; import android.app.ActivityThread; import android.app.Application; import android.content.Context; import android.window.TaskFragmentOrganizer; import androidx.annotation.NonNull; import androidx.window.common.DeviceStateManagerFoldingFeatureProducer; Loading Loading @@ -81,13 +80,7 @@ public class WindowExtensionsImpl implements WindowExtensions { Context context = getApplication(); DeviceStateManagerFoldingFeatureProducer producer = getFoldingFeatureProducer(); // TODO(b/263263909) Use the organizer to tell if an Activity is embededed. // Need to improve our Dependency Injection and centralize the logic. TaskFragmentOrganizer organizer = new TaskFragmentOrganizer(command -> { throw new RuntimeException("Not allowed!"); }); mWindowLayoutComponent = new WindowLayoutComponentImpl(context, organizer, producer); mWindowLayoutComponent = new WindowLayoutComponentImpl(context, producer); } } } Loading
libs/WindowManager/Jetpack/src/androidx/window/extensions/layout/WindowLayoutComponentImpl.java +5 −40 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import static androidx.window.util.ExtensionHelper.rotateRectToDisplayRotation; import static androidx.window.util.ExtensionHelper.transformToWindowSpaceRect; import android.app.Activity; import android.app.ActivityClient; import android.app.Application; import android.app.WindowConfiguration; import android.content.ComponentCallbacks; Loading @@ -34,8 +33,6 @@ import android.graphics.Rect; import android.os.Bundle; import android.os.IBinder; import android.util.ArrayMap; import android.view.WindowManager; import android.window.TaskFragmentOrganizer; import androidx.annotation.GuardedBy; import androidx.annotation.NonNull; Loading @@ -51,7 +48,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; /** Loading Loading @@ -85,16 +81,12 @@ public class WindowLayoutComponentImpl implements WindowLayoutComponent { private final Map<java.util.function.Consumer<WindowLayoutInfo>, Consumer<WindowLayoutInfo>> mJavaToExtConsumers = new ArrayMap<>(); private final TaskFragmentOrganizer mTaskFragmentOrganizer; public WindowLayoutComponentImpl(@NonNull Context context, @NonNull TaskFragmentOrganizer taskFragmentOrganizer, @NonNull DeviceStateManagerFoldingFeatureProducer foldingFeatureProducer) { ((Application) context.getApplicationContext()) .registerActivityLifecycleCallbacks(new NotifyOnConfigurationChanged()); mFoldingFeatureProducer = foldingFeatureProducer; mFoldingFeatureProducer.addDataChangedCallback(this::onDisplayFeaturesChanged); mTaskFragmentOrganizer = taskFragmentOrganizer; } /** Registers to listen to {@link CommonFoldingFeature} changes */ Loading Loading @@ -382,38 +374,11 @@ public class WindowLayoutComponentImpl implements WindowLayoutComponent { // Display features are not supported on secondary displays. return false; } final int windowingMode; IBinder activityToken = context.getActivityToken(); if (activityToken != null) { final Configuration taskConfig = ActivityClient.getInstance().getTaskConfiguration( activityToken); if (taskConfig == null) { // If we cannot determine the task configuration for any reason, it is likely that // we won't be able to determine its position correctly as well. DisplayFeatures' // bounds in this case can't be computed correctly, so we should skip. return false; } final Rect taskBounds = taskConfig.windowConfiguration.getBounds(); final WindowManager windowManager = Objects.requireNonNull( context.getSystemService(WindowManager.class)); final Rect maxBounds = windowManager.getMaximumWindowMetrics().getBounds(); boolean isTaskExpanded = maxBounds.equals(taskBounds); /* * We need to proxy being in full screen because when a user enters PiP and exits PiP * the task windowingMode will report multi-window/pinned until the transition is * finished in WM Shell. * maxBounds == taskWindowBounds is a proxy check to verify the window is full screen */ return isTaskExpanded; } else { // TODO(b/242674941): use task windowing mode for window context that associates with // activity. windowingMode = context.getResources().getConfiguration().windowConfiguration .getWindowingMode(); } // It is recommended not to report any display features in multi-window mode, since it // won't be possible to synchronize the display feature positions with window movement. return !WindowConfiguration.inMultiWindowMode(windowingMode); // We do not report folding features for Activities in PiP because the bounds are // not updated fast enough and the window is too small for the UI to adapt. return context.getResources().getConfiguration().windowConfiguration .getWindowingMode() != WindowConfiguration.WINDOWING_MODE_PINNED; } @GuardedBy("mLock") Loading