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

Commit 6b191200 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Handle invalid permission group icon

In this case don't set an icon at all.

Test: atest PermissionsHostTests
Change-Id: Icaa47d50e0f62a159765b155b9120b5b73eb0f7c
Fixes: 73112239
parent 89480455
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -397,11 +397,17 @@ public class GrantPermissionsActivity extends OverlayTouchActivity
                    // Fallback to system.
                    resources = Resources.getSystem();
                }
                int icon = groupState.mGroup.getIconResId();

                Icon icon;
                try {
                    icon = Icon.createWithResource(resources, groupState.mGroup.getIconResId());
                } catch (Resources.NotFoundException e) {
                    Log.e(LOG_TAG, "Cannot load icon for group" + groupState.mGroup.getName(), e);
                    icon = null;
                }

                mViewHandler.updateUi(groupState.mGroup.getName(), groupCount, currentIndex,
                        Icon.createWithResource(resources, icon), message,
                        groupState.mGroup.isUserSet());
                        icon, message, groupState.mGroup.isUserSet());
                return true;
            }

+3 −1
Original line number Diff line number Diff line
@@ -312,7 +312,9 @@ public class GrantPermissionsViewHandlerImpl implements GrantPermissionsViewHand
    }

    private void updateDescription() {
        if (mGroupIcon != null) {
            mIconView.setImageDrawable(mGroupIcon.loadDrawable(mActivity));
        }
        mMessageView.setText(mGroupMessage);
    }

+5 −1
Original line number Diff line number Diff line
@@ -84,7 +84,11 @@ public final class GrantPermissionsViewHandlerImpl implements GrantPermissionsVi
        mGroupName = groupName;

        mMessageView.setText(message);

        if (icon != null) {
            mIconView.setImageIcon(icon);
        }

        mHardDenyButton.setVisibility(showDoNotAsk ? View.VISIBLE : View.GONE);
        if (groupCount > 1) {
            mCurrentGroupView.setVisibility(View.VISIBLE);