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

Commit 8844bef9 authored by Mady Mellor's avatar Mady Mellor
Browse files

Remove unused code

* we don't need app icon in bubble expanded view (used to have it when
  there was a permission dialog)
* we can query Bubble for the app name, no need to pass it through

Test: manual - it compiles & posting a bubble and expanding it work fine
Change-Id: I2e7cd91e3ba84a7294c2456dfe5e7f26e324bbcb
parent 5d8707ad
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ class Bubble {

        mExpandedView = (BubbleExpandedView) inflater.inflate(
                R.layout.bubble_expanded_view, stackView, false /* attachToRoot */);
        mExpandedView.setBubble(this, stackView, mAppName);
        mExpandedView.setBubble(this, stackView);

        mInflated = true;
    }
+3 −24
Original line number Diff line number Diff line
@@ -31,15 +31,12 @@ import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.Insets;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ShapeDrawable;
import android.os.RemoteException;
import android.service.notification.StatusBarNotification;
@@ -102,9 +99,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
    private int mExpandedViewTouchSlop;

    private Bubble mBubble;
    private PackageManager mPm;
    private String mAppName;
    private Drawable mAppIcon;

    private BubbleController mBubbleController = Dependency.get(BubbleController.class);
    private WindowManager mWindowManager;
@@ -212,7 +207,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
    public BubbleExpandedView(Context context, AttributeSet attrs, int defStyleAttr,
            int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        mPm = context.getPackageManager();
        mDisplaySize = new Point();
        mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        // Get the real size -- this includes screen decorations (notches, statusbar, navbar).
@@ -350,29 +344,14 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
    /**
     * Sets the bubble used to populate this view.
     */
    public void setBubble(Bubble bubble, BubbleStackView stackView, String appName) {
    public void setBubble(Bubble bubble, BubbleStackView stackView) {
        if (DEBUG_BUBBLE_EXPANDED_VIEW) {
            Log.d(TAG, "setBubble: bubble=" + (bubble != null ? bubble.getKey() : "null"));
        }

        mStackView = stackView;
        mBubble = bubble;
        mAppName = appName;
        mAppName = bubble.getAppName();

        try {
            ApplicationInfo info = mPm.getApplicationInfo(
                    bubble.getPackageName(),
                    PackageManager.MATCH_UNINSTALLED_PACKAGES
                            | PackageManager.MATCH_DISABLED_COMPONENTS
                            | PackageManager.MATCH_DIRECT_BOOT_UNAWARE
                            | PackageManager.MATCH_DIRECT_BOOT_AWARE);
            mAppIcon = mPm.getApplicationIcon(info);
        } catch (PackageManager.NameNotFoundException e) {
            // Do nothing.
        }
        if (mAppIcon == null) {
            mAppIcon = mPm.getDefaultActivityIcon();
        }
        applyThemeAttrs();
        showSettingsIcon();
        updateExpandedView();