Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java +15 −2 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.os.RemoteException; import android.util.Log; import android.view.SurfaceControl; import android.view.SyncRtSurfaceTransactionApplier; import android.view.WindowManagerGlobal; import androidx.annotation.Nullable; Loading Loading @@ -143,7 +144,6 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis mSystemWindows.addView(mPipMenuView, getPipMenuLayoutParams(MENU_WINDOW_TITLE, 0 /* width */, 0 /* height */), 0, SHELL_ROOT_LAYER_PIP); mPipMenuView.setFocusGrantToken(mSystemWindows.getFocusGrantToken(mPipMenuView)); } @Override Loading @@ -164,6 +164,7 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis t.setPosition(menuSurfaceControl, menuBounds.left, menuBounds.top); t.apply(); } grantPipMenuFocus(true); mPipMenuView.show(mInMoveMode, mDelegate.getPipGravity()); } } Loading Loading @@ -194,8 +195,9 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis if (DEBUG) Log.d(TAG, "hideMenu()"); } mPipMenuView.hide(mInMoveMode); mPipMenuView.hide(); if (!mInMoveMode) { grantPipMenuFocus(false); mDelegate.closeMenu(); } } Loading Loading @@ -453,4 +455,15 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis void closePip(); } private void grantPipMenuFocus(boolean grantFocus) { if (DEBUG) Log.d(TAG, "grantWindowFocus(" + grantFocus + ")"); try { WindowManagerGlobal.getWindowSession().grantEmbeddedWindowFocus(null /* window */, mSystemWindows.getFocusGrantToken(mPipMenuView), grantFocus); } catch (Exception e) { Log.e(TAG, "Unable to update focus", e); } } } libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuView.java +1 −25 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.app.RemoteAction; import android.content.Context; import android.graphics.Rect; import android.os.Handler; import android.os.IBinder; import android.util.AttributeSet; import android.util.Log; import android.view.Gravity; Loading @@ -39,7 +38,6 @@ import android.view.SurfaceControl; import android.view.View; import android.view.ViewGroup; import android.view.ViewRootImpl; import android.view.WindowManagerGlobal; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; Loading Loading @@ -72,7 +70,6 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener { private final ImageView mArrowRight; private final ImageView mArrowDown; private final ImageView mArrowLeft; private IBinder mFocusGrantToken = null; private final ViewGroup mScrollView; private final ViewGroup mHorizontalScrollView; Loading Loading @@ -152,10 +149,6 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener { mListener = listener; } void setFocusGrantToken(IBinder token) { mFocusGrantToken = token; } void setExpandedModeEnabled(boolean enabled) { mExpandButton.setVisibility(enabled ? VISIBLE : GONE); } Loading @@ -170,8 +163,6 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener { void show(boolean inMoveMode, int gravity) { if (DEBUG) Log.d(TAG, "show(), inMoveMode: " + inMoveMode); grantWindowFocus(true); if (inMoveMode) { showMovementHints(gravity); } else { Loading @@ -180,15 +171,11 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener { animateAlphaTo(1, mMenuFrameView); } void hide(boolean isInMoveMode) { void hide() { if (DEBUG) Log.d(TAG, "hide()"); animateAlphaTo(0, mActionButtonsContainer); animateAlphaTo(0, mMenuFrameView); hideMovementHints(); if (!isInMoveMode) { grantWindowFocus(false); } } private void animateAlphaTo(float alpha, View view) { Loading Loading @@ -217,17 +204,6 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener { || mArrowLeft.getAlpha() != 0f; } private void grantWindowFocus(boolean grantFocus) { if (DEBUG) Log.d(TAG, "grantWindowFocus(" + grantFocus + ")"); try { WindowManagerGlobal.getWindowSession().grantEmbeddedWindowFocus(null /* window */, mFocusGrantToken, grantFocus); } catch (Exception e) { Log.e(TAG, "Unable to update focus", e); } } void setAdditionalActions(List<RemoteAction> actions, Handler mainHandler) { if (DEBUG) Log.d(TAG, "setAdditionalActions()"); Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuController.java +15 −2 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.os.RemoteException; import android.util.Log; import android.view.SurfaceControl; import android.view.SyncRtSurfaceTransactionApplier; import android.view.WindowManagerGlobal; import androidx.annotation.Nullable; Loading Loading @@ -143,7 +144,6 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis mSystemWindows.addView(mPipMenuView, getPipMenuLayoutParams(MENU_WINDOW_TITLE, 0 /* width */, 0 /* height */), 0, SHELL_ROOT_LAYER_PIP); mPipMenuView.setFocusGrantToken(mSystemWindows.getFocusGrantToken(mPipMenuView)); } @Override Loading @@ -164,6 +164,7 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis t.setPosition(menuSurfaceControl, menuBounds.left, menuBounds.top); t.apply(); } grantPipMenuFocus(true); mPipMenuView.show(mInMoveMode, mDelegate.getPipGravity()); } } Loading Loading @@ -194,8 +195,9 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis if (DEBUG) Log.d(TAG, "hideMenu()"); } mPipMenuView.hide(mInMoveMode); mPipMenuView.hide(); if (!mInMoveMode) { grantPipMenuFocus(false); mDelegate.closeMenu(); } } Loading Loading @@ -453,4 +455,15 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis void closePip(); } private void grantPipMenuFocus(boolean grantFocus) { if (DEBUG) Log.d(TAG, "grantWindowFocus(" + grantFocus + ")"); try { WindowManagerGlobal.getWindowSession().grantEmbeddedWindowFocus(null /* window */, mSystemWindows.getFocusGrantToken(mPipMenuView), grantFocus); } catch (Exception e) { Log.e(TAG, "Unable to update focus", e); } } }
libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipMenuView.java +1 −25 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.app.RemoteAction; import android.content.Context; import android.graphics.Rect; import android.os.Handler; import android.os.IBinder; import android.util.AttributeSet; import android.util.Log; import android.view.Gravity; Loading @@ -39,7 +38,6 @@ import android.view.SurfaceControl; import android.view.View; import android.view.ViewGroup; import android.view.ViewRootImpl; import android.view.WindowManagerGlobal; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; Loading Loading @@ -72,7 +70,6 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener { private final ImageView mArrowRight; private final ImageView mArrowDown; private final ImageView mArrowLeft; private IBinder mFocusGrantToken = null; private final ViewGroup mScrollView; private final ViewGroup mHorizontalScrollView; Loading Loading @@ -152,10 +149,6 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener { mListener = listener; } void setFocusGrantToken(IBinder token) { mFocusGrantToken = token; } void setExpandedModeEnabled(boolean enabled) { mExpandButton.setVisibility(enabled ? VISIBLE : GONE); } Loading @@ -170,8 +163,6 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener { void show(boolean inMoveMode, int gravity) { if (DEBUG) Log.d(TAG, "show(), inMoveMode: " + inMoveMode); grantWindowFocus(true); if (inMoveMode) { showMovementHints(gravity); } else { Loading @@ -180,15 +171,11 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener { animateAlphaTo(1, mMenuFrameView); } void hide(boolean isInMoveMode) { void hide() { if (DEBUG) Log.d(TAG, "hide()"); animateAlphaTo(0, mActionButtonsContainer); animateAlphaTo(0, mMenuFrameView); hideMovementHints(); if (!isInMoveMode) { grantWindowFocus(false); } } private void animateAlphaTo(float alpha, View view) { Loading Loading @@ -217,17 +204,6 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener { || mArrowLeft.getAlpha() != 0f; } private void grantWindowFocus(boolean grantFocus) { if (DEBUG) Log.d(TAG, "grantWindowFocus(" + grantFocus + ")"); try { WindowManagerGlobal.getWindowSession().grantEmbeddedWindowFocus(null /* window */, mFocusGrantToken, grantFocus); } catch (Exception e) { Log.e(TAG, "Unable to update focus", e); } } void setAdditionalActions(List<RemoteAction> actions, Handler mainHandler) { if (DEBUG) Log.d(TAG, "setAdditionalActions()"); Loading