Loading packages/SystemUI/src/com/android/systemui/pip/tv/PipManager.java +21 −12 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.media.session.PlaybackState; import android.os.Debug; import android.os.Handler; import android.os.RemoteException; import android.os.SystemProperties; import android.text.TextUtils; import android.util.Log; import android.util.Pair; Loading @@ -43,7 +42,6 @@ import android.view.IPinnedStackListener; import android.view.IWindowManager; import android.view.WindowManagerGlobal; import com.android.systemui.Prefs; import com.android.systemui.R; import com.android.systemui.pip.BasePipManager; import com.android.systemui.recents.misc.SystemServicesProxy; Loading Loading @@ -109,7 +107,7 @@ public class PipManager implements BasePipManager { private IWindowManager mWindowManager; private MediaSessionManager mMediaSessionManager; private int mState = STATE_NO_PIP; private int mResumeResizePinnedStackRunnable = STATE_NO_PIP; private int mResumeResizePinnedStackRunnableState = STATE_NO_PIP; private final Handler mHandler = new Handler(); private List<Listener> mListeners = new ArrayList<>(); private List<MediaListener> mMediaListeners = new ArrayList<>(); Loading @@ -130,7 +128,7 @@ public class PipManager implements BasePipManager { private final Runnable mResizePinnedStackRunnable = new Runnable() { @Override public void run() { resizePinnedStack(mResumeResizePinnedStackRunnable); resizePinnedStack(mResumeResizePinnedStackRunnableState); } }; private final Runnable mClosePipRunnable = new Runnable() { Loading Loading @@ -278,7 +276,7 @@ public class PipManager implements BasePipManager { * Shows the picture-in-picture menu if an activity is in picture-in-picture mode. */ public void showPictureInPictureMenu() { if (mState == STATE_PIP) { if (getState() == STATE_PIP) { resizePinnedStack(STATE_PIP_MENU); } } Loading Loading @@ -352,14 +350,15 @@ public class PipManager implements BasePipManager { void resizePinnedStack(int state) { if (DEBUG) Log.d(TAG, "resizePinnedStack() state=" + state, new Exception()); boolean wasStateNoPip = (mState == STATE_NO_PIP); mResumeResizePinnedStackRunnable = state; for (int i = mListeners.size() - 1; i >= 0; --i) { mListeners.get(i).onPipResizeAboutToStart(); } if (mSuspendPipResizingReason != 0) { mResumeResizePinnedStackRunnableState = state; if (DEBUG) Log.d(TAG, "resizePinnedStack() deferring" + " mSuspendPipResizingReason=" + mSuspendPipResizingReason + " mResumeResizePinnedStackRunnable=" + mResumeResizePinnedStackRunnable); + " mResumeResizePinnedStackRunnableState=" + mResumeResizePinnedStackRunnableState); return; } mState = state; Loading Loading @@ -391,6 +390,16 @@ public class PipManager implements BasePipManager { } } /** * @return the current state, or the pending state if the state change was previously suspended. */ private int getState() { if (mSuspendPipResizingReason != 0) { return mResumeResizePinnedStackRunnableState; } return mState; } /** * Returns the default PIP bound. */ Loading Loading @@ -459,7 +468,7 @@ public class PipManager implements BasePipManager { } private void handleMediaResourceGranted(String[] packageNames) { if (mState == STATE_NO_PIP) { if (getState() == STATE_NO_PIP) { mLastPackagesResourceGranted = packageNames; } else { boolean requestedFromLastPackages = false; Loading @@ -482,7 +491,7 @@ public class PipManager implements BasePipManager { private void updateMediaController(List<MediaController> controllers) { MediaController mediaController = null; if (controllers != null && mState != STATE_NO_PIP && mPipComponentName != null) { if (controllers != null && getState() != STATE_NO_PIP && mPipComponentName != null) { for (int i = controllers.size() - 1; i >= 0; i--) { MediaController controller = controllers.get(i); // We assumes that an app with PIPable activity Loading Loading @@ -571,7 +580,7 @@ public class PipManager implements BasePipManager { if (!checkCurrentUserId(DEBUG)) { return; } if (mState != STATE_NO_PIP) { if (getState() != STATE_NO_PIP) { boolean hasPip = false; StackInfo stackInfo = getPinnedStackInfo(); Loading @@ -593,7 +602,7 @@ public class PipManager implements BasePipManager { return; } } if (mState == STATE_PIP) { if (getState() == STATE_PIP) { Rect bounds = isSettingsShown() ? mSettingsPipBounds : mDefaultPipBounds; if (mPipBounds != bounds) { mPipBounds = bounds; Loading Loading @@ -645,7 +654,7 @@ public class PipManager implements BasePipManager { if (!checkCurrentUserId(DEBUG)) { return; } switch (mState) { switch (getState()) { case STATE_PIP_MENU: showPipMenu(); break; Loading Loading
packages/SystemUI/src/com/android/systemui/pip/tv/PipManager.java +21 −12 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.media.session.PlaybackState; import android.os.Debug; import android.os.Handler; import android.os.RemoteException; import android.os.SystemProperties; import android.text.TextUtils; import android.util.Log; import android.util.Pair; Loading @@ -43,7 +42,6 @@ import android.view.IPinnedStackListener; import android.view.IWindowManager; import android.view.WindowManagerGlobal; import com.android.systemui.Prefs; import com.android.systemui.R; import com.android.systemui.pip.BasePipManager; import com.android.systemui.recents.misc.SystemServicesProxy; Loading Loading @@ -109,7 +107,7 @@ public class PipManager implements BasePipManager { private IWindowManager mWindowManager; private MediaSessionManager mMediaSessionManager; private int mState = STATE_NO_PIP; private int mResumeResizePinnedStackRunnable = STATE_NO_PIP; private int mResumeResizePinnedStackRunnableState = STATE_NO_PIP; private final Handler mHandler = new Handler(); private List<Listener> mListeners = new ArrayList<>(); private List<MediaListener> mMediaListeners = new ArrayList<>(); Loading @@ -130,7 +128,7 @@ public class PipManager implements BasePipManager { private final Runnable mResizePinnedStackRunnable = new Runnable() { @Override public void run() { resizePinnedStack(mResumeResizePinnedStackRunnable); resizePinnedStack(mResumeResizePinnedStackRunnableState); } }; private final Runnable mClosePipRunnable = new Runnable() { Loading Loading @@ -278,7 +276,7 @@ public class PipManager implements BasePipManager { * Shows the picture-in-picture menu if an activity is in picture-in-picture mode. */ public void showPictureInPictureMenu() { if (mState == STATE_PIP) { if (getState() == STATE_PIP) { resizePinnedStack(STATE_PIP_MENU); } } Loading Loading @@ -352,14 +350,15 @@ public class PipManager implements BasePipManager { void resizePinnedStack(int state) { if (DEBUG) Log.d(TAG, "resizePinnedStack() state=" + state, new Exception()); boolean wasStateNoPip = (mState == STATE_NO_PIP); mResumeResizePinnedStackRunnable = state; for (int i = mListeners.size() - 1; i >= 0; --i) { mListeners.get(i).onPipResizeAboutToStart(); } if (mSuspendPipResizingReason != 0) { mResumeResizePinnedStackRunnableState = state; if (DEBUG) Log.d(TAG, "resizePinnedStack() deferring" + " mSuspendPipResizingReason=" + mSuspendPipResizingReason + " mResumeResizePinnedStackRunnable=" + mResumeResizePinnedStackRunnable); + " mResumeResizePinnedStackRunnableState=" + mResumeResizePinnedStackRunnableState); return; } mState = state; Loading Loading @@ -391,6 +390,16 @@ public class PipManager implements BasePipManager { } } /** * @return the current state, or the pending state if the state change was previously suspended. */ private int getState() { if (mSuspendPipResizingReason != 0) { return mResumeResizePinnedStackRunnableState; } return mState; } /** * Returns the default PIP bound. */ Loading Loading @@ -459,7 +468,7 @@ public class PipManager implements BasePipManager { } private void handleMediaResourceGranted(String[] packageNames) { if (mState == STATE_NO_PIP) { if (getState() == STATE_NO_PIP) { mLastPackagesResourceGranted = packageNames; } else { boolean requestedFromLastPackages = false; Loading @@ -482,7 +491,7 @@ public class PipManager implements BasePipManager { private void updateMediaController(List<MediaController> controllers) { MediaController mediaController = null; if (controllers != null && mState != STATE_NO_PIP && mPipComponentName != null) { if (controllers != null && getState() != STATE_NO_PIP && mPipComponentName != null) { for (int i = controllers.size() - 1; i >= 0; i--) { MediaController controller = controllers.get(i); // We assumes that an app with PIPable activity Loading Loading @@ -571,7 +580,7 @@ public class PipManager implements BasePipManager { if (!checkCurrentUserId(DEBUG)) { return; } if (mState != STATE_NO_PIP) { if (getState() != STATE_NO_PIP) { boolean hasPip = false; StackInfo stackInfo = getPinnedStackInfo(); Loading @@ -593,7 +602,7 @@ public class PipManager implements BasePipManager { return; } } if (mState == STATE_PIP) { if (getState() == STATE_PIP) { Rect bounds = isSettingsShown() ? mSettingsPipBounds : mDefaultPipBounds; if (mPipBounds != bounds) { mPipBounds = bounds; Loading Loading @@ -645,7 +654,7 @@ public class PipManager implements BasePipManager { if (!checkCurrentUserId(DEBUG)) { return; } switch (mState) { switch (getState()) { case STATE_PIP_MENU: showPipMenu(); break; Loading