diff options
Diffstat (limited to 'libs')
6 files changed, 42 insertions, 37 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java index 725f87d93e4e..580861cf4974 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java @@ -121,6 +121,19 @@ public class PhonePipMenuController implements PipMenuController { } }; + private final float[] mTmpValues = new float[9]; + private final Runnable mUpdateEmbeddedMatrix = () -> { + if (mPipMenuView == null || mPipMenuView.getViewRootImpl() == null) { + return; + } + mMoveTransform.getValues(mTmpValues); + try { + mPipMenuView.getViewRootImpl().getAccessibilityEmbeddedConnection() + .setScreenMatrix(mTmpValues); + } catch (RemoteException e) { + } + }; + public PhonePipMenuController(Context context, PipMediaController mediaController, SystemWindows systemWindows, ShellExecutor mainExecutor, Handler mainHandler) { @@ -306,6 +319,11 @@ public class PhonePipMenuController implements PipMenuController { } else { mApplier.scheduleApply(params); } + + if (mPipMenuView.getViewRootImpl() != null) { + mPipMenuView.getHandler().removeCallbacks(mUpdateEmbeddedMatrix); + mPipMenuView.getHandler().post(mUpdateEmbeddedMatrix); + } } /** diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java index 0d64407f649f..8ab405bca7db 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java @@ -32,7 +32,6 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; -import android.annotation.Nullable; import android.app.PendingIntent.CanceledException; import android.app.RemoteAction; import android.content.ComponentName; @@ -52,10 +51,8 @@ import android.util.Size; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; -import android.view.SurfaceControl; import android.view.View; import android.view.ViewGroup; -import android.view.ViewRootImpl; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.FrameLayout; @@ -198,6 +195,11 @@ public class PipMenuView extends FrameLayout { } @Override + public boolean shouldDelayChildPressedState() { + return true; + } + + @Override public boolean dispatchTouchEvent(MotionEvent ev) { if (!mAllowTouches) { return false; @@ -287,18 +289,6 @@ public class PipMenuView extends FrameLayout { } } - @Nullable SurfaceControl getWindowSurfaceControl() { - final ViewRootImpl root = getViewRootImpl(); - if (root == null) { - return null; - } - final SurfaceControl out = root.getSurfaceControl(); - if (out != null && out.isValid()) { - return out; - } - return null; - } - /** * Different from {@link #hideMenu()}, this function does not try to finish this menu activity * and instead, it fades out the controls by setting the alpha to 0 directly without menu @@ -398,8 +388,20 @@ public class PipMenuView extends FrameLayout { return true; }); + // Update the expand button only if it should show with the menu + expandContainer.setVisibility(mMenuState == MENU_STATE_FULL + ? View.VISIBLE + : View.INVISIBLE); + + FrameLayout.LayoutParams expandedLp = + (FrameLayout.LayoutParams) expandContainer.getLayoutParams(); if (mActions.isEmpty() || mMenuState == MENU_STATE_CLOSE || mMenuState == MENU_STATE_NONE) { actionsContainer.setVisibility(View.INVISIBLE); + + // Update the expand container margin to adjust the center of the expand button to + // account for the existence of the action container + expandedLp.topMargin = 0; + expandedLp.bottomMargin = 0; } else { actionsContainer.setVisibility(View.VISIBLE); if (mActionsGroup != null) { @@ -455,14 +457,12 @@ public class PipMenuView extends FrameLayout { // Update the expand container margin to adjust the center of the expand button to // account for the existence of the action container - FrameLayout.LayoutParams expandedLp = - (FrameLayout.LayoutParams) expandContainer.getLayoutParams(); expandedLp.topMargin = getResources().getDimensionPixelSize( R.dimen.pip_action_padding); expandedLp.bottomMargin = getResources().getDimensionPixelSize( R.dimen.pip_expand_container_edge_margin); - expandContainer.requestLayout(); } + expandContainer.requestLayout(); } private void notifyMenuStateChange(int menuState, boolean resize, Runnable callback) { diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/PipAppHelper.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/PipAppHelper.kt index ecc066be734f..5a96a7c8cbd9 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/PipAppHelper.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/helpers/PipAppHelper.kt @@ -17,7 +17,6 @@ package com.android.wm.shell.flicker.helpers import android.app.Instrumentation -import android.graphics.Point import android.media.session.MediaController import android.media.session.MediaSessionManager import android.os.SystemClock @@ -135,11 +134,8 @@ class PipAppHelper(instrumentation: Instrumentation) : BaseAppHelper( expandPipWindow(wmHelper) val exitPipObject = uiDevice.findObject(By.res(SYSTEMUI_PACKAGE, "dismiss")) requireNotNull(exitPipObject) { "PIP window dismiss button not found" } - val coordinatesInWindow = exitPipObject.visibleBounds - val windowOffset = wmHelper.getWindowRegion(component).bounds - val newCoordinates = Point(windowOffset.left + coordinatesInWindow.centerX(), - windowOffset.top + coordinatesInWindow.centerY()) - uiDevice.click(newCoordinates.x, newCoordinates.y) + val dismissButtonBounds = exitPipObject.visibleBounds + uiDevice.click(dismissButtonBounds.centerX(), dismissButtonBounds.centerY()) } // Wait for animation to complete. diff --git a/libs/androidfw/Android.bp b/libs/androidfw/Android.bp index aba0f1b47673..63b831de5da1 100644 --- a/libs/androidfw/Android.bp +++ b/libs/androidfw/Android.bp @@ -97,8 +97,8 @@ cc_library { "libincfs", "libutils", "libz", - "libziparchive", ], + static_libs: ["libziparchive_for_incfs"], static: { enabled: false, }, diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp index d663c52b2c08..607ef72df96a 100644 --- a/libs/hwui/Android.bp +++ b/libs/hwui/Android.bp @@ -388,11 +388,10 @@ cc_defaults { "liblog", "libminikin", "libz", - "libziparchive", "libjpeg", ], - static_libs: ["libnativehelper_lazy"], + static_libs: ["libnativehelper_lazy", "libziparchive_for_incfs"], target: { android: { diff --git a/libs/hwui/utils/PaintUtils.h b/libs/hwui/utils/PaintUtils.h index 09c6a4fdf50d..a8f2d9a28d67 100644 --- a/libs/hwui/utils/PaintUtils.h +++ b/libs/hwui/utils/PaintUtils.h @@ -52,18 +52,10 @@ public: return mode == SkBlendMode::kSrcOver || mode == SkBlendMode::kSrc; } - static bool isBlendedShader(const SkShader* shader) { - if (shader == nullptr) { - return false; - } - return !shader->isOpaque(); - } + static bool isBlendedShader(const SkShader* shader) { return shader && !shader->isOpaque(); } static bool isBlendedColorFilter(const SkColorFilter* filter) { - if (filter == nullptr) { - return false; - } - return (filter->getFlags() & SkColorFilter::kAlphaUnchanged_Flag) == 0; + return filter && !filter->isAlphaUnchanged(); } static inline SkBlendMode getBlendModeDirect(const SkPaint* paint) { |