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

Commit c335b5ba authored by Alex Shabalin's avatar Alex Shabalin Committed by Alexandr Shabalin
Browse files

[Output Switcher] Remove unnecessary calls that apply icon color tint.

- `mTitleIcon.setBackgroundTintList` is a no-op since mTitleIcon doesn't have a background, the actual color tint is performed by `mTitleIcon.setImageTintList`.
- `MediaSwitchingCongtroller#setColorFilter` was added to add a color tint to the device icon, but it's useless now because `mTitleIcon.setImageTintList` does the exact same thing.

Bug: 387570618
Flag: EXEMPT bugfix
Test: Verified on a physical device.
Change-Id: I81d934e0c7ee9c0dd227f017e942917ace1edc0a
parent 6b4d2a3c
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -234,8 +234,6 @@ public abstract class MediaOutputBaseAdapter extends
                    (ViewGroup.MarginLayoutParams) mItemLayout.getLayoutParams();
            params.rightMargin = showEndTouchArea ? mController.getItemMarginEndSelectable()
                    : mController.getItemMarginEndDefault();
            mTitleIcon.setBackgroundTintList(
                    ColorStateList.valueOf(mController.getColorItemContent()));
        }

        void setTwoLineLayout(MediaDevice device, boolean bFocused, boolean showSeekBar,
+0 −11
Original line number Diff line number Diff line
@@ -37,9 +37,6 @@ import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.media.AudioManager;
@@ -535,17 +532,9 @@ public class MediaSwitchingController
            // Use default Bluetooth device icon to handle getIcon() is null case.
            drawable = mContext.getDrawable(com.android.internal.R.drawable.ic_bt_headphones_a2dp);
        }
        if (!(drawable instanceof BitmapDrawable)) {
            setColorFilter(drawable, isActiveItem(device));
        }
        return BluetoothUtils.createIconWithDrawable(drawable);
    }

    void setColorFilter(Drawable drawable, boolean isActive) {
        drawable.setColorFilter(new PorterDuffColorFilter(mColorItemContent,
                PorterDuff.Mode.SRC_IN));
    }

    boolean isActiveItem(MediaDevice device) {
        boolean isConnected = mLocalMediaManager.getCurrentConnectedDevice().getId().equals(
                device.getId());
+0 −8
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.media.AudioDeviceAttributes;
@@ -1285,13 +1284,6 @@ public class MediaSwitchingControllerTest extends SysuiTestCase {
                .isInstanceOf(IconCompat.class);
    }

    @Test
    public void setColorFilter_setColorFilterToDrawable() {
        mMediaSwitchingController.setColorFilter(mDrawable, true);

        verify(mDrawable).setColorFilter(any(PorterDuffColorFilter.class));
    }

    @Test
    public void resetGroupMediaDevices_clearGroupDevices() {
        final MediaDevice selectedMediaDevice1 = mock(MediaDevice.class);