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

Commit a6d6aab0 authored by Adrian Roos's avatar Adrian Roos
Browse files

Defer resizing invisible stacks while drag resizing

Works around a source of jank when drag resizing in split
screen mode: instead of immediately resizing the (potentially
numerous) invisible secondary stacks, we defer that until
the user lets go of the handle.

Change-Id: I3b9faa83005fa86185d4e51b2849e3a826b7f6a9
Fixes: 78214347
Test: Open a gazillion (resizeable) tasks. Enter split screen. Drag handle, verify there is no jank
Test: atest RectTest
parent e3a34816
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -575,6 +575,11 @@ interface IActivityManager {
    void resizeDockedStack(in Rect dockedBounds, in Rect tempDockedTaskBounds,
            in Rect tempDockedTaskInsetBounds,
            in Rect tempOtherTaskBounds, in Rect tempOtherTaskInsetBounds);
    /**
     * Sets whether we are currently in an interactive split screen resize operation where we
     * are changing the docked stack size.
     */
    void setSplitScreenResizing(boolean resizing);
    int setVrMode(in IBinder token, boolean enabled, in ComponentName packageName);
    // Gets the URI permissions granted to an arbitrary package (or all packages if null)
    // NOTE: this is different from getPersistedUriPermissions(), which returns the URIs the package
+0 −6
Original line number Diff line number Diff line
@@ -341,12 +341,6 @@ interface IWindowManager
     */
    int getDockedStackSide();

    /**
     * Sets whether we are currently in a drag resize operation where we are changing the docked
     * stack size.
     */
    void setDockedStackResizing(boolean resizing);

    /**
     * Sets the region the user can touch the divider. This region will be excluded from the region
     * which is used to cause a focus switch when dispatching touch.
+50 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.graphics;

import static android.graphics.Rect.copyOrNull;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;

import android.platform.test.annotations.Presubmit;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
@SmallTest
@Presubmit
public class RectTest {

    @Test
    public void copyOrNull_passesThroughNull() {
        assertNull(copyOrNull(null));
    }

    @Test
    public void copyOrNull_copiesNonNull() {
        final Rect orig = new Rect(1, 2, 3, 4);
        final Rect copy = copyOrNull(orig);

        assertEquals(orig, copy);
        assertNotSame(orig, copy);
    }
}
+11 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.graphics;

import android.annotation.CheckResult;
import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;

@@ -99,6 +100,16 @@ public final class Rect implements Parcelable {
        }
    }

    /**
     * Returns a copy of {@code r} if {@code r} is not {@code null}, or {@code null} otherwise.
     *
     * @hide
     */
    @Nullable
    public static Rect copyOrNull(@Nullable Rect r) {
        return r == null ? null : new Rect(r);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
+1 −1
Original line number Diff line number Diff line
@@ -180,7 +180,7 @@ public class WindowManagerProxy {
            @Override
            public void run() {
                try {
                    WindowManagerGlobal.getWindowManagerService().setDockedStackResizing(resizing);
                    ActivityManager.getService().setSplitScreenResizing(resizing);
                } catch (RemoteException e) {
                    Log.w(TAG, "Error calling setDockedStackResizing: " + e);
                }
Loading