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

Commit 11b06ca8 authored by Felipe Leme's avatar Felipe Leme
Browse files

Fixed AccessPreference listener.

When an app is blacklisted, its switch toggle is disabled, but previous
the onClick() method was still being called, which would launch the data
usage screen but also call setIsWhitelist().

BUG: 27481520
Change-Id: Id8df3d65eee286d1aecb4ae2a0417d6932d91441
parent c2ef27fa
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -227,19 +227,20 @@ public class UnrestrictedDataAccess extends SettingsPreferenceFragment
            if (mEntry.icon != null) {
                setIcon(mEntry.icon);
            }
            setOnPreferenceClickListener( new OnPreferenceClickListener() {
        }

        @Override
                public boolean onPreferenceClick(Preference pref) {
        protected void onClick() {
            if (mState.isDataSaverBlacklisted) {
                // app is blacklisted, launch App Data Usage screen
                InstalledAppDetails.startAppInfoFragment(AppDataUsage.class,
                                context.getString(R.string.app_data_usage),
                        getContext().getString(R.string.app_data_usage),
                        UnrestrictedDataAccess.this,
                        mEntry);
                        return false;
            } else {
                // app is not blacklisted, let superclass handle toggle switch
                super.onClick();
            }
                    return true;
                }});
        }

        // Sets UI state based on whitelist/blacklist status.