Update frameworks/base patches for android-7.1.1_r21
[GitHub/Stricted/android_vendor_extra.git] / patches / frameworks / base / 0022-OMS7-compatible-Ambient-notification-inversion.patch
1 From 639ec4b53d5e45a3af2570b1358b66b2b532a404 Mon Sep 17 00:00:00 2001
2 From: George G <kreach3r@users.noreply.github.com>
3 Date: Mon, 14 Nov 2016 14:44:17 +0200
4 Subject: [PATCH 22/39] OMS7 compatible 'Ambient notification inversion'
5
6 OMS7 introduced this fine piece of code: https://github.com/SubstratumResources/platform_frameworks_base/blob/n-oms7/core/java/android/app/ResourcesManager.java#L897..#L904
7
8 // Resources.getSystem Resources are created on request and aren't tracked by
9 // mResourceReferences.
10 //
11 // If overlays targeting "android" are to be used, we must create the system
12 // resources regardless of whether they already exist, since otherwise the
13 // information on what overlays to use would be lost. This is wasteful for most
14 // applications, so limit this operation to the system user only. (This means
15 // Resources.getSystem() will *not* use overlays for applications.)
16
17 Replaced deprecated Resources.getSystem() with compatible method.
18
19 Change-Id: I80ad5d037004f0dc63d9eb746c3af05e59a8834e
20 ---
21 packages/SystemUI/src/com/android/systemui/ViewInvertHelper.java | 6 +++---
22 1 file changed, 3 insertions(+), 3 deletions(-)
23
24 diff --git a/packages/SystemUI/src/com/android/systemui/ViewInvertHelper.java b/packages/SystemUI/src/com/android/systemui/ViewInvertHelper.java
25 index 65fd1158b95..605f381e9e2 100644
26 --- a/packages/SystemUI/src/com/android/systemui/ViewInvertHelper.java
27 +++ b/packages/SystemUI/src/com/android/systemui/ViewInvertHelper.java
28 @@ -20,7 +20,6 @@ import android.animation.Animator;
29 import android.animation.AnimatorListenerAdapter;
30 import android.animation.ValueAnimator;
31 import android.content.Context;
32 -import android.content.res.Resources;
33 import android.graphics.ColorMatrix;
34 import android.graphics.ColorMatrixColorFilter;
35 import android.graphics.Paint;
36 @@ -37,6 +36,7 @@ public class ViewInvertHelper {
37 private final ColorMatrix mMatrix = new ColorMatrix();
38 private final ColorMatrix mGrayscaleMatrix = new ColorMatrix();
39 private final long mFadeDuration;
40 + private final boolean mThemeInvert;
41 private final ArrayList<View> mTargets = new ArrayList<>();
42
43 public ViewInvertHelper(View v, long fadeDuration) {
44 @@ -45,6 +45,7 @@ public class ViewInvertHelper {
45 }
46 public ViewInvertHelper(Context context, long fadeDuration) {
47 mFadeDuration = fadeDuration;
48 + mThemeInvert = context.getResources().getBoolean(com.android.internal.R.bool.config_invert_colors_on_doze);
49 }
50
51 private static ArrayList<View> constructArray(View target) {
52 @@ -91,8 +92,7 @@ public class ViewInvertHelper {
53 }
54
55 public void update(boolean invert) {
56 - if (invert && Resources.getSystem().getBoolean(
57 - com.android.internal.R.bool.config_invert_colors_on_doze)) {
58 + if (invert && mThemeInvert) {
59 updateInvertPaint(1f);
60 for (int i = 0; i < mTargets.size(); i++) {
61 mTargets.get(i).setLayerType(View.LAYER_TYPE_HARDWARE, mDarkPaint);
62 --
63 2.11.1
64