Merge "Remove assistant tests" into oc-dev
diff --git a/hostsidetests/backup/Android.mk b/hostsidetests/backup/Android.mk
deleted file mode 100644
index 3ed8e99..0000000
--- a/hostsidetests/backup/Android.mk
+++ /dev/null
@@ -1,34 +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)
-
-LOCAL_JAVA_RESOURCE_DIRS := assets/
-
-LOCAL_MODULE_TAGS := tests
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
-
-LOCAL_MODULE := CtsBackupHostTestCases
-
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/backup/AndroidTest.xml b/hostsidetests/backup/AndroidTest.xml
deleted file mode 100644
index f81279c..0000000
--- a/hostsidetests/backup/AndroidTest.xml
+++ /dev/null
@@ -1,25 +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="Config for CTS Backup host test cases">
-    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
-        <option name="cleanup-apks" value="true" />
-        <option name="test-file-name" value="CtsBackupDeviceApp.apk" />
-        <option name="test-file-name" value="CtsBackupDeviceApp2.apk" />
-    </target_preparer>
-    <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
-        <option name="jar" value="CtsBackupHostTestCases.jar" />
-    </test>
-</configuration>
diff --git a/hostsidetests/backup/app/Android.mk b/hostsidetests/backup/app/Android.mk
deleted file mode 100644
index 7e40c5a..0000000
--- a/hostsidetests/backup/app/Android.mk
+++ /dev/null
@@ -1,37 +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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
-
-LOCAL_PACKAGE_NAME := CtsBackupDeviceApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/app/AndroidManifest.xml b/hostsidetests/backup/app/AndroidManifest.xml
deleted file mode 100644
index e67404c..0000000
--- a/hostsidetests/backup/app/AndroidManifest.xml
+++ /dev/null
@@ -1,38 +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="android.backup.cts.app">
-
-    <application>
-
-        <service
-                android:name="android.backup.cts.app.DummyLiveWallpaper"
-                android:label="Dummy Live Wallpaper"
-                android:permission="android.permission.BIND_WALLPAPER">
-            <intent-filter>
-                <action android:name="android.service.wallpaper.WallpaperService" />
-            </intent-filter>
-            <meta-data
-                    android:name="android.service.wallpaper"
-                    android:resource="@xml/wallpaper">
-            </meta-data>
-        </service>
-
-    </application>
-
-</manifest>
diff --git a/hostsidetests/backup/app/res/values/strings.xml b/hostsidetests/backup/app/res/values/strings.xml
deleted file mode 100644
index e7b5cf0..0000000
--- a/hostsidetests/backup/app/res/values/strings.xml
+++ /dev/null
@@ -1,23 +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.
--->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
-    <string name="wallpaper_description">Description</string>
-    <string name="wallpaper_collection">Collection</string>
-    <string name="wallpaper_title">Title</string>
-    <string name="wallpaper_context">Context</string>
-    <string name="wallpaper_context_uri">http://android.com</string>
-</resources>
diff --git a/hostsidetests/backup/app/res/xml/wallpaper.xml b/hostsidetests/backup/app/res/xml/wallpaper.xml
deleted file mode 100644
index 7a0b39c..0000000
--- a/hostsidetests/backup/app/res/xml/wallpaper.xml
+++ /dev/null
@@ -1,22 +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
-  -->
-<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
-    android:author="@string/wallpaper_collection"
-    android:description="@string/wallpaper_description"
-    android:showMetadataInPreview="true"
-    android:contextDescription="@string/wallpaper_context"
-    android:contextUri="@string/wallpaper_context_uri"
-/>
diff --git a/hostsidetests/backup/app/src/android/backup/cts/app/DummyLiveWallpaper.java b/hostsidetests/backup/app/src/android/backup/cts/app/DummyLiveWallpaper.java
deleted file mode 100644
index 74d7315..0000000
--- a/hostsidetests/backup/app/src/android/backup/cts/app/DummyLiveWallpaper.java
+++ /dev/null
@@ -1,28 +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.
- */
-
-package android.backup.cts.app;
-
-import android.service.wallpaper.WallpaperService;
-
-/** Dummy wallpaper referenced by golden backups to test live wallpaper restore. */
-public class DummyLiveWallpaper extends WallpaperService {
-
-    @Override
-    public Engine onCreateEngine() {
-        return new Engine();
-    }
-}
diff --git a/hostsidetests/backup/app2/Android.mk b/hostsidetests/backup/app2/Android.mk
deleted file mode 100644
index c88be6d..0000000
--- a/hostsidetests/backup/app2/Android.mk
+++ /dev/null
@@ -1,39 +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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test ub-uiautomator
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
-
-LOCAL_PACKAGE_NAME := CtsBackupDeviceApp2
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/backup/app2/AndroidManifest.xml b/hostsidetests/backup/app2/AndroidManifest.xml
deleted file mode 100644
index 518f26f..0000000
--- a/hostsidetests/backup/app2/AndroidManifest.xml
+++ /dev/null
@@ -1,30 +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="android.backup.cts.app2">
-
-    <application>
-        <uses-library android:name="android.test.runner" />
-
-    </application>
-
-    <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
-        android:targetPackage="android.backup.cts.app2" />
-
-</manifest>
diff --git a/hostsidetests/backup/app2/src/android/backup/cts/app2/WallpaperRestoreTest.java b/hostsidetests/backup/app2/src/android/backup/cts/app2/WallpaperRestoreTest.java
deleted file mode 100644
index 4a2208b..0000000
--- a/hostsidetests/backup/app2/src/android/backup/cts/app2/WallpaperRestoreTest.java
+++ /dev/null
@@ -1,138 +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.
- */
-
-package android.backup.cts.app2;
-
-import static android.app.WallpaperManager.FLAG_LOCK;
-import static android.app.WallpaperManager.FLAG_SYSTEM;
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
-import static android.support.test.InstrumentationRegistry.getTargetContext;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
-
-import android.app.WallpaperInfo;
-import android.app.WallpaperManager;
-import android.graphics.Color;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.uiautomator.By;
-import android.support.test.uiautomator.BySelector;
-import android.support.test.uiautomator.UiDevice;
-import android.support.test.uiautomator.UiObject2;
-import android.support.test.uiautomator.Until;
-import android.os.ParcelFileDescriptor;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.io.IOException;
-
-/**
- * Device side routines to be invoked by the host side WallpaperRestoreTest. These are not designed
- * to be called in any other way, as they rely on state set up by the host side test.
- */
-@RunWith(AndroidJUnit4.class)
-public class WallpaperRestoreTest {
-
-    // Maximum euclidean distance (squared) between two colors before we consider them different
-    // This is needed because our golden wallpapers will have been lossily compressed
-    private static final int MAX_COLOR_DISTANCE = 12;
-
-    // How long we'll wait for the confirm dialog to show.
-    private static final int CONFIRM_DIALOG_TIMEOUT_MS = 30000;
-
-    private UiDevice mDevice;
-    private WallpaperManager mWallpaperManager;
-
-    @Before
-    public void setUp() {
-        mDevice = UiDevice.getInstance(getInstrumentation());
-        mWallpaperManager = WallpaperManager.getInstance(getTargetContext());
-    }
-
-    @Test
-    public void clickBackupConfirmButton() throws Exception {
-        BySelector confirmButtonSelector = By.res("com.android.backupconfirm:id/button_allow");
-        UiObject2 confirmButton =
-                mDevice.wait(Until.findObject(confirmButtonSelector), CONFIRM_DIALOG_TIMEOUT_MS);
-        assertNotNull("confirm button not found", confirmButton);
-        confirmButton.click();
-    }
-
-    @Test
-    public void assertBothWallpapersAreGreen() throws Exception {
-        assertTrue(isBitmapColor(getWallpaperBitmap(FLAG_SYSTEM), Color.GREEN));
-        // Check that lock wallpaper isn't set, i.e., is same as system
-        assertNull(mWallpaperManager.getWallpaperFile(FLAG_LOCK));
-        assertNull(mWallpaperManager.getWallpaperInfo());
-    }
-
-    @Test
-    public void assertSystemIsRedAndLockIsGreen() throws Exception {
-        assertTrue(isBitmapColor(getWallpaperBitmap(FLAG_SYSTEM), Color.RED));
-        assertTrue(isBitmapColor(getWallpaperBitmap(FLAG_LOCK), Color.GREEN));
-        assertNull(mWallpaperManager.getWallpaperInfo());
-    }
-
-    @Test
-    public void assertBothWallpapersAreLive() throws Exception {
-        checkLiveWallpaperInfo(mWallpaperManager.getWallpaperInfo());
-        assertNull(mWallpaperManager.getWallpaperFile(FLAG_LOCK));
-    }
-
-    @Test
-    public void assertSystemIsLiveAndLockIsGreen() throws Exception {
-        checkLiveWallpaperInfo(mWallpaperManager.getWallpaperInfo());
-        assertTrue(isBitmapColor(getWallpaperBitmap(FLAG_LOCK), Color.GREEN));
-    }
-
-    private void checkLiveWallpaperInfo(WallpaperInfo info) {
-        assertEquals("android.backup.cts.app", info.getPackageName());
-    }
-
-    private boolean isBitmapColor(Bitmap bitmap, int color) {
-        int width = bitmap.getWidth();
-        int height = bitmap.getHeight();
-        assertTrue(width > 0 && height > 0);
-        for (int y = 0; y < height; y++) {
-            for (int x = 0; x < width; x++) {
-                if (colorDistance(color, bitmap.getPixel(x, y)) > MAX_COLOR_DISTANCE) {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-
-    private int colorDistance(int c1, int c2) {
-        int deltaG = Color.green(c1) - Color.green(c2);
-        int deltaR = Color.red(c1) - Color.red(c2);
-        int deltaB = Color.blue(c1) - Color.blue(c2);
-        return deltaG * deltaG + deltaR * deltaR + deltaB * deltaB;
-    }
-
-    private Bitmap getWallpaperBitmap(int which) throws IOException {
-        try (ParcelFileDescriptor fd = mWallpaperManager.getWallpaperFile(which)) {
-            BitmapFactory.Options options = new BitmapFactory.Options();
-            return BitmapFactory.decodeFileDescriptor(fd.getFileDescriptor(), null, options);
-        }
-    }
-}
diff --git a/hostsidetests/backup/assets/wallpaper_green.ab b/hostsidetests/backup/assets/wallpaper_green.ab
deleted file mode 100644
index 06ea5e4..0000000
--- a/hostsidetests/backup/assets/wallpaper_green.ab
+++ /dev/null
Binary files differ
diff --git a/hostsidetests/backup/assets/wallpaper_live.ab b/hostsidetests/backup/assets/wallpaper_live.ab
deleted file mode 100644
index c77ceec..0000000
--- a/hostsidetests/backup/assets/wallpaper_live.ab
+++ /dev/null
Binary files differ
diff --git a/hostsidetests/backup/assets/wallpaper_live_green.ab b/hostsidetests/backup/assets/wallpaper_live_green.ab
deleted file mode 100644
index 187dce2..0000000
--- a/hostsidetests/backup/assets/wallpaper_live_green.ab
+++ /dev/null
Binary files differ
diff --git a/hostsidetests/backup/assets/wallpaper_red_green.ab b/hostsidetests/backup/assets/wallpaper_red_green.ab
deleted file mode 100644
index 87cee65..0000000
--- a/hostsidetests/backup/assets/wallpaper_red_green.ab
+++ /dev/null
Binary files differ
diff --git a/hostsidetests/backup/src/android/backup/cts/WallpaperRestoreHostSideTest.java b/hostsidetests/backup/src/android/backup/cts/WallpaperRestoreHostSideTest.java
deleted file mode 100644
index c62d80e..0000000
--- a/hostsidetests/backup/src/android/backup/cts/WallpaperRestoreHostSideTest.java
+++ /dev/null
@@ -1,131 +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.
- */
-
-package android.backup.cts;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-
-import com.android.compatibility.common.tradefed.testtype.CompatibilityHostTestBase;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-import java.util.concurrent.CountDownLatch;
-
-@RunWith(DeviceJUnit4ClassRunner.class)
-public class WallpaperRestoreHostSideTest extends CompatibilityHostTestBase {
-
-    // Value of PackageManager.FEATURE_BACKUP
-    private static final String FEATURE_BACKUP = "android.software.backup";
-
-    private static final String DISMISS_KEYGUARD_COMMAND = "wm dismiss-keyguard";
-
-    @Before
-    public void skipTestUnlessBackupSupported() throws Exception {
-        assumeTrue(supportsBackup());
-        getDevice().executeShellCommand(DISMISS_KEYGUARD_COMMAND);
-    }
-
-    @Test
-    public void testRestoreSameImageToBoth() throws Exception {
-        restoreBackup("wallpaper_green.ab");
-        checkDeviceTest("assertBothWallpapersAreGreen");
-    }
-
-    @Test
-    public void testRestoreDifferentImageToEach() throws Exception {
-        restoreBackup("wallpaper_red_green.ab");
-        checkDeviceTest("assertSystemIsRedAndLockIsGreen");
-    }
-
-    @Test
-    public void testRestoreLiveWallpaper() throws Exception {
-        restoreBackup("wallpaper_live.ab");
-        checkDeviceTest("assertBothWallpapersAreLive");
-    }
-
-    @Test
-    public void testRestoreLiveWallpaperAndImageLock() throws Exception {
-        restoreBackup("wallpaper_live_green.ab");
-        checkDeviceTest("assertSystemIsLiveAndLockIsGreen");
-    }
-
-    private boolean supportsBackup() throws Exception {
-        return getDevice().hasFeature("feature:" + FEATURE_BACKUP);
-    }
-
-    private void restoreBackup(final String filename) throws Exception {
-        ITestDevice device = getDevice();
-        assertNotNull("Device not set", device);
-        CountDownLatch restoreStarted = new CountDownLatch(1);
-        Thread restore =
-                new Thread() {
-                    @Override
-                    public void run() {
-                        restoreStarted.countDown();
-                        try {
-                            device.executeAdbCommand("restore", createTestFile(filename));
-                        } catch (Exception e) {
-                            throw new RuntimeException(e);
-                        }
-                    }
-                };
-        restore.start();
-        restoreStarted.await();
-        checkDeviceTest("clickBackupConfirmButton");
-        restore.join();
-    }
-
-    private void checkDeviceTest(String testName) throws DeviceNotAvailableException {
-        boolean result =
-                runDeviceTests(
-                        "android.backup.cts.app2",
-                        "android.backup.cts.app2.WallpaperRestoreTest",
-                        testName);
-        assertTrue("Device test failed: " + testName, result);
-    }
-
-    private String createTestFile(String filename) throws IOException {
-        File tempFile = File.createTempFile(WallpaperRestoreHostSideTest.class.getName(), "tmp");
-        tempFile.deleteOnExit();
-        try (InputStream input = openResourceAsStream(filename);
-                OutputStream output = new FileOutputStream(tempFile)) {
-            byte[] buffer = new byte[4096];
-            int length;
-            while ((length = input.read(buffer)) > 0) {
-                output.write(buffer, 0, length);
-            }
-        }
-        return tempFile.getAbsolutePath();
-    }
-
-    private InputStream openResourceAsStream(String filename) {
-        InputStream input = getClass().getResourceAsStream(File.separator + filename);
-        assertNotNull(input);
-        return input;
-    }
-}
diff --git a/tests/tests/graphics/src/android/graphics/cts/Color_ColorLongTest.java b/tests/tests/graphics/src/android/graphics/cts/Color_ColorLongTest.java
index a124dbc..2e76b85 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Color_ColorLongTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Color_ColorLongTest.java
@@ -36,6 +36,8 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
 @SmallTest
@@ -210,6 +212,22 @@
         // Make sure we received a copy
         components[0] = 127.0f;
         assertNotEquals(c.red(), components[0]);
+
+        float[] componentsRet = c.getComponents(components);
+        assertSame(components, componentsRet);
+        assertEquals(c.getComponentCount(), componentsRet.length);
+        assertEquals(c.red(), componentsRet[0], 0.0f);
+        assertEquals(c.green(), componentsRet[1], 0.0f);
+        assertEquals(c.blue(), componentsRet[2], 0.0f);
+        assertEquals(c.alpha(), componentsRet[3], 0.0f);
+
+        componentsRet = c.getComponents(null);
+        assertNotNull(componentsRet);
+        assertEquals(c.getComponentCount(), componentsRet.length);
+        assertEquals(c.red(), componentsRet[0], 0.0f);
+        assertEquals(c.green(), componentsRet[1], 0.0f);
+        assertEquals(c.blue(), componentsRet[2], 0.0f);
+        assertEquals(c.alpha(), componentsRet[3], 0.0f);
     }
 
     @Test(expected = ArrayIndexOutOfBoundsException.class)
@@ -217,6 +235,11 @@
         valueOf(0.1f, 0.2f, 0.3f, 0.4f).getComponent(4);
     }
 
+    @Test(expected = IllegalArgumentException.class)
+    public void testGetComponentOutOfBounds() {
+        valueOf(0.1f, 0.2f, 0.3f, 0.4f).getComponents(new float[3]);
+    }
+
     @Test
     public void testToArgb() {
         assertEquals(0xff8000ff, toArgb(pack(0.5f, 0.0f, 1.0f)));