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

Commit 0f66a4cc authored by Selim Cinek's avatar Selim Cinek
Browse files

Moving Row inflation to the background too

Previously only the contentview inflation was on the
background, now the inflation of the row is too.

Test: runtest systemui
Bug: 34888292
Change-Id: I3adc6b3311217421c9de5c37794397b8a3fd665d
parent 01d3da63
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-Iaidl-files-unde

LOCAL_STATIC_ANDROID_LIBRARIES := \
    SystemUIPluginLib \
    android-support-v4 \
    android-support-v7-recyclerview \
    android-support-v7-preference \
    android-support-v7-appcompat \
+24 −0
Original line number Diff line number Diff line
/*
 * 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.statusbar;

/**
 * An interface that allows aborting existing operations.
 */
public interface Abortable {
    void abort();
}
+6 −8
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import android.service.notification.NotificationListenerService.RankingMap;
import android.service.notification.SnoozeCriterion;
import android.service.notification.StatusBarNotification;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.view.View;
import android.widget.ImageView;
import android.widget.RemoteViews;
@@ -43,7 +42,6 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.util.NotificationColorUtil;
import com.android.systemui.statusbar.notification.InflationException;
import com.android.systemui.statusbar.notification.NotificationInflater;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.policy.HeadsUpManager;
@@ -86,7 +84,7 @@ public class NotificationData {
        public List<SnoozeCriterion> snoozeCriteria;
        private int mCachedContrastColor = COLOR_INVALID;
        private int mCachedContrastColorIsFor = COLOR_INVALID;
        private NotificationInflater.AsyncInflationTask mRunningTask = null;
        private Abortable mRunningTask = null;

        public Entry(StatusBarNotification n) {
            this.key = n.getKey();
@@ -218,17 +216,17 @@ public class NotificationData {
        /**
         * Abort all existing inflation tasks
         */
        public void abortInflation() {
        public void abortTask() {
            if (mRunningTask != null) {
                mRunningTask.abort();
                mRunningTask = null;
            }
        }

        public void setInflationTask(NotificationInflater.AsyncInflationTask asyncInflationTask) {
        public void setInflationTask(Abortable abortableTask) {
            // abort any existing inflation
            abortInflation();
            mRunningTask = asyncInflationTask;
            abortTask();
            mRunningTask = abortableTask;
        }

        public void onInflationTaskFinished() {
@@ -236,7 +234,7 @@ public class NotificationData {
        }

        @VisibleForTesting
        public AsyncTask getRunningTask() {
        public Abortable getRunningTask() {
            return mRunningTask;
        }
    }
+2 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.service.notification.StatusBarNotification;
import android.view.LayoutInflater;
@@ -107,7 +108,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
        mHorizSpaceForIcon = res.getDimensionPixelSize(R.dimen.notification_menu_icon_size);
        mVertSpaceForIcons = res.getDimensionPixelSize(R.dimen.notification_min_height);
        mIconPadding = res.getDimensionPixelSize(R.dimen.notification_menu_icon_padding);
        mHandler = new Handler();
        mHandler = new Handler(Looper.getMainLooper());
        mMenuItems = new ArrayList<>();
        mSnoozeItem = createSnoozeItem(context);
        mInfoItem = createInfoItem(context);
+3 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.view.View;
import android.widget.RemoteViews;

import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.statusbar.Abortable;
import com.android.systemui.statusbar.ExpandableNotificationRow;
import com.android.systemui.statusbar.NotificationContentView;
import com.android.systemui.statusbar.NotificationData;
@@ -475,7 +476,7 @@ public class NotificationInflater {
    }

    public static class AsyncInflationTask extends AsyncTask<Void, Void, InflationProgress>
            implements InflationCallback {
            implements InflationCallback, Abortable {

        private final StatusBarNotification mSbn;
        private final Context mContext;
@@ -556,6 +557,7 @@ public class NotificationInflater {
                    new InflationException("Couldn't inflate contentViews" + e));
        }

        @Override
        public void abort() {
            cancel(true /* mayInterruptIfRunning */);
            if (mCancellationSignal != null) {
Loading