Cleanup IPinnedStackController and IPinnedStackListener 1/N

Remove the IPinnedStackController aidl interface. The only method was
left in IPinnedStackController is the getDisplayRotation and used only
by PipTouchHandler. Switched that over to Context.getDisplay#getRotation

Video: http://rcll/aaaaaabFQoRHlzixHdtY/bO1xoqLNemseqmk603y9us
Bug: 174702196
Test: verify the original bug (b/36879891) is still fixed, see video
Test: atest PinnedStackTests \
            WMShellUnitTests
Change-Id: I65814b25ed9a1fb28dad4d6eae88b949efc15e3c
This commit is contained in:
Hongwei Wang
2020-12-02 16:49:08 -08:00
parent 1447bab54a
commit 05c04d4189
6 changed files with 3 additions and 99 deletions

View File

@@ -1,32 +0,0 @@
/**
* Copyright (c) 2016, 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.view;
import android.graphics.Rect;
/**
* An interface to the PinnedStackController to update it of state changes, and to query
* information based on the current state.
*
* @hide
*/
interface IPinnedStackController {
/**
* @return what WM considers to be the current device rotation.
*/
int getDisplayRotation();
}

View File

@@ -21,7 +21,6 @@ import android.content.ComponentName;
import android.content.pm.ParceledListSlice;
import android.graphics.Rect;
import android.view.DisplayInfo;
import android.view.IPinnedStackController;
/**
* Listener for changes to the pinned stack made by the WindowManager.
@@ -30,12 +29,6 @@ import android.view.IPinnedStackController;
*/
oneway interface IPinnedStackListener {
/**
* Called when the listener is registered and provides an interface to call back to the pinned
* stack controller to update the controller of the pinned stack state.
*/
void onListenerRegistered(IPinnedStackController controller);
/**
* Called when the window manager has detected a change that would cause the movement bounds
* to be changed (ie. after configuration change, aspect ratio change, etc).

View File

@@ -21,7 +21,6 @@ import android.content.ComponentName;
import android.content.pm.ParceledListSlice;
import android.os.RemoteException;
import android.view.DisplayInfo;
import android.view.IPinnedStackController;
import android.view.IPinnedStackListener;
import android.view.WindowManagerGlobal;
@@ -62,12 +61,6 @@ public class PinnedStackListenerForwarder {
displayId, mListenerImpl);
}
private void onListenerRegistered(IPinnedStackController controller) {
for (PinnedStackListener listener : mListeners) {
listener.onListenerRegistered(controller);
}
}
private void onMovementBoundsChanged(boolean fromImeAdjustment) {
for (PinnedStackListener listener : mListeners) {
listener.onMovementBoundsChanged(fromImeAdjustment);
@@ -112,13 +105,6 @@ public class PinnedStackListenerForwarder {
@BinderThread
private class PinnedStackListenerImpl extends IPinnedStackListener.Stub {
@Override
public void onListenerRegistered(IPinnedStackController controller) {
mShellMainExecutor.execute(() -> {
PinnedStackListenerForwarder.this.onListenerRegistered(controller);
});
}
@Override
public void onMovementBoundsChanged(boolean fromImeAdjustment) {
mShellMainExecutor.execute(() -> {
@@ -174,8 +160,6 @@ public class PinnedStackListenerForwarder {
* Subclasses can ignore those methods they do not intend to take action upon.
*/
public static class PinnedStackListener {
public void onListenerRegistered(IPinnedStackController controller) {}
public void onMovementBoundsChanged(boolean fromImeAdjustment) {}
public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) {}

View File

@@ -41,7 +41,6 @@ import android.util.Log;
import android.util.Pair;
import android.util.Slog;
import android.view.DisplayInfo;
import android.view.IPinnedStackController;
import android.view.WindowManagerGlobal;
import android.window.WindowContainerTransaction;
@@ -161,11 +160,6 @@ public class PipController implements Pip, PipTaskOrganizer.PipTransitionCallbac
*/
private class PipControllerPinnedStackListener extends
PinnedStackListenerForwarder.PinnedStackListener {
@Override
public void onListenerRegistered(IPinnedStackController controller) {
mTouchHandler.setPinnedStackController(controller);
}
@Override
public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) {
mPipBoundsState.setImeVisibility(imeVisible, imeHeight);

View File

@@ -31,11 +31,8 @@ import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.os.Handler;
import android.os.RemoteException;
import android.provider.DeviceConfig;
import android.util.Log;
import android.util.Size;
import android.view.IPinnedStackController;
import android.view.InputEvent;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
@@ -76,7 +73,6 @@ public class PipTouchHandler {
private final PipDismissTargetHandler mPipDismissTargetHandler;
private PipResizeGestureHandler mPipResizeGestureHandler;
private IPinnedStackController mPinnedStackController;
private WeakReference<Consumer<Rect>> mPipExclusionBoundsChangeListener;
private final PhonePipMenuController mMenuController;
@@ -464,10 +460,6 @@ public class PipTouchHandler {
if (!(inputEvent instanceof MotionEvent)) {
return true;
}
// Skip touch handling until we are bound to the controller
if (mPinnedStackController == null) {
return true;
}
MotionEvent ev = (MotionEvent) inputEvent;
if (!mPipBoundsState.isStashed() && mPipResizeGestureHandler.willStartResizeGesture(ev)) {
@@ -590,13 +582,6 @@ public class PipTouchHandler {
mAccessibilityManager.sendAccessibilityEvent(event);
}
/**
* Sets the controller to update the system of changes from user interaction.
*/
void setPinnedStackController(IPinnedStackController controller) {
mPinnedStackController = controller;
}
/**
* Sets the menu visibility.
*/
@@ -625,13 +610,9 @@ public class PipTouchHandler {
// bounds which are now stale. In such a case we defer the animation to the
// normal bounds until after the next onMovementBoundsChanged() call to get the
// bounds in the new orientation
try {
int displayRotation = mPinnedStackController.getDisplayRotation();
if (mDisplayRotation != displayRotation) {
mDeferResizeToNormalBoundsUntilRotation = displayRotation;
}
} catch (RemoteException e) {
Log.e(TAG, "Could not get display rotation from controller");
int displayRotation = mContext.getDisplay().getRotation();
if (mDisplayRotation != displayRotation) {
mDeferResizeToNormalBoundsUntilRotation = displayRotation;
}
}

View File

@@ -29,7 +29,6 @@ import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Slog;
import android.view.DisplayInfo;
import android.view.IPinnedStackController;
import android.view.IPinnedStackListener;
import java.io.PrintWriter;
@@ -63,8 +62,6 @@ class PinnedStackController {
private final PinnedStackListenerDeathHandler mPinnedStackListenerDeathHandler =
new PinnedStackListenerDeathHandler();
private final PinnedStackControllerCallback mCallbacks = new PinnedStackControllerCallback();
/** Whether the PiP is entering or leaving. */
private boolean mIsPipWindowingModeChanging;
@@ -85,18 +82,6 @@ class PinnedStackController {
// Temp vars for calculation
private final DisplayMetrics mTmpMetrics = new DisplayMetrics();
/**
* The callback object passed to listeners for them to notify the controller of state changes.
*/
private class PinnedStackControllerCallback extends IPinnedStackController.Stub {
@Override
public int getDisplayRotation() {
synchronized (mService.mGlobalLock) {
return mDisplayInfo.rotation;
}
}
}
/**
* Handler for the case where the listener dies.
*/
@@ -141,7 +126,6 @@ class PinnedStackController {
void registerPinnedStackListener(IPinnedStackListener listener) {
try {
listener.asBinder().linkToDeath(mPinnedStackListenerDeathHandler, 0);
listener.onListenerRegistered(mCallbacks);
mPinnedStackListener = listener;
notifyDisplayInfoChanged(mDisplayInfo);
notifyImeVisibilityChanged(mIsImeShowing, mImeHeight);