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

Commit c036391f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Only call onDisplayAreaInfoChanged if config actually changed" into...

Merge "Only call onDisplayAreaInfoChanged if config actually changed" into rvc-dev am: 8c9dc15e am: bd5da8e7 am: afb0f375 am: 5db89170

Change-Id: I117c7ec180c108e43ba9c467e8fb28cd28e914c6
parents f39f6d84 5db89170
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());
    }
}