Merge "Add SwipeHelper dump to better understand the error state." into udc-dev

This commit is contained in:
Jeff DeCew
2023-05-31 20:04:27 +00:00
committed by Android (Google) Code Review
2 changed files with 36 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ import static androidx.dynamicanimation.animation.DynamicAnimation.TRANSLATION_X
import static androidx.dynamicanimation.animation.FloatPropertyCompat.createFloatPropertyCompat;
import static com.android.systemui.classifier.Classifier.NOTIFICATION_DISMISS;
import static com.android.systemui.statusbar.notification.NotificationUtils.logKey;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -54,9 +55,10 @@ import com.android.wm.shell.animation.FlingAnimationUtils;
import com.android.wm.shell.animation.PhysicsAnimator;
import com.android.wm.shell.animation.PhysicsAnimator.SpringConfig;
import java.io.PrintWriter;
import java.util.function.Consumer;
public class SwipeHelper implements Gefingerpoken {
public class SwipeHelper implements Gefingerpoken, Dumpable {
static final String TAG = "com.android.systemui.SwipeHelper";
private static final boolean DEBUG_INVALIDATE = false;
private static final boolean CONSTRAIN_SWIPE = true;
@@ -844,6 +846,31 @@ public class SwipeHelper implements Gefingerpoken {
return false;
}
@Override
public void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
pw.append("mTouchedView=").print(mTouchedView);
if (mTouchedView instanceof ExpandableNotificationRow) {
pw.append(" key=").println(logKey((ExpandableNotificationRow) mTouchedView));
} else {
pw.println();
}
pw.append("mIsSwiping=").println(mIsSwiping);
pw.append("mSnappingChild=").println(mSnappingChild);
pw.append("mLongPressSent=").println(mLongPressSent);
pw.append("mInitialTouchPos=").println(mInitialTouchPos);
pw.append("mTranslation=").println(mTranslation);
pw.append("mCanCurrViewBeDimissed=").println(mCanCurrViewBeDimissed);
pw.append("mMenuRowIntercepting=").println(mMenuRowIntercepting);
pw.append("mDisableHwLayers=").println(mDisableHwLayers);
pw.append("mDismissPendingMap: ").println(mDismissPendingMap.size());
if (!mDismissPendingMap.isEmpty()) {
mDismissPendingMap.forEach((view, animator) -> {
pw.append(" ").print(view);
pw.append(": ").println(animator);
});
}
}
public interface Callback {
View getChildAtPosition(MotionEvent ev);

View File

@@ -34,6 +34,7 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.jank.InteractionJankMonitor;
import com.android.systemui.SwipeHelper;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
@@ -545,14 +546,17 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc
private final FeatureFlags mFeatureFlags;
private NotificationCallback mNotificationCallback;
private NotificationMenuRowPlugin.OnMenuEventListener mOnMenuEventListener;
private DumpManager mDumpManager;
private NotificationRoundnessManager mNotificationRoundnessManager;
@Inject
Builder(@Main Resources resources, ViewConfiguration viewConfiguration,
DumpManager dumpManager,
FalsingManager falsingManager, FeatureFlags featureFlags,
NotificationRoundnessManager notificationRoundnessManager) {
mResources = resources;
mViewConfiguration = viewConfiguration;
mDumpManager = dumpManager;
mFalsingManager = falsingManager;
mFeatureFlags = featureFlags;
mNotificationRoundnessManager = notificationRoundnessManager;
@@ -570,9 +574,12 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc
}
NotificationSwipeHelper build() {
return new NotificationSwipeHelper(mResources, mViewConfiguration, mFalsingManager,
NotificationSwipeHelper swipeHelper = new NotificationSwipeHelper(
mResources, mViewConfiguration, mFalsingManager,
mFeatureFlags, mNotificationCallback, mOnMenuEventListener,
mNotificationRoundnessManager);
mDumpManager.registerDumpable(swipeHelper);
return swipeHelper;
}
}
}