summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/WindowManager/Jetpack/src/androidx/window/extensions/SampleExtensionImpl.java22
-rw-r--r--libs/WindowManager/Jetpack/src/androidx/window/extensions/StubExtension.java16
-rw-r--r--libs/WindowManager/Jetpack/window-extensions-release.aarbin9182 -> 7613 bytes
-rw-r--r--libs/WindowManager/Jetpack/window-sidecar-release.aarbin4366 -> 5353 bytes
4 files changed, 7 insertions, 31 deletions
diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/SampleExtensionImpl.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/SampleExtensionImpl.java
index ce9be6a7bba3..a0d5b004ff1c 100644
--- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/SampleExtensionImpl.java
+++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/SampleExtensionImpl.java
@@ -69,21 +69,15 @@ class SampleExtensionImpl extends StubExtension {
new ResourceConfigDisplayFeatureProducer(context)
));
- mDevicePostureProducer.addDataChangedCallback(this::onDevicePostureChanged);
+ mDevicePostureProducer.addDataChangedCallback(this::onDisplayFeaturesChanged);
mDisplayFeatureProducer.addDataChangedCallback(this::onDisplayFeaturesChanged);
}
- private void onDevicePostureChanged() {
- updateDeviceState(new ExtensionDeviceState(getDevicePosture()));
-
- // Trigger a change in display features as the posture will be used in place of the feature
- // state if the state is left unset by the producer.
- onDisplayFeaturesChanged();
- }
-
- private int getDevicePosture() {
+ private int getFeatureState(DisplayFeature feature) {
+ Integer featureState = feature.getState();
Optional<Integer> posture = mDevicePostureProducer.getData();
- return posture.orElse(ExtensionDeviceState.POSTURE_UNKNOWN);
+ int fallbackPosture = posture.orElse(ExtensionFoldingFeature.STATE_FLAT);
+ return featureState == null ? fallbackPosture : featureState;
}
private void onDisplayFeaturesChanged() {
@@ -115,17 +109,14 @@ class SampleExtensionImpl extends StubExtension {
Optional<List<DisplayFeature>> storedFeatures = mDisplayFeatureProducer.getData();
if (storedFeatures.isPresent()) {
- int posture = getDevicePosture();
for (DisplayFeature baseFeature : storedFeatures.get()) {
Rect featureRect = baseFeature.getRect();
rotateRectToDisplayRotation(displayId, featureRect);
transformToWindowSpaceRect(activity, featureRect);
- Integer featureState = baseFeature.getState();
-
features.add(new ExtensionFoldingFeature(featureRect, baseFeature.getType(),
- featureState == null ? posture : featureState));
+ getFeatureState(baseFeature)));
}
}
return features;
@@ -141,7 +132,6 @@ class SampleExtensionImpl extends StubExtension {
mSettingsDisplayFeatureProducer.unregisterObserversIfNeeded();
}
- onDevicePostureChanged();
onDisplayFeaturesChanged();
}
}
diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/StubExtension.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/StubExtension.java
index b0895efc75a9..6a53efee0e74 100644
--- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/StubExtension.java
+++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/StubExtension.java
@@ -31,7 +31,6 @@ abstract class StubExtension implements ExtensionInterface {
private ExtensionCallback mExtensionCallback;
private final Set<Activity> mWindowLayoutChangeListenerActivities = new HashSet<>();
- private boolean mDeviceStateChangeListenerRegistered;
StubExtension() {
}
@@ -53,18 +52,6 @@ abstract class StubExtension implements ExtensionInterface {
this.onListenersChanged();
}
- @Override
- public void onDeviceStateListenersChanged(boolean isEmpty) {
- this.mDeviceStateChangeListenerRegistered = !isEmpty;
- this.onListenersChanged();
- }
-
- void updateDeviceState(ExtensionDeviceState newState) {
- if (this.mExtensionCallback != null) {
- mExtensionCallback.onDeviceStateChanged(newState);
- }
- }
-
void updateWindowLayout(@NonNull Activity activity,
@NonNull ExtensionWindowLayoutInfo newLayout) {
if (this.mExtensionCallback != null) {
@@ -78,8 +65,7 @@ abstract class StubExtension implements ExtensionInterface {
}
protected boolean hasListeners() {
- return !mWindowLayoutChangeListenerActivities.isEmpty()
- || mDeviceStateChangeListenerRegistered;
+ return !mWindowLayoutChangeListenerActivities.isEmpty();
}
protected abstract void onListenersChanged();
diff --git a/libs/WindowManager/Jetpack/window-extensions-release.aar b/libs/WindowManager/Jetpack/window-extensions-release.aar
index 7b306b00afd9..be6652d43fb2 100644
--- a/libs/WindowManager/Jetpack/window-extensions-release.aar
+++ b/libs/WindowManager/Jetpack/window-extensions-release.aar
Binary files differ
diff --git a/libs/WindowManager/Jetpack/window-sidecar-release.aar b/libs/WindowManager/Jetpack/window-sidecar-release.aar
index 50f101d7d181..9d6baee0993a 100644
--- a/libs/WindowManager/Jetpack/window-sidecar-release.aar
+++ b/libs/WindowManager/Jetpack/window-sidecar-release.aar
Binary files differ