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

Commit c5b7edfa authored by Edgar Wang's avatar Edgar Wang Committed by Android (Google) Code Review
Browse files

Revert "Support gray out preference icon when the preference is restricted"

This reverts commit e586c04e.

Reason for revert: b/300450770

Change-Id: I9c9f02dab7dba4d849384bff83a656a983e240f5
parent e586c04e
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -133,12 +133,6 @@ public class PrimarySwitchPreference extends RestrictedPreference {
        }
    }

    @Override
    public void setEnabled(boolean enabled) {
        super.setEnabled(enabled);
        setSwitchEnabled(enabled);
    }

    @VisibleForTesting(otherwise = VisibleForTesting.NONE)
    public boolean isSwitchEnabled() {
        return mEnableSwitch;
+4 −7
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.UserHandle;
import android.text.TextUtils;
@@ -230,15 +229,13 @@ public class RestrictedPreferenceHelper {
    }

    private void updateDisabledState() {
        boolean isEnabled = !(mDisabledByAdmin || mDisabledByAppOps);
        if (!(mPreference instanceof RestrictedTopLevelPreference)) {
            mPreference.setEnabled(isEnabled);
            mPreference.setEnabled(!(mDisabledByAdmin || mDisabledByAppOps));
        }

        Drawable icon = mPreference.getIcon();
        if (!isEnabled && icon != null) {
            Utils.convertToGrayscale(icon);
            mPreference.setIcon(icon);
        if (mPreference instanceof PrimarySwitchPreference) {
            ((PrimarySwitchPreference) mPreference)
                    .setSwitchEnabled(!(mDisabledByAdmin || mDisabledByAppOps));
        }
    }
}
+0 −10
Original line number Diff line number Diff line
@@ -700,14 +700,4 @@ public class Utils {
        return false;
    }

    /**
     *  Convert a drawable to grayscale drawable
     */
    public static void convertToGrayscale(@NonNull Drawable drawable) {
        ColorMatrix matrix = new ColorMatrix();
        matrix.setSaturation(0.0f);

        ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix);
        drawable.setColorFilter(filter);
    }
}