Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb3185b8 authored by Justin Weir's avatar Justin Weir
Browse files

Add LogBuffer that passively tracks touch handling in the shade

Logs will passively observe calls to ViewGroup.onInterceptTouchEvent
for all top level ViewGroups for each major section of the shade,
e.g. QS, NSSL, Keyguard, Bouncer. Additionally, it will track
touches on Views near the top of the shade's hierarchy like
scrims and the long press detector.

Bug: 288507023
Test: updated and ran affected tests
Test: manual verification of logs
Change-Id: Ic3b94ae80b7cff462d3ae0af62d8466885fb684c
Merged-In: Ic3b94ae80b7cff462d3ae0af62d8466885fb684c
parent 07be6824
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ import com.android.systemui.Gefingerpoken;
import com.android.systemui.R;
import com.android.systemui.classifier.FalsingA11yDelegate;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.shade.TouchLogger;
import com.android.systemui.shared.system.SysUiStatsLog;
import com.android.systemui.statusbar.policy.BaseUserSwitcherAdapter;
import com.android.systemui.statusbar.policy.UserSwitcherController;
@@ -658,6 +659,11 @@ public class KeyguardSecurityContainer extends ConstraintLayout {
        return insets.inset(0, 0, 0, inset);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        return TouchLogger.logDispatchTouch(TAG, ev, super.dispatchTouchEvent(ev));
    }

    @Override
    protected void dispatchDraw(Canvas canvas) {
        super.dispatchDraw(canvas);
+7 −0
Original line number Diff line number Diff line
@@ -23,12 +23,14 @@ import android.graphics.Canvas;
import android.os.Build;
import android.os.Trace;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewPropertyAnimator;
import android.widget.GridLayout;

import com.android.systemui.R;
import com.android.systemui.shade.TouchLogger;
import com.android.systemui.statusbar.CrossFadeHelper;

import java.io.PrintWriter;
@@ -110,6 +112,11 @@ public class KeyguardStatusView extends GridLayout {
        }
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        return TouchLogger.logDispatchTouch(TAG, ev, super.dispatchTouchEvent(ev));
    }

    public void dump(PrintWriter pw, String[] args) {
        pw.println("KeyguardStatusView:");
        pw.println("  mDarkAmount: " + mDarkAmount);
+5 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
import com.android.systemui.shade.TouchLogger
import kotlin.math.pow
import kotlin.math.sqrt
import kotlinx.coroutines.DisposableHandle
@@ -83,6 +84,10 @@ class LongPressHandlingView(
        interactionHandler.isLongPressHandlingEnabled = isEnabled
    }

    override fun dispatchTouchEvent(event: MotionEvent): Boolean {
        return TouchLogger.logDispatchTouch("long_press", event, super.dispatchTouchEvent(event))
    }

    @SuppressLint("ClickableViewAccessibility")
    override fun onTouchEvent(event: MotionEvent?): Boolean {
        return interactionHandler.onTouchEvent(event?.toModel())
+8 −0
Original line number Diff line number Diff line
@@ -120,6 +120,14 @@ public class LogModule {
        return factory.create("ShadeLog", 500, false);
    }

    /** Provides a logging buffer for Shade messages. */
    @Provides
    @SysUISingleton
    @ShadeTouchLog
    public static LogBuffer provideShadeTouchLogBuffer(LogBufferFactory factory) {
        return factory.create("ShadeTouchLog", 500, false);
    }

    /** Provides a logging buffer for all logs related to managing notification sections. */
    @Provides
    @SysUISingleton
+33 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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.log.dagger;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import com.android.systemui.log.LogBuffer;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;

import javax.inject.Qualifier;

/** A {@link LogBuffer} for tracking touches in various shade child views. */
@Qualifier
@Documented
@Retention(RUNTIME)
public @interface ShadeTouchLog {
}
Loading