Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c9dc15e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Only call onDisplayAreaInfoChanged if config actually changed" into rvc-dev

parents 6da69cad b0b893f0
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {
    final int mFeatureId;
    private final DisplayAreaOrganizerController mOrganizerController;
    IDisplayAreaOrganizer mOrganizer;
    private final Configuration mTmpConfiguration = new Configuration();

    DisplayArea(WindowManagerService wms, Type type, String name) {
        this(wms, type, name, FEATURE_UNDEFINED);
@@ -162,8 +163,10 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {

    @Override
    public void onConfigurationChanged(Configuration newParentConfig) {
        mTmpConfiguration.setTo(getConfiguration());
        super.onConfigurationChanged(newParentConfig);
        if (mOrganizer != null) {

        if (mOrganizer != null && getConfiguration().diff(mTmpConfiguration) != 0) {
            mOrganizerController.onDisplayAreaInfoChanged(mOrganizer, this);
        }
    }
+7 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import android.content.res.Configuration;
import android.graphics.Rect;
import android.os.Binder;
import android.os.RemoteException;
@@ -91,5 +92,11 @@ public class DisplayAreaOrganizerTest extends WindowTestsBase {

        mDisplayContent.setBounds(new Rect(0, 0, 1000, 1000));
        verify(organizer).onDisplayAreaInfoChanged(any());

        Configuration tmpConfiguration = new Configuration();
        tmpConfiguration.setTo(mDisplayContent.getRequestedOverrideConfiguration());
        mDisplayContent.onRequestedOverrideConfigurationChanged(tmpConfiguration);
        // Ensure it was still only called once if the bounds didn't change
        verify(organizer).onDisplayAreaInfoChanged(any());
    }
}