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

Commit 12302cb4 authored by Raj Yengisetty's avatar Raj Yengisetty Committed by Stephen Bird
Browse files

ProtectedApps: Fix protecting shortcuts with no ComponentNames

Repro:
 - Create a shortcut using the contacts widget
 - Add to a folder and open app protection screen
 - Observe: Trebuchet force closes

Change-Id: I76f6a8b1d024beb36fa804bb3a866913edc335c1
(cherry picked from commit d8bdb0ee)
(cherry picked from commit 42427c9b)
parent 641637f9
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -297,8 +297,10 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
    public void modifyProtectedApps(boolean protect) {
        ArrayList<ComponentName> components = new ArrayList<ComponentName>();
        for (Pair<ComponentName, CharSequence> item : getComponents()) {
            if (item.first != null) {
                components.add(item.first);
            }
        }

        Intent intent = new Intent();
        intent.setAction(PROTECTED_ACTION);
+7 −3
Original line number Diff line number Diff line
@@ -227,7 +227,10 @@ public class HiddenFolderFragment extends Fragment {

            viewHolder.title.setText(app.title);

            Drawable icon = mIcons.get(app.componentName.getPackageName());
            Drawable icon = null;
            if (app.componentName != null) {
                icon = mIcons.get(app.componentName.getPackageName());
            }
            viewHolder.icon.setImageDrawable(icon != null ? icon : mDefaultImg);
            viewHolder.remove.setOnClickListener(new OnClickListener() {
                @Override
@@ -284,8 +287,9 @@ public class HiddenFolderFragment extends Fragment {
            protected Void doInBackground(AppEntry... apps) {
                for (AppEntry app : apps) {
                    try {
                        if (mIcons.containsKey(app.componentName
                                .getPackageName())) {
                        // Widget icons do not have a
                        if (app.componentName == null ||
                                mIcons.containsKey(app.componentName.getPackageName())) {
                            continue;
                        }
                        Drawable icon = mPackageManager