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

Commit 5db89170 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

Change-Id: I31a1a2eadb652ecf7f706a72034ecdc7b2311c78
parents e504e6b4 afb0f375
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());
    }
}