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

Commit f9239b3a authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Remove app ops indicators from notifications"

parents ddd77972 3a72daad
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -5187,19 +5187,11 @@ public class Notification implements Parcelable
            bindHeaderChronometerAndTime(contentView, p);
            bindProfileBadge(contentView, p);
            bindAlertedIcon(contentView, p);
            bindActivePermissions(contentView, p);
            bindFeedbackIcon(contentView, p);
            bindExpandButton(contentView, p);
            mN.mUsesStandardHeader = true;
        }

        private void bindActivePermissions(RemoteViews contentView, StandardTemplateParams p) {
            int color = getNeutralColor(p);
            contentView.setDrawableTint(R.id.camera, false, color, PorterDuff.Mode.SRC_ATOP);
            contentView.setDrawableTint(R.id.mic, false, color, PorterDuff.Mode.SRC_ATOP);
            contentView.setDrawableTint(R.id.overlay, false, color, PorterDuff.Mode.SRC_ATOP);
        }

        private void bindFeedbackIcon(RemoteViews contentView, StandardTemplateParams p) {
            int color = getNeutralColor(p);
            contentView.setDrawableTint(R.id.feedback, false, color, PorterDuff.Mode.SRC_ATOP);
+2 −22
Original line number Diff line number Diff line
@@ -52,14 +52,12 @@ public class NotificationHeaderView extends ViewGroup {
    private View mHeaderText;
    private View mSecondaryHeaderText;
    private OnClickListener mExpandClickListener;
    private OnClickListener mAppOpsListener;
    private OnClickListener mFeedbackListener;
    private HeaderTouchListener mTouchListener = new HeaderTouchListener();
    private LinearLayout mTransferChip;
    private NotificationExpandButton mExpandButton;
    private CachingIconView mIcon;
    private View mProfileBadge;
    private View mAppOps;
    private View mFeedbackIcon;
    private boolean mExpanded;
    private boolean mShowExpandButtonAtEnd;
@@ -117,7 +115,6 @@ public class NotificationHeaderView extends ViewGroup {
        mExpandButton = findViewById(com.android.internal.R.id.expand_button);
        mIcon = findViewById(com.android.internal.R.id.icon);
        mProfileBadge = findViewById(com.android.internal.R.id.profile_badge);
        mAppOps = findViewById(com.android.internal.R.id.app_ops);
        mFeedbackIcon = findViewById(com.android.internal.R.id.feedback);
    }

@@ -146,7 +143,6 @@ public class NotificationHeaderView extends ViewGroup {
            // Icons that should go at the end
            if ((child == mExpandButton && mShowExpandButtonAtEnd)
                    || child == mProfileBadge
                    || child == mAppOps
                    || child == mFeedbackIcon
                    || child == mTransferChip) {
                iconWidth += lp.leftMargin + lp.rightMargin + child.getMeasuredWidth();
@@ -212,7 +208,6 @@ public class NotificationHeaderView extends ViewGroup {
            // Icons that should go at the end
            if ((child == mExpandButton && mShowExpandButtonAtEnd)
                    || child == mProfileBadge
                    || child == mAppOps
                    || child == mFeedbackIcon
                    || child == mTransferChip) {
                if (end == getMeasuredWidth()) {
@@ -282,7 +277,7 @@ public class NotificationHeaderView extends ViewGroup {
    }

    private void updateTouchListener() {
        if (mExpandClickListener == null && mAppOpsListener == null && mFeedbackListener == null) {
        if (mExpandClickListener == null && mFeedbackListener == null) {
            setOnTouchListener(null);
            return;
        }
@@ -290,14 +285,6 @@ public class NotificationHeaderView extends ViewGroup {
        mTouchListener.bindTouchRects();
    }

    /**
     * Sets onclick listener for app ops icons.
     */
    public void setAppOpsOnClickListener(OnClickListener l) {
        mAppOpsListener = l;
        updateTouchListener();
    }

    /**
     * Sets onclick listener for feedback icon.
     */
@@ -394,7 +381,6 @@ public class NotificationHeaderView extends ViewGroup {

        private final ArrayList<Rect> mTouchRects = new ArrayList<>();
        private Rect mExpandButtonRect;
        private Rect mAppOpsRect;
        private Rect mFeedbackRect;
        private int mTouchSlop;
        private boolean mTrackGesture;
@@ -408,9 +394,7 @@ public class NotificationHeaderView extends ViewGroup {
            mTouchRects.clear();
            addRectAroundView(mIcon);
            mExpandButtonRect = addRectAroundView(mExpandButton);
            mAppOpsRect = addRectAroundView(mAppOps);
            mFeedbackRect = addRectAroundView(mFeedbackIcon);
            setTouchDelegate(new TouchDelegate(mAppOpsRect, mAppOps));
            addWidthRect();
            mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
        }
@@ -471,11 +455,7 @@ public class NotificationHeaderView extends ViewGroup {
                    break;
                case MotionEvent.ACTION_UP:
                    if (mTrackGesture) {
                        if (mAppOps.isVisibleToUser() && (mAppOpsRect.contains((int) x, (int) y)
                                || mAppOpsRect.contains((int) mDownX, (int) mDownY))) {
                            mAppOps.performClick();
                            return true;
                        } else if (mFeedbackIcon.isVisibleToUser()
                        if (mFeedbackIcon.isVisibleToUser()
                                && (mFeedbackRect.contains((int) x, (int) y))
                                || mFeedbackRect.contains((int) mDownX, (int) mDownY)) {
                            mFeedbackIcon.performClick();
+1 −47
Original line number Diff line number Diff line
@@ -168,8 +168,6 @@ public class ConversationLayout extends FrameLayout
    private int mFacePileProtectionWidthExpanded;
    private boolean mImportantConversation;
    private TextView mUnreadBadge;
    private ViewGroup mAppOps;
    private Rect mAppOpsTouchRect = new Rect();
    private View mFeedbackIcon;
    private float mMinTouchSize;
    private Icon mConversationIcon;
@@ -214,7 +212,6 @@ public class ConversationLayout extends FrameLayout
        mConversationIconView = findViewById(R.id.conversation_icon);
        mConversationIconContainer = findViewById(R.id.conversation_icon_container);
        mIcon = findViewById(R.id.icon);
        mAppOps = findViewById(com.android.internal.R.id.app_ops);
        mFeedbackIcon = findViewById(com.android.internal.R.id.feedback);
        mMinTouchSize = 48 * getResources().getDisplayMetrics().density;
        mImportanceRingView = findViewById(R.id.conversation_icon_badge_ring);
@@ -1174,43 +1171,6 @@ public class ConversationLayout extends FrameLayout
            });
        }
        mTouchDelegate.clear();
        if (mAppOps.getWidth() > 0) {

            // Let's increase the touch size of the app ops view if it's here
            mAppOpsTouchRect.set(
                    mAppOps.getLeft(),
                    mAppOps.getTop(),
                    mAppOps.getRight(),
                    mAppOps.getBottom());
            for (int i = 0; i < mAppOps.getChildCount(); i++) {
                View child = mAppOps.getChildAt(i);
                if (child.getVisibility() == GONE) {
                    continue;
                }
                // Make sure each child has at least a minTouchSize touch target around it
                float childTouchLeft = child.getLeft() + child.getWidth() / 2.0f
                        - mMinTouchSize / 2.0f;
                float childTouchRight = childTouchLeft + mMinTouchSize;
                mAppOpsTouchRect.left = (int) Math.min(mAppOpsTouchRect.left,
                        mAppOps.getLeft() + childTouchLeft);
                mAppOpsTouchRect.right = (int) Math.max(mAppOpsTouchRect.right,
                        mAppOps.getLeft() + childTouchRight);
            }

            // Increase the height
            int heightIncrease = 0;
            if (mAppOpsTouchRect.height() < mMinTouchSize) {
                heightIncrease = (int) Math.ceil((mMinTouchSize - mAppOpsTouchRect.height())
                        / 2.0f);
            }
            mAppOpsTouchRect.inset(0, -heightIncrease);

            getRelativeTouchRect(mAppOpsTouchRect, mAppOps);

            // Extend the size of the app opps to be at least 48dp
            mTouchDelegate.add(new TouchDelegate(mAppOpsTouchRect, mAppOps));

        }
        if (mFeedbackIcon.getVisibility() == VISIBLE) {
            updateFeedbackIconMargins();
            float width = Math.max(mMinTouchSize, mFeedbackIcon.getWidth());
@@ -1240,13 +1200,7 @@ public class ConversationLayout extends FrameLayout

    private void updateFeedbackIconMargins() {
        MarginLayoutParams lp = (MarginLayoutParams) mFeedbackIcon.getLayoutParams();
        if (mAppOps.getWidth() == 0) {
        lp.setMarginStart(mNotificationHeaderSeparatingMargin);
        } else {
            float width = Math.max(mMinTouchSize, mFeedbackIcon.getWidth());
            int horizontalMargin = (int) ((width - mFeedbackIcon.getWidth()) / 2);
            lp.setMarginStart(horizontalMargin);
        }
        mFeedbackIcon.setLayoutParams(lp);
    }

+0 −37
Original line number Diff line number Diff line
@@ -160,43 +160,6 @@
        android:visibility="gone"
        android:contentDescription="@string/notification_work_profile_content_description"
        />
    <LinearLayout
        android:id="@+id/app_ops"
        android:layout_height="match_parent"
        android:layout_width="wrap_content"
        android:layout_marginStart="6dp"
        android:background="?android:selectableItemBackgroundBorderless"
        android:orientation="horizontal">
        <ImageView
            android:id="@+id/camera"
            android:layout_width="?attr/notificationHeaderIconSize"
            android:layout_height="?attr/notificationHeaderIconSize"
            android:src="@drawable/ic_camera"
            android:visibility="gone"
            android:focusable="false"
            android:contentDescription="@string/notification_appops_camera_active"
            />
        <ImageView
            android:id="@+id/mic"
            android:layout_width="?attr/notificationHeaderIconSize"
            android:layout_height="?attr/notificationHeaderIconSize"
            android:src="@drawable/ic_mic"
            android:layout_marginStart="4dp"
            android:visibility="gone"
            android:focusable="false"
            android:contentDescription="@string/notification_appops_microphone_active"
            />
        <ImageView
            android:id="@+id/overlay"
            android:layout_width="?attr/notificationHeaderIconSize"
            android:layout_height="?attr/notificationHeaderIconSize"
            android:src="@drawable/ic_alert_window_layer"
            android:layout_marginStart="4dp"
            android:visibility="gone"
            android:focusable="false"
            android:contentDescription="@string/notification_appops_overlay_active"
            />
    </LinearLayout>
    <include
        layout="@layout/notification_material_media_transfer_action"
        android:id="@+id/media_seamless"
+0 −5
Original line number Diff line number Diff line
@@ -74,11 +74,6 @@ public interface NotificationMenuRowPlugin extends Plugin {
     */
    public MenuItem getLongpressMenuItem(Context context);

    /**
     * @return the {@link MenuItem} to display when app ops icons are pressed.
     */
    public MenuItem getAppOpsMenuItem(Context context);

    /**
     * @return the {@link MenuItem} to display when feedback icon is pressed.
     */
Loading