Merge "Dump DefaultSelectionToolbarRenderService toolbar information"
This commit is contained in:
committed by
Android (Google) Code Review
commit
2f07bb4f06
@@ -24,6 +24,8 @@ import android.util.Slog;
|
||||
import android.util.SparseArray;
|
||||
import android.view.selectiontoolbar.ShowInfo;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@@ -130,5 +132,22 @@ public final class DefaultSelectionToolbarRenderService extends SelectionToolbar
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
int size = mToolbarCache.size();
|
||||
pw.print("number selectionToolbar: "); pw.println(size);
|
||||
String pfx = " ";
|
||||
for (int i = 0; i < size; i++) {
|
||||
pw.print("#"); pw.println(i);
|
||||
int callingUid = mToolbarCache.keyAt(i);
|
||||
pw.print(pfx); pw.print("callingUid: "); pw.println(callingUid);
|
||||
Pair<Long, RemoteSelectionToolbar> toolbarPair = mToolbarCache.valueAt(i);
|
||||
RemoteSelectionToolbar selectionToolbar = toolbarPair.second;
|
||||
pw.print(pfx); pw.print("selectionToolbar: ");
|
||||
selectionToolbar.dump(pfx, pw);
|
||||
pw.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* This class is the root view for the selection toolbar. It is responsible for
|
||||
* detecting the click on the item and to also transfer input focus to the application.
|
||||
@@ -40,6 +42,9 @@ public class FloatingToolbarRoot extends LinearLayout {
|
||||
private final SelectionToolbarRenderService.TransferTouchListener mTransferTouchListener;
|
||||
private Rect mContentRect;
|
||||
|
||||
private int mLastDownX = -1;
|
||||
private int mLastDownY = -1;
|
||||
|
||||
public FloatingToolbarRoot(Context context, IBinder targetInputToken,
|
||||
SelectionToolbarRenderService.TransferTouchListener transferTouchListener) {
|
||||
super(context);
|
||||
@@ -59,13 +64,13 @@ public class FloatingToolbarRoot extends LinearLayout {
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||
int downX = (int) event.getX();
|
||||
int downY = (int) event.getY();
|
||||
mLastDownX = (int) event.getX();
|
||||
mLastDownY = (int) event.getY();
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "downX=" + downX + " downY=" + downY);
|
||||
Log.d(TAG, "downX=" + mLastDownX + " downY=" + mLastDownY);
|
||||
}
|
||||
// TODO(b/215497659): Check FLAG_WINDOW_IS_PARTIALLY_OBSCURED
|
||||
if (!mContentRect.contains(downX, downY)) {
|
||||
if (!mContentRect.contains(mLastDownX, mLastDownY)) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Transfer touch focus to application.");
|
||||
}
|
||||
@@ -75,4 +80,10 @@ public class FloatingToolbarRoot extends LinearLayout {
|
||||
}
|
||||
return super.dispatchTouchEvent(event);
|
||||
}
|
||||
|
||||
void dump(String prefix, PrintWriter pw) {
|
||||
pw.print(prefix); pw.println("FloatingToolbarRoot:");
|
||||
pw.print(prefix + " "); pw.print("last down X: "); pw.println(mLastDownX);
|
||||
pw.print(prefix + " "); pw.print("last down Y: "); pw.println(mLastDownY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ import com.android.internal.R;
|
||||
import com.android.internal.util.Preconditions;
|
||||
import com.android.internal.widget.floatingtoolbar.FloatingToolbar;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -1372,4 +1373,32 @@ final class RemoteSelectionToolbar {
|
||||
Log.v(TAG, message);
|
||||
}
|
||||
}
|
||||
|
||||
void dump(String prefix, PrintWriter pw) {
|
||||
pw.print(prefix); pw.print("toolbar token: "); pw.println(mSelectionToolbarToken);
|
||||
pw.print(prefix); pw.print("dismissed: "); pw.println(mDismissed);
|
||||
pw.print(prefix); pw.print("hidden: "); pw.println(mHidden);
|
||||
pw.print(prefix); pw.print("popup width: "); pw.println(mPopupWidth);
|
||||
pw.print(prefix); pw.print("popup height: "); pw.println(mPopupHeight);
|
||||
pw.print(prefix); pw.print("relative coords: "); pw.println(mRelativeCoordsForToolbar);
|
||||
pw.print(prefix); pw.print("main panel size: "); pw.println(mMainPanelSize);
|
||||
boolean hasOverflow = hasOverflow();
|
||||
pw.print(prefix); pw.print("has overflow: "); pw.println(hasOverflow);
|
||||
if (hasOverflow) {
|
||||
pw.print(prefix); pw.print("overflow open: "); pw.println(mIsOverflowOpen);
|
||||
pw.print(prefix); pw.print("overflow size: "); pw.println(mOverflowPanelSize);
|
||||
}
|
||||
if (mSurfaceControlViewHost != null) {
|
||||
FloatingToolbarRoot root = (FloatingToolbarRoot) mSurfaceControlViewHost.getView();
|
||||
root.dump(prefix, pw);
|
||||
}
|
||||
if (mMenuItems != null) {
|
||||
int menuItemSize = mMenuItems.size();
|
||||
pw.print(prefix); pw.print("number menu items: "); pw.println(menuItemSize);
|
||||
for (int i = 0; i < menuItemSize; i++) {
|
||||
pw.print(prefix); pw.print("#"); pw.println(i);
|
||||
pw.print(prefix + " "); pw.println(mMenuItems.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user