Adding PipManager dumps.
Test: adb shell dumpsys activity service com.android.systemui Change-Id: Id647833f1b4dcb6226517c058d17d1812f022671
This commit is contained in:
@@ -25,6 +25,7 @@ import android.view.Gravity;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.widget.Scroller;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
@@ -322,4 +323,13 @@ public class PipSnapAlgorithm {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void dump(PrintWriter pw, String prefix) {
|
||||
final String innerPrefix = prefix + " ";
|
||||
pw.println(prefix + PipSnapAlgorithm.class.getSimpleName());
|
||||
pw.println(innerPrefix + "mSnapMode=" + mSnapMode);
|
||||
pw.println(innerPrefix + "mOrientation=" + mOrientation);
|
||||
pw.println(innerPrefix + "mMinimizedVisibleSize=" + mMinimizedVisibleSize);
|
||||
pw.println(innerPrefix + "mIsMinimized=" + mIsMinimized);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2017 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 com.android.systemui.pip;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
public interface BasePipManager {
|
||||
void initialize(Context context);
|
||||
void onConfigurationChanged();
|
||||
void dump(PrintWriter pw);
|
||||
}
|
||||
@@ -24,11 +24,16 @@ import android.content.res.Configuration;
|
||||
|
||||
import com.android.systemui.SystemUI;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* Controls the picture-in-picture window.
|
||||
*/
|
||||
public class PipUI extends SystemUI {
|
||||
|
||||
private BasePipManager mPipManager;
|
||||
|
||||
private boolean mSupportsPip;
|
||||
private boolean mIsLeanBackOnly;
|
||||
|
||||
@@ -36,27 +41,32 @@ public class PipUI extends SystemUI {
|
||||
public void start() {
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
mSupportsPip = pm.hasSystemFeature(FEATURE_PICTURE_IN_PICTURE);
|
||||
mIsLeanBackOnly = pm.hasSystemFeature(FEATURE_LEANBACK_ONLY);
|
||||
if (!mSupportsPip) {
|
||||
return;
|
||||
}
|
||||
if (mIsLeanBackOnly) {
|
||||
com.android.systemui.pip.tv.PipManager.getInstance().initialize(mContext);
|
||||
} else {
|
||||
com.android.systemui.pip.phone.PipManager.getInstance().initialize(mContext);
|
||||
}
|
||||
|
||||
mPipManager = pm.hasSystemFeature(FEATURE_LEANBACK_ONLY)
|
||||
? com.android.systemui.pip.tv.PipManager.getInstance()
|
||||
: com.android.systemui.pip.phone.PipManager.getInstance();
|
||||
mPipManager.initialize(mContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
if (!mSupportsPip) {
|
||||
if (mPipManager == null) {
|
||||
return;
|
||||
}
|
||||
if (mIsLeanBackOnly) {
|
||||
com.android.systemui.pip.tv.PipManager.getInstance().onConfigurationChanged();
|
||||
} else {
|
||||
com.android.systemui.pip.phone.PipManager.getInstance().onConfigurationChanged();
|
||||
|
||||
mPipManager.onConfigurationChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
if (mPipManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mPipManager.dump(pw);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,13 +32,16 @@ import android.view.IPinnedStackListener;
|
||||
import android.view.IWindowManager;
|
||||
import android.view.WindowManagerGlobal;
|
||||
|
||||
import com.android.systemui.pip.BasePipManager;
|
||||
import com.android.systemui.recents.misc.SystemServicesProxy;
|
||||
import com.android.systemui.recents.misc.SystemServicesProxy.TaskStackListener;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* Manages the picture-in-picture (PIP) UI and states for Phones.
|
||||
*/
|
||||
public class PipManager {
|
||||
public class PipManager implements BasePipManager {
|
||||
private static final String TAG = "PipManager";
|
||||
|
||||
private static PipManager sPipController;
|
||||
@@ -179,4 +182,11 @@ public class PipManager {
|
||||
}
|
||||
return sPipController;
|
||||
}
|
||||
|
||||
public void dump(PrintWriter pw) {
|
||||
final String innerPrefix = " ";
|
||||
pw.println(TAG);
|
||||
mMenuController.dump(pw, innerPrefix);
|
||||
mTouchHandler.dump(pw, innerPrefix);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import android.view.IWindowManager;
|
||||
|
||||
import com.android.systemui.pip.phone.PipMediaController.ActionListener;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -264,4 +265,11 @@ public class PipMenuActivityController {
|
||||
}
|
||||
mVisible = visible;
|
||||
}
|
||||
|
||||
public void dump(PrintWriter pw, String prefix) {
|
||||
final String innerPrefix = prefix + " ";
|
||||
pw.println(prefix + TAG);
|
||||
pw.println(innerPrefix + "mVisible=" + mVisible);
|
||||
pw.println(innerPrefix + "mListeners=" + mListeners.size());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,8 @@ import com.android.internal.policy.PipSnapAlgorithm;
|
||||
import com.android.systemui.recents.misc.SystemServicesProxy;
|
||||
import com.android.systemui.statusbar.FlingAnimationUtils;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* A helper to animate and manipulate the PiP.
|
||||
*/
|
||||
@@ -375,4 +377,11 @@ public class PipMotionHelper {
|
||||
private float distanceBetweenRectOffsets(Rect r1, Rect r2) {
|
||||
return PointF.length(r1.left - r2.left, r1.top - r2.top);
|
||||
}
|
||||
|
||||
public void dump(PrintWriter pw, String prefix) {
|
||||
final String innerPrefix = prefix + " ";
|
||||
pw.println(prefix + TAG);
|
||||
pw.println(innerPrefix + "mBounds=" + mBounds);
|
||||
pw.println(innerPrefix + "mStableInsets=" + mStableInsets);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ import com.android.systemui.Dependency;
|
||||
import com.android.systemui.statusbar.FlingAnimationUtils;
|
||||
import com.android.systemui.tuner.TunerService;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* Manages all the touch handling for PIP on the Phone, including moving, dismissing and expanding
|
||||
* the PIP.
|
||||
@@ -566,4 +568,24 @@ public class PipTouchHandler implements TunerService.Tunable {
|
||||
? mExpandedMovementBounds
|
||||
: mNormalMovementBounds;
|
||||
}
|
||||
|
||||
public void dump(PrintWriter pw, String prefix) {
|
||||
final String innerPrefix = prefix + " ";
|
||||
pw.println(prefix + TAG);
|
||||
pw.println(innerPrefix + "mMovementBounds=" + mMovementBounds);
|
||||
pw.println(innerPrefix + "mNormalBounds=" + mNormalBounds);
|
||||
pw.println(innerPrefix + "mNormalMovementBounds=" + mNormalMovementBounds);
|
||||
pw.println(innerPrefix + "mExpandedBounds=" + mExpandedBounds);
|
||||
pw.println(innerPrefix + "mExpandedMovementBounds=" + mExpandedMovementBounds);
|
||||
pw.println(innerPrefix + "mIsTappingThrough=" + mIsTappingThrough);
|
||||
pw.println(innerPrefix + "mIsMinimized=" + mIsMinimized);
|
||||
pw.println(innerPrefix + "mIsMenuVisible=" + mIsMenuVisible);
|
||||
pw.println(innerPrefix + "mIsImeShowing=" + mIsImeShowing);
|
||||
pw.println(innerPrefix + "mImeHeight=" + mImeHeight);
|
||||
pw.println(innerPrefix + "mSavedSnapFraction=" + mSavedSnapFraction);
|
||||
pw.println(innerPrefix + "mEnableDragToDismiss=" + mEnableDragToDismiss);
|
||||
mSnapAlgorithm.dump(pw, innerPrefix);
|
||||
mTouchState.dump(pw, innerPrefix);
|
||||
mMotionHelper.dump(pw, innerPrefix);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,13 @@ import android.view.MotionEvent;
|
||||
import android.view.VelocityTracker;
|
||||
import android.view.ViewConfiguration;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* This keeps track of the touch state throughout the current touch gesture.
|
||||
*/
|
||||
public class PipTouchState {
|
||||
private static final String TAG = "PipTouchHandler";
|
||||
|
||||
private ViewConfiguration mViewConfig;
|
||||
|
||||
@@ -195,4 +198,18 @@ public class PipTouchState {
|
||||
mVelocityTracker = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void dump(PrintWriter pw, String prefix) {
|
||||
final String innerPrefix = prefix + " ";
|
||||
pw.println(prefix + TAG);
|
||||
pw.println(innerPrefix + "mDownTouch=" + mDownTouch);
|
||||
pw.println(innerPrefix + "mDownDelta=" + mDownDelta);
|
||||
pw.println(innerPrefix + "mLastTouch=" + mLastTouch);
|
||||
pw.println(innerPrefix + "mLastDelta=" + mLastDelta);
|
||||
pw.println(innerPrefix + "mVelocity=" + mVelocity);
|
||||
pw.println(innerPrefix + "mIsUserInteracting=" + mIsUserInteracting);
|
||||
pw.println(innerPrefix + "mIsDragging=" + mIsDragging);
|
||||
pw.println(innerPrefix + "mStartedDragging=" + mStartedDragging);
|
||||
pw.println(innerPrefix + "mAllowDraggingOffscreen=" + mAllowDraggingOffscreen);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,9 +47,11 @@ 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;
|
||||
import com.android.systemui.recents.misc.SystemServicesProxy.TaskStackListener;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -61,7 +63,7 @@ import static com.android.systemui.Prefs.Key.TV_PICTURE_IN_PICTURE_ONBOARDING_SH
|
||||
/**
|
||||
* Manages the picture-in-picture (PIP) UI and states.
|
||||
*/
|
||||
public class PipManager {
|
||||
public class PipManager implements BasePipManager {
|
||||
private static final String TAG = "PipManager";
|
||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
private static final boolean DEBUG_FORCE_ONBOARDING =
|
||||
@@ -779,4 +781,9 @@ public class PipManager {
|
||||
private void updatePipVisibility(final boolean visible) {
|
||||
SystemServicesProxy.getInstance(mContext).setTvPipVisibility(visible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(PrintWriter pw) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user