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

Commit 6498f962 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Revert "Fix jank when switching themes"

This reverts commit e5d0b9dd.

Fixes crashloop with lock pattern

Change-Id: I3721444c91e2be625c59ec3e6ba14f1080badc07
Fixes: 63980375
parent 149ff697
Loading
Loading
Loading
Loading
+5 −25
Original line number Diff line number Diff line
@@ -29,9 +29,7 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.colorextraction.types.ExtractionType;
import com.android.internal.colorextraction.types.Tonal;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;

/**
 * Class to process wallpaper colors and generate a tonal palette based on them.
@@ -46,7 +44,7 @@ public class ColorExtractor implements WallpaperManager.OnColorsChangedListener
    private static final String TAG = "ColorExtractor";

    private final SparseArray<GradientColors[]> mGradientColors;
    private final ArrayList<WeakReference<OnColorsChangedListener>> mOnColorsChangedListeners;
    private final ArrayList<OnColorsChangedListener> mOnColorsChangedListeners;
    private final Context mContext;
    private final ExtractionType mExtractionType;
    private WallpaperColors mSystemColors;
@@ -169,19 +167,10 @@ public class ColorExtractor implements WallpaperManager.OnColorsChangedListener
    }

    protected void triggerColorsChanged(int which) {
        ArrayList<WeakReference<OnColorsChangedListener>> references =
                new ArrayList<>(mOnColorsChangedListeners);
        final int size = references.size();
        for (int i = 0; i < size; i++) {
            final WeakReference<OnColorsChangedListener> weakReference = references.get(i);
            final OnColorsChangedListener listener = weakReference.get();
            if (listener == null) {
                mOnColorsChangedListeners.remove(weakReference);
            } else {
        for (OnColorsChangedListener listener: mOnColorsChangedListeners) {
            listener.onColorsChanged(this, which);
        }
    }
    }

    private void extractInto(WallpaperColors inWallpaperColors,
            GradientColors outGradientColorsNormal, GradientColors outGradientColorsDark,
@@ -198,20 +187,11 @@ public class ColorExtractor implements WallpaperManager.OnColorsChangedListener
    }

    public void addOnColorsChangedListener(@NonNull OnColorsChangedListener listener) {
        mOnColorsChangedListeners.add(new WeakReference<>(listener));
        mOnColorsChangedListeners.add(listener);
    }

    public void removeOnColorsChangedListener(@NonNull OnColorsChangedListener listener) {
        ArrayList<WeakReference<OnColorsChangedListener>> references =
                new ArrayList<>(mOnColorsChangedListeners);
        final int size = references.size();
        for (int i = 0; i < size; i++) {
            final WeakReference<OnColorsChangedListener> weakReference = references.get(i);
            if (weakReference.get() == listener) {
                mOnColorsChangedListeners.remove(weakReference);
                break;
            }
        }
        mOnColorsChangedListeners.remove(listener);
    }

    public static class GradientColors {
+1 −1
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@
        android:icon="@drawable/icon"
        android:process="com.android.systemui"
        android:supportsRtl="true"
        android:theme="@style/Theme.SystemUI"
        android:theme="@style/systemui_theme"
        android:defaultToDeviceProtectedStorage="true"
        android:directBootAware="true">
        <!-- Keep theme in sync with SystemUIApplication.onCreate().
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@
         android:layout_height="wrap_content"
         android:layout_width="280dp"
         android:layout_gravity="center_horizontal"
         android:theme="?attr/passwordStyle"
         android:theme="@style/PasswordTheme"
         >

         <EditText android:id="@+id/passwordEntry"
+0 −2
Original line number Diff line number Diff line
@@ -41,6 +41,4 @@
    <declare-styleable name="CarrierText">
        <attr name="allCaps" format="boolean" />
    </declare-styleable>

    <attr name="passwordStyle" format="reference" />
</resources>
+1 −7
Original line number Diff line number Diff line
@@ -60,13 +60,7 @@
        <item name="android:layout_gravity">center_horizontal|bottom</item>
    </style>

    <style name="PasswordTheme" parent="Theme.SystemUI">
        <item name="android:textColor">?attr/wallpaperTextColor</item>
        <item name="android:colorControlNormal">?attr/wallpaperTextColor</item>
        <item name="android:colorControlActivated">?attr/wallpaperTextColor</item>
    </style>

    <style name="PasswordTheme.Light" parent="Theme.SystemUI.Light">
    <style name="PasswordTheme" parent="systemui_theme">
        <item name="android:textColor">?attr/wallpaperTextColor</item>
        <item name="android:colorControlNormal">?attr/wallpaperTextColor</item>
        <item name="android:colorControlActivated">?attr/wallpaperTextColor</item>
Loading