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

Commit 6906c957 authored by Salvador Martinez's avatar Salvador Martinez Committed by Android (Google) Code Review
Browse files

Merge "Memory Usage by apps no longer shows empty icon"

parents c747340f 47d00cf1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.content.pm.PackageManager;
import android.os.Parcel;
import android.os.Parcelable;

import android.util.Log;
import com.android.settings.R;
import com.android.settings.Utils;

@@ -127,6 +128,7 @@ public class ProcStatsPackageEntry implements Parcelable {
                mUiLabel = mUiTargetApp.loadLabel(pm).toString();
            }
        } catch (PackageManager.NameNotFoundException e) {
            Log.d(TAG, "could not find package: " + mPackage);
        }
    }

+8 −2
Original line number Diff line number Diff line
@@ -22,9 +22,11 @@ import android.graphics.drawable.ColorDrawable;
import android.text.TextUtils;
import android.text.format.Formatter;

import android.util.Log;
import com.android.settings.AppProgressPreference;

public class ProcessStatsPreference extends AppProgressPreference {
    static final String TAG = "ProcessStatsPreference";

    private ProcStatsPackageEntry mEntry;

@@ -35,11 +37,15 @@ public class ProcessStatsPreference extends AppProgressPreference {
    public void init(ProcStatsPackageEntry entry, PackageManager pm, double maxMemory,
            double weightToRam, double totalScale, boolean avg) {
        mEntry = entry;
        setTitle(TextUtils.isEmpty(entry.mUiLabel) ? entry.mPackage : entry.mUiLabel);
        String title = TextUtils.isEmpty(entry.mUiLabel) ? entry.mPackage : entry.mUiLabel;
        setTitle(title);
        if (TextUtils.isEmpty(title)) {
            Log.d(TAG, "PackageEntry contained no package name or uiLabel");
        }
        if (entry.mUiTargetApp != null) {
            setIcon(entry.mUiTargetApp.loadIcon(pm));
        } else {
            setIcon(new ColorDrawable(0));
            setIcon(pm.getDefaultActivityIcon());
        }
        boolean statsForeground = entry.mRunWeight > entry.mBgWeight;
        double amount = avg ? (statsForeground ? entry.mRunWeight : entry.mBgWeight) * weightToRam