Revert "Update Window Extensions library APIs"
Revert submission 20478705-functional_interface Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/tests/view?testResultId=TR92628441204212347, bug b/264025195. Reverted changes: /q/submissionid:20478705-functional_interface Tests: https://android-build.googleplex.com/builds/abtd/run/L11300000957955121 Change-Id: I9f43d52c370d95a7a8a1e50746efc56ff3403c9c
This commit is contained in:
parent
5d9058f3dc
commit
bc7807fcdd
@ -63,12 +63,6 @@ android_library_import {
|
|||||||
sdk_version: "current",
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
|
|
||||||
android_library_import {
|
|
||||||
name: "window-extensions-core",
|
|
||||||
aars: ["window-extensions-core-release.aar"],
|
|
||||||
sdk_version: "current",
|
|
||||||
}
|
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
name: "androidx.window.extensions",
|
name: "androidx.window.extensions",
|
||||||
srcs: [
|
srcs: [
|
||||||
@ -76,10 +70,7 @@ java_library {
|
|||||||
"src/androidx/window/util/**/*.java",
|
"src/androidx/window/util/**/*.java",
|
||||||
"src/androidx/window/common/**/*.java",
|
"src/androidx/window/common/**/*.java",
|
||||||
],
|
],
|
||||||
static_libs: [
|
static_libs: ["window-extensions"],
|
||||||
"window-extensions",
|
|
||||||
"window-extensions-core",
|
|
||||||
],
|
|
||||||
installable: true,
|
installable: true,
|
||||||
sdk_version: "core_platform",
|
sdk_version: "core_platform",
|
||||||
system_ext_specific: true,
|
system_ext_specific: true,
|
||||||
|
@ -75,10 +75,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.window.common.CommonFoldingFeature;
|
import androidx.window.common.CommonFoldingFeature;
|
||||||
import androidx.window.common.EmptyLifecycleCallbacksAdapter;
|
import androidx.window.common.EmptyLifecycleCallbacksAdapter;
|
||||||
import androidx.window.extensions.WindowExtensionsImpl;
|
|
||||||
import androidx.window.extensions.WindowExtensionsProvider;
|
import androidx.window.extensions.WindowExtensionsProvider;
|
||||||
import androidx.window.extensions.core.util.function.Consumer;
|
|
||||||
import androidx.window.extensions.core.util.function.Function;
|
|
||||||
import androidx.window.extensions.embedding.TransactionManager.TransactionRecord;
|
import androidx.window.extensions.embedding.TransactionManager.TransactionRecord;
|
||||||
import androidx.window.extensions.layout.WindowLayoutComponentImpl;
|
import androidx.window.extensions.layout.WindowLayoutComponentImpl;
|
||||||
|
|
||||||
@ -89,6 +86,7 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main controller class that manages split states and presentation.
|
* Main controller class that manages split states and presentation.
|
||||||
@ -114,7 +112,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
|
|||||||
/**
|
/**
|
||||||
* A developer-defined {@link SplitAttributes} calculator to compute the current
|
* A developer-defined {@link SplitAttributes} calculator to compute the current
|
||||||
* {@link SplitAttributes} with the current device and window states.
|
* {@link SplitAttributes} with the current device and window states.
|
||||||
* It is registered via {@link #setSplitAttributesCalculator(Function)}
|
* It is registered via {@link #setSplitAttributesCalculator(SplitAttributesCalculator)}
|
||||||
* and unregistered via {@link #clearSplitAttributesCalculator()}.
|
* and unregistered via {@link #clearSplitAttributesCalculator()}.
|
||||||
* This is called when:
|
* This is called when:
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -127,7 +125,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
|
|||||||
*/
|
*/
|
||||||
@GuardedBy("mLock")
|
@GuardedBy("mLock")
|
||||||
@Nullable
|
@Nullable
|
||||||
private Function<SplitAttributesCalculatorParams, SplitAttributes> mSplitAttributesCalculator;
|
private SplitAttributesCalculator mSplitAttributesCalculator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map from Task id to {@link TaskContainer} which contains all TaskFragment and split pair info
|
* Map from Task id to {@link TaskContainer} which contains all TaskFragment and split pair info
|
||||||
@ -140,7 +138,6 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
|
|||||||
final SparseArray<TaskContainer> mTaskContainers = new SparseArray<>();
|
final SparseArray<TaskContainer> mTaskContainers = new SparseArray<>();
|
||||||
|
|
||||||
/** Callback to Jetpack to notify about changes to split states. */
|
/** Callback to Jetpack to notify about changes to split states. */
|
||||||
@GuardedBy("mLock")
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private Consumer<List<SplitInfo>> mEmbeddingCallback;
|
private Consumer<List<SplitInfo>> mEmbeddingCallback;
|
||||||
private final List<SplitInfo> mLastReportedSplitStates = new ArrayList<>();
|
private final List<SplitInfo> mLastReportedSplitStates = new ArrayList<>();
|
||||||
@ -174,8 +171,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
|
|||||||
mWindowLayoutComponent.addFoldingStateChangedCallback(new FoldingFeatureListener());
|
mWindowLayoutComponent.addFoldingStateChangedCallback(new FoldingFeatureListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
private class FoldingFeatureListener
|
private class FoldingFeatureListener implements Consumer<List<CommonFoldingFeature>> {
|
||||||
implements java.util.function.Consumer<List<CommonFoldingFeature>> {
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(List<CommonFoldingFeature> foldingFeatures) {
|
public void accept(List<CommonFoldingFeature> foldingFeatures) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
@ -216,8 +212,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSplitAttributesCalculator(
|
public void setSplitAttributesCalculator(@NonNull SplitAttributesCalculator calculator) {
|
||||||
@NonNull Function<SplitAttributesCalculatorParams, SplitAttributes> calculator) {
|
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
mSplitAttributesCalculator = calculator;
|
mSplitAttributesCalculator = calculator;
|
||||||
}
|
}
|
||||||
@ -232,7 +227,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
|
|||||||
|
|
||||||
@GuardedBy("mLock")
|
@GuardedBy("mLock")
|
||||||
@Nullable
|
@Nullable
|
||||||
Function<SplitAttributesCalculatorParams, SplitAttributes> getSplitAttributesCalculator() {
|
SplitAttributesCalculator getSplitAttributesCalculator() {
|
||||||
return mSplitAttributesCalculator;
|
return mSplitAttributesCalculator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,22 +240,9 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers the split organizer callback to notify about changes to active splits.
|
* Registers the split organizer callback to notify about changes to active splits.
|
||||||
* @deprecated Use {@link #setSplitInfoCallback(Consumer)} starting with
|
|
||||||
* {@link WindowExtensionsImpl#getVendorApiLevel()} 2.
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
@Override
|
@Override
|
||||||
public void setSplitInfoCallback(
|
public void setSplitInfoCallback(@NonNull Consumer<List<SplitInfo>> callback) {
|
||||||
@NonNull java.util.function.Consumer<List<SplitInfo>> callback) {
|
|
||||||
Consumer<List<SplitInfo>> oemConsumer = callback::accept;
|
|
||||||
setSplitInfoCallback(oemConsumer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers the split organizer callback to notify about changes to active splits.
|
|
||||||
* @since {@link WindowExtensionsImpl#getVendorApiLevel()} 2
|
|
||||||
*/
|
|
||||||
public void setSplitInfoCallback(Consumer<List<SplitInfo>> callback) {
|
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
mEmbeddingCallback = callback;
|
mEmbeddingCallback = callback;
|
||||||
updateCallbackIfNecessary();
|
updateCallbackIfNecessary();
|
||||||
|
@ -42,11 +42,11 @@ import android.window.WindowContainerTransaction;
|
|||||||
import androidx.annotation.IntDef;
|
import androidx.annotation.IntDef;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.window.extensions.core.util.function.Function;
|
|
||||||
import androidx.window.extensions.embedding.SplitAttributes.SplitType;
|
import androidx.window.extensions.embedding.SplitAttributes.SplitType;
|
||||||
import androidx.window.extensions.embedding.SplitAttributes.SplitType.ExpandContainersSplitType;
|
import androidx.window.extensions.embedding.SplitAttributes.SplitType.ExpandContainersSplitType;
|
||||||
import androidx.window.extensions.embedding.SplitAttributes.SplitType.HingeSplitType;
|
import androidx.window.extensions.embedding.SplitAttributes.SplitType.HingeSplitType;
|
||||||
import androidx.window.extensions.embedding.SplitAttributes.SplitType.RatioSplitType;
|
import androidx.window.extensions.embedding.SplitAttributes.SplitType.RatioSplitType;
|
||||||
|
import androidx.window.extensions.embedding.SplitAttributesCalculator.SplitAttributesCalculatorParams;
|
||||||
import androidx.window.extensions.embedding.TaskContainer.TaskProperties;
|
import androidx.window.extensions.embedding.TaskContainer.TaskProperties;
|
||||||
import androidx.window.extensions.layout.DisplayFeature;
|
import androidx.window.extensions.layout.DisplayFeature;
|
||||||
import androidx.window.extensions.layout.FoldingFeature;
|
import androidx.window.extensions.layout.FoldingFeature;
|
||||||
@ -522,8 +522,7 @@ class SplitPresenter extends JetpackTaskFragmentOrganizer {
|
|||||||
@NonNull SplitRule rule, @Nullable Pair<Size, Size> minDimensionsPair) {
|
@NonNull SplitRule rule, @Nullable Pair<Size, Size> minDimensionsPair) {
|
||||||
final Configuration taskConfiguration = taskProperties.getConfiguration();
|
final Configuration taskConfiguration = taskProperties.getConfiguration();
|
||||||
final WindowMetrics taskWindowMetrics = getTaskWindowMetrics(taskConfiguration);
|
final WindowMetrics taskWindowMetrics = getTaskWindowMetrics(taskConfiguration);
|
||||||
final Function<SplitAttributesCalculatorParams, SplitAttributes> calculator =
|
final SplitAttributesCalculator calculator = mController.getSplitAttributesCalculator();
|
||||||
mController.getSplitAttributesCalculator();
|
|
||||||
final SplitAttributes defaultSplitAttributes = rule.getDefaultSplitAttributes();
|
final SplitAttributes defaultSplitAttributes = rule.getDefaultSplitAttributes();
|
||||||
final boolean isDefaultMinSizeSatisfied = rule.checkParentMetrics(taskWindowMetrics);
|
final boolean isDefaultMinSizeSatisfied = rule.checkParentMetrics(taskWindowMetrics);
|
||||||
if (calculator == null) {
|
if (calculator == null) {
|
||||||
@ -539,7 +538,7 @@ class SplitPresenter extends JetpackTaskFragmentOrganizer {
|
|||||||
final SplitAttributesCalculatorParams params = new SplitAttributesCalculatorParams(
|
final SplitAttributesCalculatorParams params = new SplitAttributesCalculatorParams(
|
||||||
taskWindowMetrics, taskConfiguration, defaultSplitAttributes,
|
taskWindowMetrics, taskConfiguration, defaultSplitAttributes,
|
||||||
isDefaultMinSizeSatisfied, windowLayoutInfo, rule.getTag());
|
isDefaultMinSizeSatisfied, windowLayoutInfo, rule.getTag());
|
||||||
final SplitAttributes splitAttributes = calculator.apply(params);
|
final SplitAttributes splitAttributes = calculator.computeSplitAttributesForParams(params);
|
||||||
return sanitizeSplitAttributes(taskProperties, splitAttributes, minDimensionsPair);
|
return sanitizeSplitAttributes(taskProperties, splitAttributes, minDimensionsPair);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,6 @@ import androidx.window.common.CommonFoldingFeature;
|
|||||||
import androidx.window.common.DeviceStateManagerFoldingFeatureProducer;
|
import androidx.window.common.DeviceStateManagerFoldingFeatureProducer;
|
||||||
import androidx.window.common.EmptyLifecycleCallbacksAdapter;
|
import androidx.window.common.EmptyLifecycleCallbacksAdapter;
|
||||||
import androidx.window.common.RawFoldingFeatureProducer;
|
import androidx.window.common.RawFoldingFeatureProducer;
|
||||||
import androidx.window.extensions.core.util.function.Consumer;
|
|
||||||
import androidx.window.util.DataProducer;
|
import androidx.window.util.DataProducer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -52,6 +51,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference implementation of androidx.window.extensions.layout OEM interface for use with
|
* Reference implementation of androidx.window.extensions.layout OEM interface for use with
|
||||||
@ -80,10 +80,6 @@ public class WindowLayoutComponentImpl implements WindowLayoutComponent {
|
|||||||
private final Map<IBinder, ConfigurationChangeListener> mConfigurationChangeListeners =
|
private final Map<IBinder, ConfigurationChangeListener> mConfigurationChangeListeners =
|
||||||
new ArrayMap<>();
|
new ArrayMap<>();
|
||||||
|
|
||||||
@GuardedBy("mLock")
|
|
||||||
private final Map<java.util.function.Consumer<WindowLayoutInfo>, Consumer<WindowLayoutInfo>>
|
|
||||||
mJavaToExtConsumers = new ArrayMap<>();
|
|
||||||
|
|
||||||
public WindowLayoutComponentImpl(@NonNull Context context) {
|
public WindowLayoutComponentImpl(@NonNull Context context) {
|
||||||
((Application) context.getApplicationContext())
|
((Application) context.getApplicationContext())
|
||||||
.registerActivityLifecycleCallbacks(new NotifyOnConfigurationChanged());
|
.registerActivityLifecycleCallbacks(new NotifyOnConfigurationChanged());
|
||||||
@ -94,8 +90,7 @@ public class WindowLayoutComponentImpl implements WindowLayoutComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Registers to listen to {@link CommonFoldingFeature} changes */
|
/** Registers to listen to {@link CommonFoldingFeature} changes */
|
||||||
public void addFoldingStateChangedCallback(
|
public void addFoldingStateChangedCallback(Consumer<List<CommonFoldingFeature>> consumer) {
|
||||||
java.util.function.Consumer<List<CommonFoldingFeature>> consumer) {
|
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
mFoldingFeatureProducer.addDataChangedCallback(consumer);
|
mFoldingFeatureProducer.addDataChangedCallback(consumer);
|
||||||
}
|
}
|
||||||
@ -109,17 +104,13 @@ public class WindowLayoutComponentImpl implements WindowLayoutComponent {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addWindowLayoutInfoListener(@NonNull Activity activity,
|
public void addWindowLayoutInfoListener(@NonNull Activity activity,
|
||||||
@NonNull java.util.function.Consumer<WindowLayoutInfo> consumer) {
|
@NonNull Consumer<WindowLayoutInfo> consumer) {
|
||||||
final Consumer<WindowLayoutInfo> extConsumer = consumer::accept;
|
addWindowLayoutInfoListener((Context) activity, consumer);
|
||||||
synchronized (mLock) {
|
|
||||||
mJavaToExtConsumers.put(consumer, extConsumer);
|
|
||||||
}
|
|
||||||
addWindowLayoutInfoListener(activity, extConsumer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to {@link #addWindowLayoutInfoListener(Activity, java.util.function.Consumer)}, but
|
* Similar to {@link #addWindowLayoutInfoListener(Activity, Consumer)}, but takes a UI Context
|
||||||
* takes a UI Context as a parameter.
|
* as a parameter.
|
||||||
*
|
*
|
||||||
* Jetpack {@link androidx.window.layout.ExtensionWindowLayoutInfoBackend} makes sure all
|
* Jetpack {@link androidx.window.layout.ExtensionWindowLayoutInfoBackend} makes sure all
|
||||||
* consumers related to the same {@link Context} gets updated {@link WindowLayoutInfo}
|
* consumers related to the same {@link Context} gets updated {@link WindowLayoutInfo}
|
||||||
@ -160,18 +151,6 @@ public class WindowLayoutComponentImpl implements WindowLayoutComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeWindowLayoutInfoListener(
|
|
||||||
@NonNull java.util.function.Consumer<WindowLayoutInfo> consumer) {
|
|
||||||
final Consumer<WindowLayoutInfo> extConsumer;
|
|
||||||
synchronized (mLock) {
|
|
||||||
extConsumer = mJavaToExtConsumers.remove(consumer);
|
|
||||||
}
|
|
||||||
if (extConsumer != null) {
|
|
||||||
removeWindowLayoutInfoListener(extConsumer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a listener no longer interested in receiving updates.
|
* Removes a listener no longer interested in receiving updates.
|
||||||
*
|
*
|
||||||
|
@ -34,11 +34,9 @@ import android.content.res.Resources;
|
|||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.view.WindowMetrics;
|
|
||||||
import android.window.TaskFragmentInfo;
|
import android.window.TaskFragmentInfo;
|
||||||
import android.window.WindowContainerToken;
|
import android.window.WindowContainerToken;
|
||||||
|
|
||||||
import androidx.window.extensions.core.util.function.Predicate;
|
|
||||||
import androidx.window.extensions.embedding.SplitAttributes.SplitType;
|
import androidx.window.extensions.embedding.SplitAttributes.SplitType;
|
||||||
import androidx.window.extensions.layout.DisplayFeature;
|
import androidx.window.extensions.layout.DisplayFeature;
|
||||||
import androidx.window.extensions.layout.FoldingFeature;
|
import androidx.window.extensions.layout.FoldingFeature;
|
||||||
@ -109,7 +107,7 @@ public class EmbeddingTestUtils {
|
|||||||
static SplitRule createSplitRule(@NonNull Activity primaryActivity,
|
static SplitRule createSplitRule(@NonNull Activity primaryActivity,
|
||||||
@NonNull Intent secondaryIntent, boolean clearTop) {
|
@NonNull Intent secondaryIntent, boolean clearTop) {
|
||||||
final Pair<Activity, Intent> targetPair = new Pair<>(primaryActivity, secondaryIntent);
|
final Pair<Activity, Intent> targetPair = new Pair<>(primaryActivity, secondaryIntent);
|
||||||
return createSplitPairRuleBuilder(
|
return new SplitPairRule.Builder(
|
||||||
activityPair -> false,
|
activityPair -> false,
|
||||||
targetPair::equals,
|
targetPair::equals,
|
||||||
w -> true)
|
w -> true)
|
||||||
@ -146,7 +144,7 @@ public class EmbeddingTestUtils {
|
|||||||
@NonNull Activity secondaryActivity, int finishPrimaryWithSecondary,
|
@NonNull Activity secondaryActivity, int finishPrimaryWithSecondary,
|
||||||
int finishSecondaryWithPrimary, boolean clearTop) {
|
int finishSecondaryWithPrimary, boolean clearTop) {
|
||||||
final Pair<Activity, Activity> targetPair = new Pair<>(primaryActivity, secondaryActivity);
|
final Pair<Activity, Activity> targetPair = new Pair<>(primaryActivity, secondaryActivity);
|
||||||
return createSplitPairRuleBuilder(
|
return new SplitPairRule.Builder(
|
||||||
targetPair::equals,
|
targetPair::equals,
|
||||||
activityIntentPair -> false,
|
activityIntentPair -> false,
|
||||||
w -> true)
|
w -> true)
|
||||||
@ -225,26 +223,4 @@ public class EmbeddingTestUtils {
|
|||||||
displayFeatures.add(foldingFeature);
|
displayFeatures.add(foldingFeature);
|
||||||
return new WindowLayoutInfo(displayFeatures);
|
return new WindowLayoutInfo(displayFeatures);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ActivityRule.Builder createActivityBuilder(
|
|
||||||
@NonNull Predicate<Activity> activityPredicate,
|
|
||||||
@NonNull Predicate<Intent> intentPredicate) {
|
|
||||||
return new ActivityRule.Builder(activityPredicate, intentPredicate);
|
|
||||||
}
|
|
||||||
|
|
||||||
static SplitPairRule.Builder createSplitPairRuleBuilder(
|
|
||||||
@NonNull Predicate<Pair<Activity, Activity>> activitiesPairPredicate,
|
|
||||||
@NonNull Predicate<Pair<Activity, Intent>> activityIntentPairPredicate,
|
|
||||||
@NonNull Predicate<WindowMetrics> windowMetricsPredicate) {
|
|
||||||
return new SplitPairRule.Builder(activitiesPairPredicate, activityIntentPairPredicate,
|
|
||||||
windowMetricsPredicate);
|
|
||||||
}
|
|
||||||
|
|
||||||
static SplitPlaceholderRule.Builder createSplitPlaceholderRuleBuilder(
|
|
||||||
@NonNull Intent placeholderIntent, @NonNull Predicate<Activity> activityPredicate,
|
|
||||||
@NonNull Predicate<Intent> intentPredicate,
|
|
||||||
@NonNull Predicate<WindowMetrics> windowMetricsPredicate) {
|
|
||||||
return new SplitPlaceholderRule.Builder(placeholderIntent, activityPredicate,
|
|
||||||
intentPredicate, windowMetricsPredicate);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -34,11 +34,8 @@ import static androidx.window.extensions.embedding.EmbeddingTestUtils.SPLIT_ATTR
|
|||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.TASK_BOUNDS;
|
import static androidx.window.extensions.embedding.EmbeddingTestUtils.TASK_BOUNDS;
|
||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.TASK_ID;
|
import static androidx.window.extensions.embedding.EmbeddingTestUtils.TASK_ID;
|
||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.TEST_TAG;
|
import static androidx.window.extensions.embedding.EmbeddingTestUtils.TEST_TAG;
|
||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createActivityBuilder;
|
|
||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createActivityInfoWithMinDimensions;
|
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createActivityInfoWithMinDimensions;
|
||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createMockTaskFragmentInfo;
|
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createMockTaskFragmentInfo;
|
||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createSplitPairRuleBuilder;
|
|
||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createSplitPlaceholderRuleBuilder;
|
|
||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createSplitRule;
|
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createSplitRule;
|
||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createTestTaskContainer;
|
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createTestTaskContainer;
|
||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.getSplitBounds;
|
import static androidx.window.extensions.embedding.EmbeddingTestUtils.getSplitBounds;
|
||||||
@ -432,7 +429,7 @@ public class SplitControllerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testResolveStartActivityIntent_withoutLaunchingActivity() {
|
public void testResolveStartActivityIntent_withoutLaunchingActivity() {
|
||||||
final Intent intent = new Intent();
|
final Intent intent = new Intent();
|
||||||
final ActivityRule expandRule = createActivityBuilder(r -> false, i -> i == intent)
|
final ActivityRule expandRule = new ActivityRule.Builder(r -> false, i -> i == intent)
|
||||||
.setShouldAlwaysExpand(true)
|
.setShouldAlwaysExpand(true)
|
||||||
.build();
|
.build();
|
||||||
mSplitController.setEmbeddingRules(Collections.singleton(expandRule));
|
mSplitController.setEmbeddingRules(Collections.singleton(expandRule));
|
||||||
@ -1170,7 +1167,7 @@ public class SplitControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHasSamePresentation() {
|
public void testHasSamePresentation() {
|
||||||
SplitPairRule splitRule1 = createSplitPairRuleBuilder(
|
SplitPairRule splitRule1 = new SplitPairRule.Builder(
|
||||||
activityPair -> true,
|
activityPair -> true,
|
||||||
activityIntentPair -> true,
|
activityIntentPair -> true,
|
||||||
windowMetrics -> true)
|
windowMetrics -> true)
|
||||||
@ -1178,7 +1175,7 @@ public class SplitControllerTest {
|
|||||||
.setFinishPrimaryWithSecondary(DEFAULT_FINISH_PRIMARY_WITH_SECONDARY)
|
.setFinishPrimaryWithSecondary(DEFAULT_FINISH_PRIMARY_WITH_SECONDARY)
|
||||||
.setDefaultSplitAttributes(SPLIT_ATTRIBUTES)
|
.setDefaultSplitAttributes(SPLIT_ATTRIBUTES)
|
||||||
.build();
|
.build();
|
||||||
SplitPairRule splitRule2 = createSplitPairRuleBuilder(
|
SplitPairRule splitRule2 = new SplitPairRule.Builder(
|
||||||
activityPair -> true,
|
activityPair -> true,
|
||||||
activityIntentPair -> true,
|
activityIntentPair -> true,
|
||||||
windowMetrics -> true)
|
windowMetrics -> true)
|
||||||
@ -1191,7 +1188,7 @@ public class SplitControllerTest {
|
|||||||
SplitController.haveSamePresentation(splitRule1, splitRule2,
|
SplitController.haveSamePresentation(splitRule1, splitRule2,
|
||||||
new WindowMetrics(TASK_BOUNDS, WindowInsets.CONSUMED)));
|
new WindowMetrics(TASK_BOUNDS, WindowInsets.CONSUMED)));
|
||||||
|
|
||||||
splitRule2 = createSplitPairRuleBuilder(
|
splitRule2 = new SplitPairRule.Builder(
|
||||||
activityPair -> true,
|
activityPair -> true,
|
||||||
activityIntentPair -> true,
|
activityIntentPair -> true,
|
||||||
windowMetrics -> true)
|
windowMetrics -> true)
|
||||||
@ -1355,7 +1352,7 @@ public class SplitControllerTest {
|
|||||||
|
|
||||||
/** Setups a rule to always expand the given intent. */
|
/** Setups a rule to always expand the given intent. */
|
||||||
private void setupExpandRule(@NonNull Intent expandIntent) {
|
private void setupExpandRule(@NonNull Intent expandIntent) {
|
||||||
final ActivityRule expandRule = createActivityBuilder(r -> false, expandIntent::equals)
|
final ActivityRule expandRule = new ActivityRule.Builder(r -> false, expandIntent::equals)
|
||||||
.setShouldAlwaysExpand(true)
|
.setShouldAlwaysExpand(true)
|
||||||
.build();
|
.build();
|
||||||
mSplitController.setEmbeddingRules(Collections.singleton(expandRule));
|
mSplitController.setEmbeddingRules(Collections.singleton(expandRule));
|
||||||
@ -1363,7 +1360,7 @@ public class SplitControllerTest {
|
|||||||
|
|
||||||
/** Setups a rule to always expand the given activity. */
|
/** Setups a rule to always expand the given activity. */
|
||||||
private void setupExpandRule(@NonNull Activity expandActivity) {
|
private void setupExpandRule(@NonNull Activity expandActivity) {
|
||||||
final ActivityRule expandRule = createActivityBuilder(expandActivity::equals, i -> false)
|
final ActivityRule expandRule = new ActivityRule.Builder(expandActivity::equals, i -> false)
|
||||||
.setShouldAlwaysExpand(true)
|
.setShouldAlwaysExpand(true)
|
||||||
.build();
|
.build();
|
||||||
mSplitController.setEmbeddingRules(Collections.singleton(expandRule));
|
mSplitController.setEmbeddingRules(Collections.singleton(expandRule));
|
||||||
@ -1371,7 +1368,7 @@ public class SplitControllerTest {
|
|||||||
|
|
||||||
/** Setups a rule to launch placeholder for the given activity. */
|
/** Setups a rule to launch placeholder for the given activity. */
|
||||||
private void setupPlaceholderRule(@NonNull Activity primaryActivity) {
|
private void setupPlaceholderRule(@NonNull Activity primaryActivity) {
|
||||||
final SplitRule placeholderRule = createSplitPlaceholderRuleBuilder(PLACEHOLDER_INTENT,
|
final SplitRule placeholderRule = new SplitPlaceholderRule.Builder(PLACEHOLDER_INTENT,
|
||||||
primaryActivity::equals, i -> false, w -> true)
|
primaryActivity::equals, i -> false, w -> true)
|
||||||
.setDefaultSplitAttributes(SPLIT_ATTRIBUTES)
|
.setDefaultSplitAttributes(SPLIT_ATTRIBUTES)
|
||||||
.build();
|
.build();
|
||||||
|
@ -27,7 +27,6 @@ import static androidx.window.extensions.embedding.EmbeddingTestUtils.TASK_BOUND
|
|||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.TASK_ID;
|
import static androidx.window.extensions.embedding.EmbeddingTestUtils.TASK_ID;
|
||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createActivityInfoWithMinDimensions;
|
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createActivityInfoWithMinDimensions;
|
||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createMockTaskFragmentInfo;
|
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createMockTaskFragmentInfo;
|
||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createSplitPairRuleBuilder;
|
|
||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createSplitRule;
|
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createSplitRule;
|
||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createWindowLayoutInfo;
|
import static androidx.window.extensions.embedding.EmbeddingTestUtils.createWindowLayoutInfo;
|
||||||
import static androidx.window.extensions.embedding.EmbeddingTestUtils.getSplitBounds;
|
import static androidx.window.extensions.embedding.EmbeddingTestUtils.getSplitBounds;
|
||||||
@ -474,7 +473,7 @@ public class SplitPresenterTest {
|
|||||||
final Activity secondaryActivity = createMockActivity();
|
final Activity secondaryActivity = createMockActivity();
|
||||||
final TaskFragmentContainer bottomTf = mController.newContainer(secondaryActivity, TASK_ID);
|
final TaskFragmentContainer bottomTf = mController.newContainer(secondaryActivity, TASK_ID);
|
||||||
final TaskFragmentContainer primaryTf = mController.newContainer(mActivity, TASK_ID);
|
final TaskFragmentContainer primaryTf = mController.newContainer(mActivity, TASK_ID);
|
||||||
final SplitPairRule rule = createSplitPairRuleBuilder(pair ->
|
final SplitPairRule rule = new SplitPairRule.Builder(pair ->
|
||||||
pair.first == mActivity && pair.second == secondaryActivity, pair -> false,
|
pair.first == mActivity && pair.second == secondaryActivity, pair -> false,
|
||||||
metrics -> true)
|
metrics -> true)
|
||||||
.setDefaultSplitAttributes(SPLIT_ATTRIBUTES)
|
.setDefaultSplitAttributes(SPLIT_ATTRIBUTES)
|
||||||
@ -492,7 +491,7 @@ public class SplitPresenterTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testComputeSplitAttributes() {
|
public void testComputeSplitAttributes() {
|
||||||
final SplitPairRule splitPairRule = createSplitPairRuleBuilder(
|
final SplitPairRule splitPairRule = new SplitPairRule.Builder(
|
||||||
activityPair -> true,
|
activityPair -> true,
|
||||||
activityIntentPair -> true,
|
activityIntentPair -> true,
|
||||||
windowMetrics -> windowMetrics.getBounds().equals(TASK_BOUNDS))
|
windowMetrics -> windowMetrics.getBounds().equals(TASK_BOUNDS))
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user