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

Commit 6e43bcfb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add logging to content inflation pipeline"

parents dc68d926 c1f04488
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -26,26 +26,23 @@ import android.content.Context
import android.content.DialogInterface
import android.graphics.Color
import android.graphics.PixelFormat
import android.graphics.drawable.Drawable
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable
import android.util.Log
import android.view.Gravity
import android.view.View
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.view.Window
import android.view.WindowInsets.Type
import android.view.WindowInsets.Type.statusBars
import android.view.WindowManager
import android.widget.TextView
import com.android.internal.annotations.VisibleForTesting

import com.android.systemui.R

import javax.inject.Inject
import javax.inject.Singleton

const val TAG = "ChannelDialogController"
private const val TAG = "ChannelDialogController"

/**
 * ChannelEditorDialogController is the controller for the dialog half-shelf
@@ -149,9 +146,9 @@ class ChannelEditorDialogController @Inject constructor(
        val channels = groupList
                .flatMap { group ->
                    group.channels.asSequence().filterNot { channel ->
                        channel.isImportanceLockedByOEM
                                || channel.importance == IMPORTANCE_NONE
                                || channel.isImportanceLockedByCriticalDeviceFunction
                        channel.isImportanceLockedByOEM ||
                                channel.importance == IMPORTANCE_NONE ||
                                channel.isImportanceLockedByCriticalDeviceFunction
                    }
                }

+14 −3
Original line number Diff line number Diff line
@@ -74,11 +74,15 @@ import javax.inject.Singleton;
@Singleton
public final class NotifBindPipeline {
    private final Map<NotificationEntry, BindEntry> mBindEntries = new ArrayMap<>();
    private final NotifBindPipelineLogger mLogger;
    private BindStage mStage;

    @Inject
    NotifBindPipeline(CommonNotifCollection collection) {
    NotifBindPipeline(
            CommonNotifCollection collection,
            NotifBindPipelineLogger logger) {
        collection.addCollectionListener(mCollectionListener);
        mLogger = logger;
    }

    /**
@@ -86,6 +90,8 @@ public final class NotifBindPipeline {
     */
    public void setStage(
            BindStage stage) {
        mLogger.logStageSet(stage.getClass().getName());

        mStage = stage;
        mStage.setBindRequestListener(this::onBindRequested);
    }
@@ -96,6 +102,8 @@ public final class NotifBindPipeline {
    public void manageRow(
            @NonNull NotificationEntry entry,
            @NonNull ExpandableNotificationRow row) {
        mLogger.logManagedRow(entry.getKey());

        final BindEntry bindEntry = getBindEntry(entry);
        bindEntry.row = row;
        if (bindEntry.invalidated) {
@@ -130,6 +138,8 @@ public final class NotifBindPipeline {
     * callbacks when the run finishes. If a run is already in progress, it is restarted.
     */
    private void startPipeline(NotificationEntry entry) {
        mLogger.logStartPipeline(entry.getKey());

        if (mStage == null) {
            throw new IllegalStateException("No stage was ever set on the pipeline");
        }
@@ -147,10 +157,11 @@ public final class NotifBindPipeline {

    private void onPipelineComplete(NotificationEntry entry) {
        final BindEntry bindEntry = getBindEntry(entry);
        final Set<BindCallback> callbacks = bindEntry.callbacks;

        bindEntry.invalidated = false;
        mLogger.logFinishedPipeline(entry.getKey(), callbacks.size());

        final Set<BindCallback> callbacks = bindEntry.callbacks;
        bindEntry.invalidated = false;
        for (BindCallback cb : callbacks) {
            cb.onBindFinished(entry);
        }
+61 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.statusbar.notification.row

import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogLevel.INFO
import com.android.systemui.log.dagger.NotificationLog
import javax.inject.Inject

class NotifBindPipelineLogger @Inject constructor(
    @NotificationLog private val buffer: LogBuffer
) {
    fun logStageSet(stageName: String) {
        buffer.log(TAG, INFO, {
            str1 = stageName
        }, {
            "Stage set: $str1"
        })
    }

    fun logManagedRow(notifKey: String) {
        buffer.log(TAG, INFO, {
            str1 = notifKey
        }, {
            "Row set for notif: $str1"
        })
    }

    fun logStartPipeline(notifKey: String) {
        buffer.log(TAG, INFO, {
            str1 = notifKey
        }, {
            "Start pipeline for notif: $str1"
        })
    }

    fun logFinishedPipeline(notifKey: String, numCallbacks: Int) {
        buffer.log(TAG, INFO, {
            str1 = notifKey
            int1 = numCallbacks
        }, {
            "Finished pipeline for notif $str1 with $int1 callbacks"
        })
    }
}

private const val TAG = "NotifBindPipeline"
 No newline at end of file
+9 −0
Original line number Diff line number Diff line
@@ -157,6 +157,15 @@ public final class RowContentBindParams {
        return mViewsNeedReinflation;
    }

    @Override
    public String toString() {
        return String.format("RowContentBindParams[mContentViews=%x mDirtyContentViews=%x "
                + "mUseLowPriority=%b mUseChildInGroup=%b mUseIncreasedHeight=%b "
                + "mUseIncreasedHeadsUpHeight=%b mViewsNeedReinflation=%b]",
                mContentViews, mDirtyContentViews, mUseLowPriority, mUseChildInGroup,
                mUseIncreasedHeight, mUseIncreasedHeadsUpHeight, mViewsNeedReinflation);
    }

    /**
     * Content views that should be inflated by default for all notifications.
     */
+6 −1
Original line number Diff line number Diff line
@@ -38,13 +38,16 @@ import javax.inject.Singleton;
public class RowContentBindStage extends BindStage<RowContentBindParams> {
    private final NotificationRowContentBinder mBinder;
    private final NotifInflationErrorManager mNotifInflationErrorManager;
    private final RowContentBindStageLogger mLogger;

    @Inject
    RowContentBindStage(
            NotificationRowContentBinder binder,
            NotifInflationErrorManager errorManager) {
            NotifInflationErrorManager errorManager,
            RowContentBindStageLogger logger) {
        mBinder = binder;
        mNotifInflationErrorManager = errorManager;
        mLogger = logger;
    }

    @Override
@@ -54,6 +57,8 @@ public class RowContentBindStage extends BindStage<RowContentBindParams> {
            @NonNull StageCallback callback) {
        RowContentBindParams params = getStageParams(entry);

        mLogger.logStageParams(entry.getKey(), params.toString());

        // Resolve content to bind/unbind.
        @InflationFlag int inflationFlags = params.getContentViews();
        @InflationFlag int invalidatedFlags = params.getDirtyContentViews();
Loading