Merge "Fix no features emitting." into tm-qpr-dev
This commit is contained in:
@@ -199,7 +199,7 @@ public final class CommonFoldingFeature {
|
|||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Display feature rectangle cannot have zero width and height simultaneously.");
|
"Display feature rectangle cannot have zero width and height simultaneously.");
|
||||||
}
|
}
|
||||||
this.mRect = rect;
|
this.mRect = new Rect(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the type of the feature. */
|
/** Returns the type of the feature. */
|
||||||
@@ -217,7 +217,7 @@ public final class CommonFoldingFeature {
|
|||||||
/** Returns the bounds of the feature. */
|
/** Returns the bounds of the feature. */
|
||||||
@NonNull
|
@NonNull
|
||||||
public Rect getRect() {
|
public Rect getRect() {
|
||||||
return mRect;
|
return new Rect(mRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -166,6 +166,9 @@ public final class DeviceStateManagerFoldingFeatureProducer
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void notifyFoldingFeatureChange(String displayFeaturesString) {
|
private void notifyFoldingFeatureChange(String displayFeaturesString) {
|
||||||
|
if (!isCurrentStateValid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (TextUtils.isEmpty(displayFeaturesString)) {
|
if (TextUtils.isEmpty(displayFeaturesString)) {
|
||||||
notifyDataChanged(new ArrayList<>());
|
notifyDataChanged(new ArrayList<>());
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -79,6 +79,11 @@ public class WindowLayoutComponentImpl implements WindowLayoutComponent {
|
|||||||
*/
|
*/
|
||||||
public void addWindowLayoutInfoListener(@NonNull Activity activity,
|
public void addWindowLayoutInfoListener(@NonNull Activity activity,
|
||||||
@NonNull Consumer<WindowLayoutInfo> consumer) {
|
@NonNull Consumer<WindowLayoutInfo> consumer) {
|
||||||
|
mFoldingFeatureProducer.getData((features) -> {
|
||||||
|
// Get the WindowLayoutInfo from the activity and pass the value to the layoutConsumer.
|
||||||
|
WindowLayoutInfo newWindowLayout = getWindowLayoutInfo(activity, features);
|
||||||
|
consumer.accept(newWindowLayout);
|
||||||
|
});
|
||||||
mWindowLayoutChangeListeners.put(activity, consumer);
|
mWindowLayoutChangeListeners.put(activity, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user