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

Commit ba23953f authored by d34d's avatar d34d Committed by Gerrit Code Review
Browse files

CustomQSTile: Check for bad identifier in getTitle()

If any app that uses the system shared user id publishes a custom
QS tile it can cause SystemUI to crash because getTitle() can return
a resource ID of 0.  This patch checks the resId before returning
it and if it is 0, it returns the default.

Change-Id: Iff4d094e7556ad1eb89762ac8afb3b7078a557e5
parent c75bedec
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -150,9 +150,12 @@ public class CustomQSTile extends QSTile<QSTile.State> {

        public int getTitle() {
            if (isDynamicTile()) {
                return mContext.getResources().getIdentifier(
                int resId = mContext.getResources().getIdentifier(
                        String.format("dynamic_qs_tile_%s_label", mTile.getTag()),
                            "string", mContext.getPackageName());
                if (resId != 0) {
                    return resId;
                }
            }
            return R.string.quick_settings_custom_tile_detail_title;
        }