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

Commit c5dd4e50 authored by Soonil Nagarkar's avatar Soonil Nagarkar
Browse files

Fix control flow bug in preference controller

BUG: 118908907
Test: manual
Change-Id: I5300309a13833e278902c75090c9f7de43d6e2b7
parent ed8b0aeb
Loading
Loading
Loading
Loading
+17 −23
Original line number Diff line number Diff line
@@ -86,12 +86,10 @@ public class LocationFooterPreferenceController extends LocationBasePreferenceCo
                                .getResourcesForApplication(data.applicationInfo)
                                .getString(data.footerStringRes);
            } catch (NameNotFoundException exception) {
                if (Log.isLoggable(TAG, Log.WARN)) {
                Log.w(
                        TAG,
                        "Resources not found for application "
                                + data.applicationInfo.packageName);
                }
                continue;
            }
            footerPreference.setTitle(footerString);
@@ -152,11 +150,11 @@ public class LocationFooterPreferenceController extends LocationBasePreferenceCo
                mPackageManager.queryBroadcastReceivers(
                        INJECT_INTENT, PackageManager.GET_META_DATA);
        if (resolveInfos == null) {
            if (Log.isLoggable(TAG, Log.ERROR)) {
            Log.e(TAG, "Unable to resolve intent " + INJECT_INTENT);
            return Collections.emptyList();
        }
        } else if (Log.isLoggable(TAG, Log.DEBUG)) {

        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "Found broadcast receivers: " + resolveInfos);
        }

@@ -167,30 +165,26 @@ public class LocationFooterPreferenceController extends LocationBasePreferenceCo

            // If a non-system app tries to inject footer, ignore it
            if ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
                if (Log.isLoggable(TAG, Log.WARN)) {
                Log.w(TAG, "Ignoring attempt to inject footer from app not in system image: "
                        + resolveInfo);
                continue;
            }
            }

            // Get the footer text resource id from broadcast receiver's metadata
            if (activityInfo.metaData == null) {
                if (Log.isLoggable(TAG, Log.DEBUG)) {
                    Log.d(TAG, "No METADATA in broadcast receiver " + activityInfo.name);
                    continue;
                }
                continue;
            }

            final int footerTextRes =
                    activityInfo.metaData.getInt(LocationManager.METADATA_SETTINGS_FOOTER_STRING);
            if (footerTextRes == 0) {
                if (Log.isLoggable(TAG, Log.WARN)) {
                Log.w(
                        TAG,
                        "No mapping of integer exists for "
                                + LocationManager.METADATA_SETTINGS_FOOTER_STRING);
                }
                continue;
            }
            footerDataList.add(