diff options
author | Lucas Dupin <dupin@google.com> | 2017-07-06 14:35:30 -0700 |
---|---|---|
committer | Lucas Dupin <dupin@google.com> | 2017-07-07 10:48:43 -0700 |
commit | e2292a94bb7cc7917c089f1f221ccbb34f9f2ea2 (patch) | |
tree | 0d00f25351b6548db6228979e24dda71e2bea6b5 | |
parent | d7aa26f33b70071a089bfcd7ae17e18d066501f0 (diff) |
Moving color extraction classes
Fixes: 62220212
Test: make
Test: runtest -x tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java
Test: runtest -x tests/Internal/src/com/android/internal/colorextraction/types/TonalTest.java
Test: runtest systemui
Change-Id: I7c4cf5c40a88555e81fbad9bec2b32c55c927468
Merged-In: I7c4cf5c40a88555e81fbad9bec2b32c55c927468
23 files changed, 60 insertions, 233 deletions
diff --git a/packages/SystemUI/colorextraction/src/com/google/android/colorextraction/ColorExtractor.java b/core/java/com/android/internal/colorextraction/ColorExtractor.java index 62fcef3d6559..2608698f5b63 100644 --- a/packages/SystemUI/colorextraction/src/com/google/android/colorextraction/ColorExtractor.java +++ b/core/java/com/android/internal/colorextraction/ColorExtractor.java @@ -14,24 +14,22 @@ * limitations under the License */ -package com.google.android.colorextraction; +package com.android.internal.colorextraction; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.WallpaperColors; import android.app.WallpaperManager; import android.content.Context; -import android.os.AsyncTask; import android.os.Trace; -import android.support.annotation.VisibleForTesting; import android.util.Log; import android.util.SparseArray; -import com.google.android.colorextraction.types.ExtractionType; -import com.google.android.colorextraction.types.Tonal; +import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.colorextraction.types.ExtractionType; +import com.android.internal.colorextraction.types.Tonal; import java.util.ArrayList; -import java.util.List; /** * Class to process wallpaper colors and generate a tonal palette based on them. diff --git a/packages/SystemUI/colorextraction/src/com/google/android/colorextraction/drawable/GradientDrawable.java b/core/java/com/android/internal/colorextraction/drawable/GradientDrawable.java index 2b212c11b732..500c028ed4c6 100644 --- a/packages/SystemUI/colorextraction/src/com/google/android/colorextraction/drawable/GradientDrawable.java +++ b/core/java/com/android/internal/colorextraction/drawable/GradientDrawable.java @@ -14,11 +14,13 @@ * limitations under the License */ -package com.google.android.colorextraction.drawable; +package com.android.internal.colorextraction.drawable; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; +import android.annotation.NonNull; +import android.annotation.Nullable; import android.content.Context; import android.graphics.Canvas; import android.graphics.ColorFilter; @@ -29,13 +31,11 @@ import android.graphics.Rect; import android.graphics.Shader; import android.graphics.Xfermode; import android.graphics.drawable.Drawable; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; -import android.support.v4.graphics.ColorUtils; import android.view.animation.DecelerateInterpolator; -import com.google.android.colorextraction.ColorExtractor; +import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.colorextraction.ColorExtractor; +import com.android.internal.graphics.ColorUtils; /** * Draws a gradient based on a Palette diff --git a/packages/SystemUI/colorextraction/src/com/google/android/colorextraction/types/ExtractionType.java b/core/java/com/android/internal/colorextraction/types/ExtractionType.java index 4c3ac3e038de..762b54fb1e6b 100644 --- a/packages/SystemUI/colorextraction/src/com/google/android/colorextraction/types/ExtractionType.java +++ b/core/java/com/android/internal/colorextraction/types/ExtractionType.java @@ -14,11 +14,11 @@ * limitations under the License */ -package com.google.android.colorextraction.types; +package com.android.internal.colorextraction.types; import android.app.WallpaperColors; -import com.google.android.colorextraction.ColorExtractor; +import com.android.internal.colorextraction.ColorExtractor; /** * Interface to allow various color extraction implementations. diff --git a/packages/SystemUI/colorextraction/src/com/google/android/colorextraction/types/Tonal.java b/core/java/com/android/internal/colorextraction/types/Tonal.java index f59c4a56bf3b..b8ebe3000d8e 100644 --- a/packages/SystemUI/colorextraction/src/com/google/android/colorextraction/types/Tonal.java +++ b/core/java/com/android/internal/colorextraction/types/Tonal.java @@ -14,20 +14,19 @@ * limitations under the License */ -package com.google.android.colorextraction.types; +package com.android.internal.colorextraction.types; +import android.annotation.NonNull; +import android.annotation.Nullable; import android.app.WallpaperColors; import android.graphics.Color; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; -import android.support.v4.graphics.ColorUtils; import android.util.Log; import android.util.MathUtils; -import android.util.Pair; import android.util.Range; -import com.google.android.colorextraction.ColorExtractor.GradientColors; +import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.colorextraction.ColorExtractor.GradientColors; +import com.android.internal.graphics.ColorUtils; import java.util.Arrays; import java.util.List; @@ -616,7 +615,7 @@ public class Tonal implements ExtractionType { @SuppressWarnings("WeakerAccess") @VisibleForTesting - static final ColorRange[] BLACKLISTED_COLORS = new ColorRange[] { + public static final ColorRange[] BLACKLISTED_COLORS = new ColorRange[] { // Red new ColorRange( @@ -768,18 +767,18 @@ public class Tonal implements ExtractionType { * </ul> */ @VisibleForTesting - static class ColorRange { + public static class ColorRange { private Range<Float> mHue; private Range<Float> mSaturation; private Range<Float> mLightness; - ColorRange(Range<Float> hue, Range<Float> saturation, Range<Float> lightness) { + public ColorRange(Range<Float> hue, Range<Float> saturation, Range<Float> lightness) { mHue = hue; mSaturation = saturation; mLightness = lightness; } - boolean containsColor(float h, float s, float l) { + public boolean containsColor(float h, float s, float l) { if (!mHue.contains(h)) { return false; } else if (!mSaturation.contains(s)) { @@ -790,8 +789,7 @@ public class Tonal implements ExtractionType { return true; } - @VisibleForTesting - float[] getCenter() { + public float[] getCenter() { return new float[] { mHue.getLower() + (mHue.getUpper() - mHue.getLower()) / 2f, mSaturation.getLower() + (mSaturation.getUpper() - mSaturation.getLower()) / 2f, diff --git a/packages/SystemUI/Android.mk b/packages/SystemUI/Android.mk index 8fa217db0f4e..2fd7e87a683e 100644 --- a/packages/SystemUI/Android.mk +++ b/packages/SystemUI/Android.mk @@ -38,8 +38,7 @@ LOCAL_STATIC_ANDROID_LIBRARIES := \ android-support-v7-mediarouter \ android-support-v7-palette \ android-support-v14-preference \ - android-support-v17-leanback \ - colorextraction + android-support-v17-leanback LOCAL_STATIC_JAVA_LIBRARIES := \ SystemUI-tags \ diff --git a/packages/SystemUI/colorextraction/Android.mk b/packages/SystemUI/colorextraction/Android.mk deleted file mode 100644 index e818c9944f73..000000000000 --- a/packages/SystemUI/colorextraction/Android.mk +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2017 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_USE_AAPT2 := true -LOCAL_SRC_FILES := $(call all-java-files-under, src) -LOCAL_STATIC_ANDROID_LIBRARIES := android-support-annotations \ - android-support-v7-palette \ - android-support-v4 -LOCAL_MODULE := colorextraction - -include $(BUILD_STATIC_JAVA_LIBRARY) diff --git a/packages/SystemUI/colorextraction/AndroidManifest.xml b/packages/SystemUI/colorextraction/AndroidManifest.xml deleted file mode 100644 index 6e082cf43399..000000000000 --- a/packages/SystemUI/colorextraction/AndroidManifest.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - ~ Copyright (C) 2017 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.google.android.colorextraction"> -</manifest> diff --git a/packages/SystemUI/colorextraction/tests/Android.mk b/packages/SystemUI/colorextraction/tests/Android.mk deleted file mode 100644 index a517e99a27ad..000000000000 --- a/packages/SystemUI/colorextraction/tests/Android.mk +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) 2017 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := $(call all-java-files-under, src) \ - $(call all-java-files-under, ../src) - -LOCAL_JAVA_LIBRARIES := android.test.runner -LOCAL_PACKAGE_NAME := ColorExtractorTests -LOCAL_CERTIFICATE := platform - -LOCAL_MODULE_TAGS := tests - -LOCAL_JAVA_LIBRARIES := android-support-test - -LOCAL_STATIC_JAVA_LIBRARIES := \ - android-support-test \ - mockito-target-minus-junit4 \ - espresso-core \ - truth-prebuilt \ - legacy-android-test \ - android-support-annotations \ - android-support-v7-palette \ - android-support-v4 - -LOCAL_COMPATIBILITY_SUITE := device-tests - -include $(BUILD_PACKAGE)
\ No newline at end of file diff --git a/packages/SystemUI/colorextraction/tests/AndroidManifest.xml b/packages/SystemUI/colorextraction/tests/AndroidManifest.xml deleted file mode 100644 index 375c7f2a7956..000000000000 --- a/packages/SystemUI/colorextraction/tests/AndroidManifest.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2017 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.systemui.colorextraction.tests"> - - <application> - <uses-library android:name="android.test.runner" /> - </application> - - <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" - android:targetPackage="com.android.systemui.colorextraction.tests" - android:label="Tests for ColorExtractor"> - </instrumentation> -</manifest> diff --git a/packages/SystemUI/colorextraction/tests/AndroidTest.xml b/packages/SystemUI/colorextraction/tests/AndroidTest.xml deleted file mode 100644 index ee9ace4d9d89..000000000000 --- a/packages/SystemUI/colorextraction/tests/AndroidTest.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2017 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<configuration description="Runs Tests for ColorExtractor."> - <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup"> - <option name="test-file-name" value="ColorExtractorTests.apk" /> - </target_preparer> - - <option name="test-suite-tag" value="apct" /> - <option name="test-tag" value="SystemUITests" /> - <test class="com.android.tradefed.testtype.AndroidJUnitTest" > - <option name="package" value="com.android.systemui.tests" /> - <option name="runner" value="android.support.test.runner.AndroidJUnitRunner" /> - </test> -</configuration> diff --git a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java index 5f393d0ff1e4..ccb81172c75c 100644 --- a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java +++ b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java @@ -27,10 +27,9 @@ import android.view.IWindowManager; import android.view.WindowManagerGlobal; import com.android.internal.annotations.VisibleForTesting; - -import com.google.android.colorextraction.ColorExtractor; -import com.google.android.colorextraction.types.ExtractionType; -import com.google.android.colorextraction.types.Tonal; +import com.android.internal.colorextraction.ColorExtractor; +import com.android.internal.colorextraction.types.ExtractionType; +import com.android.internal.colorextraction.types.Tonal; /** * ColorExtractor aware of wallpaper visibility diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java index 31d41acc3925..1773dc0deb66 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java @@ -14,9 +14,9 @@ package com.android.systemui.globalactions; -import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; - import com.android.internal.R; +import com.android.internal.colorextraction.ColorExtractor; +import com.android.internal.colorextraction.ColorExtractor.GradientColors; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.util.EmergencyAffordanceManager; @@ -28,7 +28,6 @@ import com.android.systemui.HardwareUiLayout; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.plugins.GlobalActions.GlobalActionsManager; import com.android.systemui.statusbar.phone.ScrimController; -import com.android.systemui.volume.VolumeDialogImpl; import com.android.systemui.volume.VolumeDialogMotion.LogAccelerateInterpolator; import com.android.systemui.volume.VolumeDialogMotion.LogDecelerateInterpolator; @@ -42,11 +41,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.pm.UserInfo; import android.database.ContentObserver; -import android.database.DataSetObserver; -import android.graphics.Color; -import android.graphics.PixelFormat; import android.graphics.Point; -import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.media.AudioManager; import android.net.ConnectivityManager; @@ -68,11 +63,9 @@ import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.ArraySet; import android.util.Log; -import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.view.ViewPropertyAnimator; import android.view.Window; import android.view.WindowManager; import android.view.WindowManagerGlobal; @@ -85,9 +78,7 @@ import android.widget.ImageView.ScaleType; import android.widget.LinearLayout; import android.widget.TextView; -import com.google.android.colorextraction.ColorExtractor; -import com.google.android.colorextraction.ColorExtractor.GradientColors; -import com.google.android.colorextraction.drawable.GradientDrawable; +import com.android.internal.colorextraction.drawable.GradientDrawable; import java.util.ArrayList; import java.util.List; diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java index c1c41be07fc9..fd37b17f3cd0 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java @@ -42,6 +42,7 @@ import android.view.WindowInsets; import android.widget.FrameLayout; import android.widget.TextView; +import com.android.internal.colorextraction.ColorExtractor; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.systemui.Dependency; @@ -82,8 +83,7 @@ import com.android.systemui.stackdivider.WindowManagerProxy; import com.android.systemui.statusbar.FlingAnimationUtils; import com.android.systemui.statusbar.phone.ScrimController; -import com.google.android.colorextraction.ColorExtractor; -import com.google.android.colorextraction.drawable.GradientDrawable; +import com.android.internal.colorextraction.drawable.GradientDrawable; import java.io.PrintWriter; import java.util.ArrayList; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ScrimView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ScrimView.java index 4052211e1657..cb2aa947ac5e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ScrimView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ScrimView.java @@ -39,12 +39,11 @@ import android.view.WindowManager; import android.view.animation.Interpolator; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.colorextraction.ColorExtractor; +import com.android.internal.colorextraction.drawable.GradientDrawable; import com.android.systemui.Dependency; import com.android.systemui.statusbar.policy.ConfigurationController; -import com.google.android.colorextraction.ColorExtractor; -import com.google.android.colorextraction.drawable.GradientDrawable; - /** * A view which can draw a scrim */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index 0bd58df13002..e38578bcaedf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -33,6 +33,9 @@ import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; import android.view.animation.PathInterpolator; +import com.android.internal.colorextraction.ColorExtractor; +import com.android.internal.colorextraction.ColorExtractor.GradientColors; +import com.android.internal.colorextraction.ColorExtractor.OnColorsChangedListener; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.Dependency; import com.android.systemui.R; @@ -43,9 +46,6 @@ import com.android.systemui.statusbar.ScrimView; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; import com.android.systemui.statusbar.stack.ViewState; -import com.google.android.colorextraction.ColorExtractor; -import com.google.android.colorextraction.ColorExtractor.OnColorsChangedListener; - /** * Controls both the scrim behind the notifications and in front of the notifications (when a * security method gets shown). @@ -80,8 +80,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; private final SysuiColorExtractor mColorExtractor; - private ColorExtractor.GradientColors mLockColors; - private ColorExtractor.GradientColors mSystemColors; + private GradientColors mLockColors; + private GradientColors mSystemColors; private boolean mNeedsDrawableColorUpdate; protected float mScrimBehindAlpha; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 4aa8783bd9be..4790d03d12db 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -139,6 +139,7 @@ import android.widget.RemoteViews; import android.widget.TextView; import android.widget.Toast; +import com.android.internal.colorextraction.ColorExtractor; import com.android.internal.graphics.ColorUtils; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; @@ -243,8 +244,6 @@ import com.android.systemui.util.NotificationChannels; import com.android.systemui.util.leak.LeakDetector; import com.android.systemui.volume.VolumeComponent; -import com.google.android.colorextraction.ColorExtractor; - import java.io.FileDescriptor; import java.io.PrintWriter; import java.io.StringWriter; diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java index e11b23ea0efd..32fd3e059ff5 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java @@ -81,14 +81,10 @@ import com.android.systemui.plugins.VolumeDialogController; import com.android.systemui.plugins.VolumeDialogController.State; import com.android.systemui.plugins.VolumeDialogController.StreamState; import com.android.systemui.plugins.VolumeDialog; -import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerZenModePanel; -import com.google.android.colorextraction.ColorExtractor; -import com.google.android.colorextraction.drawable.GradientDrawable; - import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; diff --git a/packages/SystemUI/tests/Android.mk b/packages/SystemUI/tests/Android.mk index 136aaad6a8dd..5e71dd4684c5 100644 --- a/packages/SystemUI/tests/Android.mk +++ b/packages/SystemUI/tests/Android.mk @@ -45,8 +45,7 @@ LOCAL_STATIC_ANDROID_LIBRARIES := \ android-support-v7-mediarouter \ android-support-v7-palette \ android-support-v14-preference \ - android-support-v17-leanback \ - colorextraction + android-support-v17-leanback LOCAL_STATIC_JAVA_LIBRARIES := \ metrics-helper-lib \ diff --git a/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java b/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java index 1ed5f565117f..a81188af85ef 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java +++ b/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java @@ -23,19 +23,14 @@ import android.app.WallpaperManager; import android.graphics.Color; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; -import android.util.Pair; +import com.android.internal.colorextraction.ColorExtractor; +import com.android.internal.colorextraction.types.Tonal; import com.android.systemui.SysuiTestCase; -import com.google.android.colorextraction.ColorExtractor; -import com.google.android.colorextraction.types.Tonal; - import org.junit.Test; import org.junit.runner.RunWith; -import java.util.ArrayList; -import java.util.List; - /** * Tests color extraction generation. */ diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/ScrimViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/ScrimViewTest.java index ae89ebab8f40..4c3bf1081792 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/ScrimViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/ScrimViewTest.java @@ -35,12 +35,11 @@ import android.testing.TestableLooper.RunWithLooper; import android.testing.ViewUtils; import android.view.View; +import com.android.internal.colorextraction.ColorExtractor; +import com.android.internal.colorextraction.drawable.GradientDrawable; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.utils.leaks.LeakCheckedTest; -import com.google.android.colorextraction.ColorExtractor; -import com.google.android.colorextraction.drawable.GradientDrawable; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/tests/Internal/Android.mk b/tests/Internal/Android.mk index f59a6240f897..fc001e928e80 100644 --- a/tests/Internal/Android.mk +++ b/tests/Internal/Android.mk @@ -10,7 +10,10 @@ LOCAL_PROTOC_OPTIMIZE_TYPE := nano LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_JAVA_LIBRARIES := android.test.runner -LOCAL_STATIC_JAVA_LIBRARIES := junit legacy-android-test android-support-test +LOCAL_STATIC_JAVA_LIBRARIES := junit \ + legacy-android-test \ + android-support-test \ + mockito-target-minus-junit4 LOCAL_CERTIFICATE := platform diff --git a/packages/SystemUI/colorextraction/tests/src/com/google/android/colorextraction/ColorExtractorTest.java b/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java index b5f4a8c80c53..71821472f55e 100644 --- a/packages/SystemUI/colorextraction/tests/src/com/google/android/colorextraction/ColorExtractorTest.java +++ b/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License */ -package com.google.android.colorextraction; +package com.android.internal.colorextraction; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import android.app.WallpaperColors; import android.app.WallpaperManager; import android.content.Context; import android.graphics.Color; @@ -30,9 +29,10 @@ import android.support.test.InstrumentationRegistry; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; -import com.google.android.colorextraction.ColorExtractor.GradientColors; -import com.google.android.colorextraction.types.ExtractionType; -import com.google.android.colorextraction.types.Tonal; +import com.android.internal.colorextraction.ColorExtractor; +import com.android.internal.colorextraction.ColorExtractor.GradientColors; +import com.android.internal.colorextraction.types.ExtractionType; +import com.android.internal.colorextraction.types.Tonal; import org.junit.Before; import org.junit.Test; diff --git a/packages/SystemUI/colorextraction/tests/src/com/google/android/colorextraction/types/TonalTest.java b/tests/Internal/src/com/android/internal/colorextraction/types/TonalTest.java index 404076cb5301..1e3e8e91d9ef 100644 --- a/packages/SystemUI/colorextraction/tests/src/com/google/android/colorextraction/types/TonalTest.java +++ b/tests/Internal/src/com/android/internal/colorextraction/types/TonalTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License */ -package com.google.android.colorextraction.types; +package com.android.internal.colorextraction.types; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -22,19 +22,15 @@ import android.app.WallpaperColors; import android.graphics.Color; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; -import android.support.v4.graphics.ColorUtils; -import android.util.Pair; import android.util.Range; -import com.google.android.colorextraction.ColorExtractor; -import com.google.android.colorextraction.ColorExtractor.GradientColors; +import com.android.internal.colorextraction.ColorExtractor.GradientColors; +import com.android.internal.graphics.ColorUtils; import org.junit.Test; import org.junit.runner.RunWith; -import java.util.ArrayList; import java.util.Arrays; -import java.util.List; /** * Tests tonal palette generation. @@ -71,9 +67,8 @@ public class TonalTest { public void colorRange_excludeBlacklistedColor() { // Creating a WallpaperColors object that contains *only* blacklisted colors float[] hsl = Tonal.BLACKLISTED_COLORS[0].getCenter(); - ArrayList<Pair<Color, Integer>> blacklistedColorList = new ArrayList<>(); - blacklistedColorList.add(new Pair<>(Color.valueOf(ColorUtils.HSLToColor(hsl)), 1)); - WallpaperColors colors = new WallpaperColors(blacklistedColorList); + WallpaperColors colors = new WallpaperColors(Color.valueOf(ColorUtils.HSLToColor(hsl)), + null, null, 0); // Make sure that palette generation will fail Tonal tonal = new Tonal(); |