OSDN Git Service

Adjusting PiP for the TV IME.
authorWinson Chung <winsonc@google.com>
Thu, 24 Aug 2017 20:35:24 +0000 (13:35 -0700)
committerWinson Chung <winsonc@google.com>
Thu, 24 Aug 2017 20:35:24 +0000 (13:35 -0700)
Bug: 63898225
Test: Ensure that PiP does not overlap with the IME on TV
Change-Id: I6aced6331b56cd92599cbdb9c13d04ae9138c59b

packages/SystemUI/src/com/android/systemui/pip/tv/PipManager.java

index ca58080..e8c1295 100644 (file)
@@ -127,6 +127,10 @@ public class PipManager implements BasePipManager {
     private PipNotification mPipNotification;
     private ParceledListSlice mCustomActions;
 
+    // Keeps track of the IME visibility to adjust the PiP when the IME is visible
+    private boolean mImeVisible;
+    private int mImeHeightAdjustment;
+
     private final PinnedStackListener mPinnedStackListener = new PinnedStackListener();
 
     private final Runnable mResizePinnedStackRunnable = new Runnable() {
@@ -175,7 +179,22 @@ public class PipManager implements BasePipManager {
         public void onListenerRegistered(IPinnedStackController controller) {}
 
         @Override
-        public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) {}
+        public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) {
+            if (mState == STATE_PIP) {
+                if (mImeVisible != imeVisible) {
+                    if (imeVisible) {
+                        // Save the IME height adjustment, and offset to not occlude the IME
+                        mPipBounds.offset(0, -imeHeight);
+                        mImeHeightAdjustment = imeHeight;
+                    } else {
+                        // Apply the inverse adjustment when the IME is hidden
+                        mPipBounds.offset(0, mImeHeightAdjustment);
+                    }
+                    mImeVisible = imeVisible;
+                    resizePinnedStack(STATE_PIP);
+                }
+            }
+        }
 
         @Override
         public void onMinimizedStateChanged(boolean isMinimized) {}