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

Commit 93748a11 authored by Winson Chung's avatar Winson Chung
Browse files

DO NOT MERGE Fixing some regressions

- Removing some legacy code with task loading
- Ensure that doze triggers are set correctly on configuration change
- Adding WCAGv2 contrast checking for deciding which foreground color to use for labels
- Bumping up the max thumbnail cache size slightly
- Fixing case where visibility state was not correct if you toggle recents too quickly

Change-Id: I5e954890d53948547842edce3c76c34d74e180a8
(cherry picked from commit e99e1009ce49caf220aa51c044ed53ac0a3b7cc6)
parent a4ab7808
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ public class Constants {
            // Enables the filtering of tasks according to their grouping
            public static final boolean EnableTaskFiltering = false;
            // Enables clipping of tasks against each other
            public static final boolean EnableTaskStackClipping = true;
            public static final boolean EnableTaskStackClipping = false;
            // Enables tapping on the TaskBar to launch the task
            public static final boolean EnableTaskBarTouchEvents = true;
            // Enables app-info pane on long-pressing the icon
+2 −2
Original line number Diff line number Diff line
@@ -458,8 +458,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        filter.addAction(ACTION_TOGGLE_RECENTS_ACTIVITY);
        filter.addAction(ACTION_START_ENTER_ANIMATION);
        registerReceiver(mServiceBroadcastReceiver, filter);

        mVisible = true;
    }

    @Override
@@ -485,6 +483,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
                }
            }, 1);
        }

        mVisible = true;
    }

    @Override
+5 −0
Original line number Diff line number Diff line
@@ -72,7 +72,12 @@ public class ReferenceCountedTrigger {

    /** Adds a runnable to the last-decrement runnables list. */
    public void addLastDecrementRunnable(Runnable r) {
        // To ensure that the last decrement always calls, we increment and decrement after setting
        // the last decrement runnable
        boolean ensureLastDecrement = (mCount == 0);
        if (ensureLastDecrement) increment();
        mLastDecRunnables.add(r);
        if (ensureLastDecrement) decrement();
    }

    /** Decrements the ref count */
+18 −21
Original line number Diff line number Diff line
@@ -16,16 +16,10 @@

package com.android.systemui.recents.misc;

import android.app.ActivityManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.ParcelFileDescriptor;
import com.android.systemui.recents.RecentsConfiguration;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

@@ -73,22 +67,25 @@ public class Utilities {
        }
    }

    /** Calculates the luminance-preserved greyscale of a given color. */
    public static int colorToGreyscale(int color) {
        return Math.round(0.2126f * Color.red(color) + 0.7152f * Color.green(color) +
                0.0722f * Color.blue(color));
    }
    /** Calculates the constrast between two colors, using the algorithm provided by the WCAG v2. */
    public static float computeContrastBetweenColors(int bg, int fg) {
        float bgR = Color.red(bg) / 255f;
        float bgG = Color.green(bg) / 255f;
        float bgB = Color.blue(bg) / 255f;
        bgR = (bgR < 0.03928f) ? bgR / 12.92f : (float) Math.pow((bgR + 0.055f) / 1.055f, 2.4f);
        bgG = (bgG < 0.03928f) ? bgG / 12.92f : (float) Math.pow((bgG + 0.055f) / 1.055f, 2.4f);
        bgB = (bgB < 0.03928f) ? bgB / 12.92f : (float) Math.pow((bgB + 0.055f) / 1.055f, 2.4f);
        float bgL = 0.2126f * bgR + 0.7152f * bgG + 0.0722f * bgB;
        
    /** Returns the ideal color to draw on top of a specified background color. */
    public static int getIdealColorForBackgroundColorGreyscale(int greyscale, int lightRes,
                                                               int darkRes) {
        return (greyscale < 128) ? lightRes : darkRes;
    }
    /** Returns the ideal drawable to draw on top of a specified background color. */
    public static Drawable getIdealResourceForBackgroundColorGreyscale(int greyscale,
                                                                       Drawable lightRes,
                                                                       Drawable darkRes) {
        return (greyscale < 128) ? lightRes : darkRes;
        float fgR = Color.red(fg) / 255f;
        float fgG = Color.green(fg) / 255f;
        float fgB = Color.blue(fg) / 255f;
        fgR = (fgR < 0.03928f) ? fgR / 12.92f : (float) Math.pow((fgR + 0.055f) / 1.055f, 2.4f);
        fgG = (fgG < 0.03928f) ? fgG / 12.92f : (float) Math.pow((fgG + 0.055f) / 1.055f, 2.4f);
        fgB = (fgB < 0.03928f) ? fgB / 12.92f : (float) Math.pow((fgB + 0.055f) / 1.055f, 2.4f);
        float fgL = 0.2126f * fgR + 0.7152f * fgG + 0.0722f * fgB;

        return Math.abs((fgL + 0.05f) / (bgL + 0.05f));
    }

    /** Sets some private shadow properties. */
+1 −1
Original line number Diff line number Diff line
@@ -29,6 +29,6 @@ class BitmapLruCache extends KeyStoreLruCache<Bitmap> {
    @Override
    protected int computeSize(Bitmap b) {
        // The cache size will be measured in kilobytes rather than number of items
        return b.getAllocationByteCount() / 1024;
        return b.getAllocationByteCount();
    }
}
 No newline at end of file
Loading