Merge "Update gfxstats cts test" into mnc-dev
diff --git a/tests/tests/accessibility/Android.mk b/tests/tests/accessibility/Android.mk
index bb943ee..263c47b 100644
--- a/tests/tests/accessibility/Android.mk
+++ b/tests/tests/accessibility/Android.mk
@@ -26,4 +26,6 @@
LOCAL_STATIC_JAVA_LIBRARIES := ctsdeviceutil ctstestrunner
+LOCAL_SDK_VERSION := current
+
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/app/Android.mk b/tests/tests/app/Android.mk
index 4a3d31f..301f931 100644
--- a/tests/tests/app/Android.mk
+++ b/tests/tests/app/Android.mk
@@ -31,4 +31,6 @@
LOCAL_INSTRUMENTATION_FOR := CtsAppTestStubs
+LOCAL_SDK_VERSION := current
+
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/app/src/android/app/cts/AlertDialog_BuilderTest.java b/tests/tests/app/src/android/app/cts/AlertDialog_BuilderTest.java
index 9554438..58e69b8 100644
--- a/tests/tests/app/src/android/app/cts/AlertDialog_BuilderTest.java
+++ b/tests/tests/app/src/android/app/cts/AlertDialog_BuilderTest.java
@@ -577,26 +577,6 @@
assertEquals(view, mView);
}
- public void testSetViewCustom() throws Throwable {
- final int viewSpacingLeft = 10;
- final int viewSpacingTop = 20;
- final int viewSpacingRight = 30;
- final int viewSpacingBottom = 40;
- final View view = new View(mContext);
- view.setId(100);
- runTestOnUiThread(new Runnable() {
- public void run() {
- mBuilder = new AlertDialog.Builder(mContext);
- mBuilder.setView(view, viewSpacingLeft, viewSpacingTop, viewSpacingRight,
- viewSpacingBottom);
- mDialog = mBuilder.show();
- mView = mDialog.getWindow().findViewById(100);
- }
- });
- mInstrumentation.waitForIdleSync();
- assertEquals(view, mView);
- }
-
public void testSetInverseBackgroundForced() throws Throwable {
runTestOnUiThread(new Runnable() {
public void run() {
diff --git a/tests/tests/app/src/android/app/cts/InstrumentationTest.java b/tests/tests/app/src/android/app/cts/InstrumentationTest.java
index b21148e..25403f3 100644
--- a/tests/tests/app/src/android/app/cts/InstrumentationTest.java
+++ b/tests/tests/app/src/android/app/cts/InstrumentationTest.java
@@ -540,7 +540,6 @@
public void openPanel(int featureId, KeyEvent event) {
}
- @Override
public void alwaysReadCloseOnTouchAttr() {
}
diff --git a/tests/tests/app/src/android/app/cts/NotificationTest.java b/tests/tests/app/src/android/app/cts/NotificationTest.java
index 17f433e..6179922 100644
--- a/tests/tests/app/src/android/app/cts/NotificationTest.java
+++ b/tests/tests/app/src/android/app/cts/NotificationTest.java
@@ -166,16 +166,6 @@
assertNotNull(mNotification.contentView);
}
- public void testSetLatestEventInfo() {
- mNotification = new Notification();
- mNotification.icon = 1;
- final Intent intent = new Intent();
- final PendingIntent contentIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);
- mNotification.setLatestEventInfo(mContext, CONTENT_TITLE, CONTENT_TEXT, contentIntent);
- assertTrue(mNotification.contentView instanceof RemoteViews);
- assertNotNull(mNotification.contentView);
- }
-
public void testToString() {
mNotification = new Notification();
assertNotNull(mNotification.toString());
diff --git a/tests/tests/app/src/android/app/cts/SearchDialogTest.java b/tests/tests/app/src/android/app/cts/SearchDialogTest.java
deleted file mode 100644
index 1cf1ebd..0000000
--- a/tests/tests/app/src/android/app/cts/SearchDialogTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2015 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.app.cts;
-
-import android.app.SearchDialog;
-import android.content.Context;
-import android.test.ActivityInstrumentationTestCase2;
-import android.test.InstrumentationTestCase;
-import android.view.ActionMode;
-import android.view.View;
-import android.view.ViewGroup;
-
-/**
- * Test {@link SearchDialog}.
- */
-public class SearchDialogTest extends InstrumentationTestCase {
-
- private Context mContext;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mContext = getInstrumentation().getTargetContext();
- }
-
- public void testPrimaryActionModesAreStopped() {
- SearchDialog.SearchBar searchBar = new SearchDialog.SearchBar(mContext);
- MockViewGroup viewGroup = new MockViewGroup(mContext);
- viewGroup.addView(searchBar);
-
- ActionMode mode = searchBar.startActionModeForChild(null, null, ActionMode.TYPE_PRIMARY);
-
- assertNull(mode);
- // Should not bubble up.
- assertFalse(viewGroup.isStartActionModeForChildTypedCalled);
- assertFalse(viewGroup.isStartActionModeForChildTypelessCalled);
-
- mode = searchBar.startActionModeForChild(null, null);
-
- assertNull(mode);
- // Should not bubble up.
- assertFalse(viewGroup.isStartActionModeForChildTypedCalled);
- assertFalse(viewGroup.isStartActionModeForChildTypelessCalled);
- }
-
- public void testFloatingActionModesAreBubbledUp() {
- SearchDialog.SearchBar searchBar = new SearchDialog.SearchBar(mContext);
- MockViewGroup viewGroup = new MockViewGroup(mContext);
- viewGroup.addView(searchBar);
-
- searchBar.startActionModeForChild(null, null, ActionMode.TYPE_FLOATING);
-
- // Should bubble up.
- assertTrue(viewGroup.isStartActionModeForChildTypedCalled);
- }
-
- private static class MockViewGroup extends ViewGroup {
- boolean isStartActionModeForChildTypedCalled = false;
- boolean isStartActionModeForChildTypelessCalled = false;
-
- public MockViewGroup(Context context) {
- super(context);
- }
-
- @Override
- public ActionMode startActionModeForChild(View originalView, ActionMode.Callback callback) {
- isStartActionModeForChildTypelessCalled = true;
- return super.startActionModeForChild(originalView, callback);
- }
-
- @Override
- public ActionMode startActionModeForChild(
- View originalView, ActionMode.Callback callback, int type) {
- isStartActionModeForChildTypedCalled = true;
- return super.startActionModeForChild(originalView, callback, type);
- }
-
- @Override
- protected void onLayout(boolean changed, int l, int t, int r, int b) {}
- }
-}
diff --git a/tests/tests/graphics/src/android/graphics/cts/VulkanReservedTest.java b/tests/tests/graphics/src/android/graphics/cts/VulkanReservedTest.java
new file mode 100644
index 0000000..bfd520e
--- /dev/null
+++ b/tests/tests/graphics/src/android/graphics/cts/VulkanReservedTest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015 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.graphics.cts;
+
+import android.cts.util.FileUtils;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+
+public class VulkanReservedTest extends TestCase {
+
+ /**
+ * Assert that file with given path does not exist.
+ */
+ private static void assertNoFile(String filename) {
+ assertFalse(filename + " must not exist", new File(filename).exists());
+ }
+
+ /**
+ * Test that no vendor ships libvulkan.so before ratification and
+ * appropriate CTS coverage.
+ */
+ public void testNoVulkan() {
+ assertNoFile("/system/lib/libvulkan.so");
+ assertNoFile("/system/lib64/libvulkan.so");
+ assertNoFile("/vendor/lib/libvulkan.so");
+ assertNoFile("/vendor/lib64/libvulkan.so");
+ }
+}
diff --git a/tests/tests/keystore/src/android/keystore/cts/KeyChainTest.java b/tests/tests/keystore/src/android/keystore/cts/KeyChainTest.java
index d8080a0..caa6336 100644
--- a/tests/tests/keystore/src/android/keystore/cts/KeyChainTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/KeyChainTest.java
@@ -17,9 +17,13 @@
package android.keystore.cts;
import android.content.pm.PackageManager;
+import android.os.Handler;
import android.security.KeyChain;
+import android.security.KeyChainException;
import android.test.AndroidTestCase;
+import java.util.concurrent.CountDownLatch;
+
public class KeyChainTest extends AndroidTestCase {
public void testIsKeyAlgorithmSupported_RequiredAlgorithmsSupported() throws Exception {
assertFalse("DSA must not be supported", KeyChain.isKeyAlgorithmSupported("DSA"));
@@ -27,6 +31,56 @@
assertTrue("RSA must be supported", KeyChain.isKeyAlgorithmSupported("RSA"));
}
+ public void testNullPrivateKeyArgumentsFail()
+ throws KeyChainException, InterruptedException {
+ try {
+ KeyChain.getPrivateKey(null, null);
+ fail("NullPointerException was expected for null arguments to "
+ + "KeyChain.getPrivateKey(Context, String)");
+ } catch (NullPointerException expected) {
+ }
+ }
+
+ public void testNullPrivateKeyAliasArgumentFails()
+ throws KeyChainException, InterruptedException {
+ try {
+ KeyChain.getPrivateKey(getContext(), null);
+ fail("NullPointerException was expected with null String argument to "
+ + "KeyChain.getPrivateKey(Context, String).");
+ } catch (NullPointerException expected) {
+ }
+ }
+
+ public void testNullPrivateKeyContextArgumentFails()
+ throws KeyChainException, InterruptedException {
+ try {
+ KeyChain.getPrivateKey(null, "");
+ fail("NullPointerException was expected with null Context argument to "
+ + "KeyChain.getPrivateKey(Context, String).");
+ } catch (NullPointerException expected) {
+ }
+ }
+
+ public void testGetPrivateKeyOnMainThreadFails() throws InterruptedException {
+ final CountDownLatch waiter = new CountDownLatch(1);
+ new Handler(getContext().getMainLooper()).post(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ KeyChain.getPrivateKey(getContext(), "");
+ fail("IllegalStateException was expected for calling "
+ + "KeyChain.getPrivateKey(Context, String) on main thread");
+ } catch (IllegalStateException expected) {
+ } catch (Exception invalid) {
+ fail("Expected IllegalStateException, received " + invalid);
+ } finally {
+ waiter.countDown();
+ }
+ }
+ });
+ waiter.await();
+ }
+
/**
* Tests whether the required algorithms are backed by a Keymaster HAL that
* binds the key material to the specific device it was created or imported
diff --git a/tests/tests/media/src/android/media/cts/ResourceManagerStubActivity.java b/tests/tests/media/src/android/media/cts/ResourceManagerStubActivity.java
index 214ced4..d453e3f 100644
--- a/tests/tests/media/src/android/media/cts/ResourceManagerStubActivity.java
+++ b/tests/tests/media/src/android/media/cts/ResourceManagerStubActivity.java
@@ -53,7 +53,7 @@
Context context = getApplicationContext();
Intent intent1 = new Intent(context, ResourceManagerTestActivity1.class);
startActivityForResult(intent1, mRequestCodes[0]);
- Thread.sleep(2000); // wait for process to launch.
+ Thread.sleep(5000); // wait for process to launch and allocate all codecs.
Intent intent2 = new Intent(context, ResourceManagerTestActivity2.class);
startActivityForResult(intent2, mRequestCodes[1]);
diff --git a/tests/tests/net/src/android/net/wifi/cts/WifiEnterpriseConfigTest.java b/tests/tests/net/src/android/net/wifi/cts/WifiEnterpriseConfigTest.java
index 6e395aa..6c416ca 100644
--- a/tests/tests/net/src/android/net/wifi/cts/WifiEnterpriseConfigTest.java
+++ b/tests/tests/net/src/android/net/wifi/cts/WifiEnterpriseConfigTest.java
@@ -32,6 +32,10 @@
private static final String IDENTITY = "identity";
private static final String PASSWORD = "password";
private static final String SUBJECT_MATCH = "subjectmatch";
+ private static final String ALT_SUBJECT_MATCH = "altsubjectmatch";
+ private static final String DOM_SUBJECT_MATCH = "domsubjectmatch";
+ private static final String PLMN = "plmn";
+ private static final String REALM = "realm";
private static final String ANON_IDENTITY = "anonidentity";
private static final int ENABLE_DELAY = 10000;
@@ -87,6 +91,15 @@
config.setClientKeyEntry(null, null);
config.setSubjectMatch(SUBJECT_MATCH);
assertTrue(config.getSubjectMatch().equals(SUBJECT_MATCH));
+ // Hotspot 2.0 related attributes
+ config.setPlmn(PLMN);
+ assertTrue(config.getPlmn().equals(PLMN));
+ config.setPlmn(REALM);
+ assertTrue(config.getRealm().equals(REALM));
+ config.setAltSubjectMatch(ALT_SUBJECT_MATCH);
+ assertTrue(config.getAltSubjectMatch().equals(ALT_SUBJECT_MATCH));
+ config.setDomainSuffixMatch(DOM_SUBJECT_MATCH);
+ assertTrue(config.getDomainSuffixMatch().equals(DOM_SUBJECT_MATCH));
}
public void testAddEapNetwork() {
diff --git a/tests/tests/os/jni/Android.mk b/tests/tests/os/jni/Android.mk
index 24a0651..c125f5c 100644
--- a/tests/tests/os/jni/Android.mk
+++ b/tests/tests/os/jni/Android.mk
@@ -38,6 +38,12 @@
ARCH_SUPPORTS_SECCOMP = 1
endif
+ifeq ($(strip $(TARGET_ARCH)),arm64)
+ ARCH_SUPPORTS_SECCOMP = 1
+ # Required for __NR_poll definition.
+ LOCAL_CFLAGS += -D__ARCH_WANT_SYSCALL_DEPRECATED
+endif
+
ifeq ($(strip $(TARGET_ARCH)),x86)
ARCH_SUPPORTS_SECCOMP = 1
endif
diff --git a/tests/tests/os/jni/seccomp_sample_program.cpp b/tests/tests/os/jni/seccomp_sample_program.cpp
index e291e8a..3c90196 100644
--- a/tests/tests/os/jni/seccomp_sample_program.cpp
+++ b/tests/tests/os/jni/seccomp_sample_program.cpp
@@ -355,8 +355,6 @@
{0x6, 0, 0, 0x30001},
};
#elif defined(__aarch64__)
-// Note: aarch64 is not required to support seccomp-bpf yet, but some Nexus
-// devices do support it. For completeness, this test BPF program is provided.
struct sock_filter kTestSeccompFilter[] = {
{0x20, 0, 0, 0x4},
{0x15, 1, 0, 0xc00000b7},
diff --git a/tests/tests/os/src/android/os/cts/SeccompTest.java b/tests/tests/os/src/android/os/cts/SeccompTest.java
index 4c2f78f..0340580 100644
--- a/tests/tests/os/src/android/os/cts/SeccompTest.java
+++ b/tests/tests/os/src/android/os/cts/SeccompTest.java
@@ -51,9 +51,6 @@
}
public void testSeccomp() {
- if (CpuFeatures.isArm64Cpu() || CpuFeatures.isArm64CpuIn32BitMode()) {
- return; // seccomp not yet supported on arm64
- }
if (OSFeatures.needsSeccompSupport()) {
assertTrue("Please enable seccomp support "
+ "in your kernel (CONFIG_SECCOMP_FILTER=y)",
diff --git a/tests/tests/permission2/src/android/permission2/cts/NoWriteSecureSettingsPermissionTest.java b/tests/tests/permission2/src/android/permission2/cts/NoWriteSecureSettingsPermissionTest.java
index eb476c7..b46c45d 100644
--- a/tests/tests/permission2/src/android/permission2/cts/NoWriteSecureSettingsPermissionTest.java
+++ b/tests/tests/permission2/src/android/permission2/cts/NoWriteSecureSettingsPermissionTest.java
@@ -16,6 +16,9 @@
package android.permission2.cts;
+import android.Manifest;
+import android.content.ContentValues;
+import android.provider.Settings;
import android.test.AndroidTestCase;
/**
@@ -30,7 +33,15 @@
* {@link android.Manifest.permission#WRITE_SECURE_SETTINGS}
*/
public void testWriteSecureSettings() {
- assertWritingContentUriRequiresPermission(android.provider.Settings.Secure.CONTENT_URI,
- android.Manifest.permission.WRITE_SECURE_SETTINGS);
+ try {
+ ContentValues values = new ContentValues();
+ values.put(Settings.Secure.NAME, Settings.Secure.ACCESSIBILITY_ENABLED);
+ values.put(Settings.Secure.VALUE, Boolean.TRUE);
+ getContext().getContentResolver().insert(Settings.Secure.CONTENT_URI, values);
+ fail("expected SecurityException requiring "
+ + Manifest.permission.WRITE_SECURE_SETTINGS);
+ } catch (SecurityException expected) {
+ /* do nothing */
+ }
}
}
diff --git a/tests/tests/view/src/android/view/cts/MockTextView.java b/tests/tests/view/src/android/view/cts/MockTextView.java
index dc9420d..0c73614 100644
--- a/tests/tests/view/src/android/view/cts/MockTextView.java
+++ b/tests/tests/view/src/android/view/cts/MockTextView.java
@@ -179,19 +179,19 @@
}
public int getFrameLeft() {
- return mLeft;
+ return getLeft();
}
public int getFrameTop() {
- return mTop;
+ return getTop();
}
public int getFrameRight() {
- return mRight;
+ return getRight();
}
public int getFrameBottom() {
- return mBottom;
+ return getBottom();
}
public int getBottomPaddingOffset() {
diff --git a/tests/tests/view/src/android/view/cts/MockView.java b/tests/tests/view/src/android/view/cts/MockView.java
index 9093089..579d4fb 100644
--- a/tests/tests/view/src/android/view/cts/MockView.java
+++ b/tests/tests/view/src/android/view/cts/MockView.java
@@ -29,6 +29,7 @@
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ContextMenu.ContextMenuInfo;
@@ -104,8 +105,8 @@
return mCalledInvalidate;
}
- public void setParent(ViewParent parent) {
- mParent = parent;
+ public void setParent(ViewGroup parent) {
+ parent.addView(this);
}
public static int[] getEnabledStateSet() {
@@ -162,16 +163,6 @@
}
@Override
- protected void initializeFadingEdge(TypedArray a) {
- super.initializeFadingEdge(a);
- }
-
- @Override
- protected void initializeScrollbars(TypedArray a) {
- super.initializeScrollbars(a);
- }
-
- @Override
protected int getHorizontalScrollbarHeight() {
return super.getHorizontalScrollbarHeight();
}
diff --git a/tests/tests/view/src/android/view/cts/ViewGroupTest.java b/tests/tests/view/src/android/view/cts/ViewGroupTest.java
index b98ac4e..7fc5579 100644
--- a/tests/tests/view/src/android/view/cts/ViewGroupTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewGroupTest.java
@@ -458,7 +458,7 @@
MockTextView textView = new MockTextView(mContext);
vg.addView(textView);
vg.requestChildFocus(textView, null);
- textView.setFrame(1, 1, 100, 100);
+ textView.layout(1, 1, 100, 100);
assertTrue(vg.dispatchKeyEvent(event));
}
@@ -529,7 +529,7 @@
d.getMetrics(metrics);
int screenWidth = metrics.widthPixels;
int screenHeight = metrics.heightPixels;
- vg.setFrame(0, 0, screenWidth, screenHeight);
+ vg.layout(0, 0, screenWidth, screenHeight);
vg.setLayoutParams(new ViewGroup.LayoutParams(screenWidth, screenHeight));
MockTextView textView = new MockTextView(mContext);
@@ -554,7 +554,7 @@
assertFalse(vg.dispatchTouchEvent(me));
assertNull(mMotionEvent);
- textView.setFrame(0, 0, screenWidth, screenHeight);
+ textView.layout(0, 0, screenWidth, screenHeight);
assertTrue(vg.dispatchTouchEvent(me));
assertSame(me, mMotionEvent);
}
@@ -568,7 +568,7 @@
MockTextView textView = new MockTextView(mContext);
vg.addView(textView);
- textView.setFrame(1, 1, 100, 100);
+ textView.layout(1, 1, 100, 100);
vg.requestChildFocus(textView, null);
assertTrue(vg.dispatchTrackballEvent(me));
}
@@ -579,7 +579,7 @@
assertFalse(vg.dispatchUnhandledMove(textView, View.FOCUS_DOWN));
vg.addView(textView);
- textView.setFrame(1, 1, 100, 100);
+ textView.layout(1, 1, 100, 100);
vg.requestChildFocus(textView, null);
assertTrue(vg.dispatchUnhandledMove(textView, View.FOCUS_DOWN));
}
@@ -769,13 +769,13 @@
MockViewGroup vg = new MockViewGroup(mContext);
MockTextView textView = new MockTextView(mContext);
- textView.setFrame(1, 1, 100, 100);
+ textView.layout(1, 1, 100, 100);
Rect rect = new Rect(1, 1, 50, 50);
Point p = new Point();
assertFalse(vg.getChildVisibleRect(textView, rect, p));
- textView.setFrame(0, 0, 0, 0);
- vg.setFrame(20, 20, 60, 60);
+ textView.layout(0, 0, 0, 0);
+ vg.layout(20, 20, 60, 60);
rect = new Rect(10, 10, 40, 40);
p = new Point();
assertTrue(vg.getChildVisibleRect(textView, rect, p));
@@ -998,7 +998,7 @@
// expected
}
vg.addView(textView);
- textView.setFrame(1, 2, 3, 4);
+ textView.layout(1, 2, 3, 4);
Rect rect = new Rect();
vg.offsetDescendantRectToMyCoords(textView, rect);
assertEquals(2, rect.bottom);
@@ -1009,7 +1009,7 @@
public void testOffsetRectIntoDescendantCoords() {
MockViewGroup vg = new MockViewGroup(mContext);
- vg.setFrame(10, 20, 30, 40);
+ vg.layout(10, 20, 30, 40);
MockTextView textView = new MockTextView(mContext);
try {
@@ -1019,7 +1019,7 @@
} catch (RuntimeException e) {
// expected
}
- textView.setFrame(1, 2, 3, 4);
+ textView.layout(1, 2, 3, 4);
vg.addView(textView);
Rect rect = new Rect(5, 6, 7, 8);
@@ -1376,8 +1376,8 @@
MockViewGroup vg = new MockViewGroup(mContext);
MockTextView textView = new MockTextView(mContext);
- textView.setFrame(1, 2, 30, 40);
- vg.setFrame(1, 1, 100, 200);
+ textView.layout(1, 2, 30, 40);
+ vg.layout(1, 1, 100, 200);
vg.setClipChildren(true);
MockCanvas canvas = new MockCanvas(bitmap);
@@ -1434,7 +1434,7 @@
final int frameRight = 100;
final int frameBottom = 200;
MockViewGroup vg = new MockViewGroup(mContext);
- vg.setFrame(frameLeft, frameTop, frameRight, frameBottom);
+ vg.layout(frameLeft, frameTop, frameRight, frameBottom);
vg.setClipToPadding(true);
MockCanvas canvas = new MockCanvas();
@@ -1911,11 +1911,6 @@
}
@Override
- public boolean setFrame(int l, int t, int r, int b) {
- return super.setFrame(l, t, r, b);
- }
-
- @Override
public void dispatchRestoreInstanceState(
SparseArray<Parcelable> container) {
isDispatchRestoreInstanceStateCalled = true;
@@ -1945,11 +1940,6 @@
}
@Override
- public boolean gatherTransparentRegion(Region region) {
- return false;
- }
-
- @Override
public boolean dispatchTouchEvent(MotionEvent event) {
super.dispatchTouchEvent(event);
return true;
@@ -2162,21 +2152,6 @@
}
@Override
- public boolean setFrame(int left, int top, int right, int bottom) {
- return super.setFrame(left, top, right, bottom);
- }
-
- @Override
- public boolean isChildrenDrawnWithCacheEnabled() {
- return super.isChildrenDrawnWithCacheEnabled();
- }
-
- @Override
- public void setChildrenDrawnWithCacheEnabled(boolean enabled) {
- super.setChildrenDrawnWithCacheEnabled(enabled);
- }
-
- @Override
public void measureChild(View child, int parentWidthMeasureSpec,
int parentHeightMeasureSpec) {
measureChildCalledTime++;
@@ -2327,6 +2302,21 @@
super.resetResolvedDrawables();
resetResolvedDrawablesCount++;
}
+
+ @Override
+ public boolean setFrame(int left, int top, int right, int bottom) {
+ return super.setFrame(left, top, right, bottom);
+ }
+
+ @Override
+ public void setChildrenDrawnWithCacheEnabled(boolean enabled) {
+ super.setChildrenDrawnWithCacheEnabled(enabled);
+ }
+
+ @Override
+ public boolean isChildrenDrawnWithCacheEnabled() {
+ return super.isChildrenDrawnWithCacheEnabled();
+ }
}
static class MockView2 extends View {
diff --git a/tests/tests/view/src/android/view/cts/ViewGroup_MarginLayoutParamsTest.java b/tests/tests/view/src/android/view/cts/ViewGroup_MarginLayoutParamsTest.java
index e837b23..e53cba2 100644
--- a/tests/tests/view/src/android/view/cts/ViewGroup_MarginLayoutParamsTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewGroup_MarginLayoutParamsTest.java
@@ -89,7 +89,9 @@
public void testSetMarginsRelative() {
// create a new MarginLayoutParams instance
mMarginLayoutParams = new ViewGroup.MarginLayoutParams(320, 480);
- mMarginLayoutParams.setMarginsRelative(20, 30, 120, 140);
+ mMarginLayoutParams.setMargins(0, 30, 0, 140);
+ mMarginLayoutParams.setMarginStart(20);
+ mMarginLayoutParams.setMarginEnd(120);
assertEquals(20, mMarginLayoutParams.getMarginStart());
assertEquals(30, mMarginLayoutParams.topMargin);
assertEquals(120, mMarginLayoutParams.getMarginEnd());
@@ -120,7 +122,9 @@
assertEquals(false, mMarginLayoutParams.isMarginRelative());
// LTR / relative margin case
- mMarginLayoutParams.setMarginsRelative(20, 30, 120, 140);
+ mMarginLayoutParams.setMargins(0, 30, 0, 140);
+ mMarginLayoutParams.setMarginStart(20);
+ mMarginLayoutParams.setMarginEnd(120);
vg.setLayoutParams(mMarginLayoutParams);
assertEquals(20, mMarginLayoutParams.getMarginStart());
@@ -151,7 +155,9 @@
assertEquals(false, mMarginLayoutParams.isMarginRelative());
// RTL / relative margin case
- mMarginLayoutParams.setMarginsRelative(20, 30, 120, 140);
+ mMarginLayoutParams.setMargins(0, 30, 0, 140);
+ mMarginLayoutParams.setMarginStart(20);
+ mMarginLayoutParams.setMarginEnd(120);
vg.setLayoutParams(mMarginLayoutParams);
assertEquals(20, mMarginLayoutParams.getMarginStart());
diff --git a/tests/tests/view/src/android/view/cts/ViewTest.java b/tests/tests/view/src/android/view/cts/ViewTest.java
index ea289ce..e95236d 100644
--- a/tests/tests/view/src/android/view/cts/ViewTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewTest.java
@@ -16,28 +16,26 @@
package android.view.cts;
-import android.content.res.ColorStateList;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.ColorFilter;
-import android.graphics.PorterDuff;
-
-import android.os.Bundle;
import com.android.cts.view.R;
import com.android.internal.view.menu.ContextMenuBuilder;
-import com.google.android.collect.Lists;
import android.content.Context;
+import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.cts.util.PollingCheck;
import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.ColorFilter;
import android.graphics.Point;
+import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
+import android.os.Bundle;
import android.os.Parcelable;
import android.os.SystemClock;
import android.os.Vibrator;
@@ -64,6 +62,7 @@
import android.view.View;
import android.view.View.BaseSavedState;
import android.view.View.OnClickListener;
+import android.view.View.OnContextClickListener;
import android.view.View.OnCreateContextMenuListener;
import android.view.View.OnFocusChangeListener;
import android.view.View.OnKeyListener;
@@ -425,7 +424,9 @@
assertTrue(view.isLayoutRequested());
view.setParent(mMockParent);
- assertFalse(mMockParent.hasRequestLayout());
+ assertTrue(mMockParent.hasRequestLayout());
+
+ mMockParent.reset();
view.requestLayout();
assertTrue(view.isLayoutRequested());
assertTrue(mMockParent.hasRequestLayout());
@@ -883,6 +884,18 @@
assertFalse(view.isClickable());
}
+ public void testAccessContextClickable() {
+ View view = new View(mActivity);
+
+ assertFalse(view.isContextClickable());
+
+ view.setContextClickable(true);
+ assertTrue(view.isContextClickable());
+
+ view.setContextClickable(false);
+ assertFalse(view.isContextClickable());
+ }
+
public void testGetContextMenuInfo() {
MockView view = new MockView(mActivity);
@@ -1131,8 +1144,8 @@
mockView2.setParent(mMockParent);
mMockParent.dispatchSetSelected(true);
- assertFalse(mockView1.isSelected());
- assertFalse(mockView2.isSelected());
+ assertTrue(mockView1.isSelected());
+ assertTrue(mockView2.isSelected());
mMockParent.dispatchSetSelected(false);
assertFalse(mockView1.isSelected());
@@ -1155,8 +1168,8 @@
mockView2.setParent(mMockParent);
mMockParent.dispatchSetPressed(true);
- assertFalse(mockView1.isPressed());
- assertFalse(mockView2.isPressed());
+ assertTrue(mockView1.isPressed());
+ assertTrue(mockView2.isPressed());
mMockParent.dispatchSetPressed(false);
assertFalse(mockView1.isPressed());
@@ -1317,6 +1330,30 @@
assertTrue(view.isLongClickable());
}
+ public void testPerformContextClick() {
+ MockView view = new MockView(mActivity);
+ view.setParent(mMockParent);
+ OnContextClickListenerImpl listener = new OnContextClickListenerImpl();
+
+ view.setOnContextClickListener(listener);
+ assertFalse(listener.hasOnContextClick());
+
+ assertTrue(view.performContextClick());
+ assertTrue(listener.hasOnContextClick());
+ }
+
+ public void testSetOnContextClickListener() {
+ MockView view = new MockView(mActivity);
+ view.setParent(mMockParent);
+
+ assertFalse(view.performContextClick());
+ assertFalse(view.isContextClickable());
+
+ view.setOnContextClickListener(new OnContextClickListenerImpl());
+ assertTrue(view.performContextClick());
+ assertTrue(view.isContextClickable());
+ }
+
public void testAccessOnFocusChangeListener() {
View view = new View(mActivity);
OnFocusChangeListener listener = new OnFocusChangeListenerImpl();
@@ -3017,16 +3054,13 @@
@UiThreadTest
public void testScrollbarStyle() {
- MockView view = (MockView) mActivity.findViewById(R.id.mock_view);
+ MockView view = (MockView) mActivity.findViewById(R.id.scroll_view);
Bitmap bitmap = Bitmap.createBitmap(200, 300, Bitmap.Config.RGB_565);
BitmapDrawable d = new BitmapDrawable(bitmap);
view.setBackgroundDrawable(d);
view.setHorizontalFadingEdgeEnabled(true);
view.setVerticalFadingEdgeEnabled(true);
- view.setHorizontalScrollBarEnabled(true);
- view.setVerticalScrollBarEnabled(true);
- view.initializeScrollbars(mActivity.obtainStyledAttributes(android.R.styleable.View));
assertTrue(view.isHorizontalScrollBarEnabled());
assertTrue(view.isVerticalScrollBarEnabled());
int verticalScrollBarWidth = view.getVerticalScrollbarWidth();
@@ -3156,7 +3190,10 @@
public void testOnStartAndFinishTemporaryDetach() throws Throwable {
final MockListView listView = new MockListView(mActivity);
- List<String> items = Lists.newArrayList("1", "2", "3");
+ List<String> items = new ArrayList<>();
+ items.add("1");
+ items.add("2");
+ items.add("3");
final Adapter<String> adapter = new Adapter<String>(mActivity, 0, items);
runTestOnUiThread(new Runnable() {
@@ -3638,7 +3675,7 @@
}
}
- private final static class MockViewParent extends View implements ViewParent {
+ private final static class MockViewParent extends ViewGroup {
private boolean mHasClearChildFocus = false;
private boolean mHasRequestLayout = false;
private boolean mHasCreateContextMenu = false;
@@ -3678,12 +3715,12 @@
}
@Override
- protected void dispatchSetPressed(boolean pressed) {
+ public void dispatchSetPressed(boolean pressed) {
super.dispatchSetPressed(pressed);
}
@Override
- protected void dispatchSetSelected(boolean selected) {
+ public void dispatchSetSelected(boolean selected) {
super.dispatchSetSelected(selected);
}
@@ -3716,23 +3753,15 @@
return false;
}
+ @Override
+ protected void onLayout(boolean changed, int l, int t, int r, int b) {
+
+ }
+
public boolean hasGetChildVisibleRect() {
return mHasGetChildVisibleRect;
}
- public void invalidateChild(View child, Rect r) {
- mTempRect = new Rect(r);
- mHasInvalidateChild = true;
- }
-
- public Rect getTempRect() {
- return mTempRect;
- }
-
- public boolean hasInvalidateChild() {
- return mHasInvalidateChild;
- }
-
public ViewParent invalidateChildInParent(int[] location, Rect r) {
return null;
}
@@ -3753,6 +3782,7 @@
}
+ @Override
public void requestLayout() {
mHasRequestLayout = true;
}
@@ -3955,6 +3985,23 @@
}
}
+ private static final class OnContextClickListenerImpl implements OnContextClickListener {
+ private boolean mHasContextClick = false;
+
+ public boolean hasOnContextClick() {
+ return mHasContextClick;
+ }
+
+ public void reset() {
+ mHasContextClick = false;
+ }
+
+ public boolean onContextClick(View v) {
+ mHasContextClick = true;
+ return true;
+ }
+ }
+
private static final class OnFocusChangeListenerImpl implements OnFocusChangeListener {
private boolean mHasOnFocusChange = false;
diff --git a/tests/tests/view/src/android/view/cts/ViewTreeObserverTest.java b/tests/tests/view/src/android/view/cts/ViewTreeObserverTest.java
index 1b21dac..7071808 100644
--- a/tests/tests/view/src/android/view/cts/ViewTreeObserverTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewTreeObserverTest.java
@@ -25,8 +25,6 @@
import android.test.TouchUtils;
import android.view.View;
import android.view.ViewTreeObserver;
-import android.view.ViewTreeObserver.InternalInsetsInfo;
-import android.view.ViewTreeObserver.OnComputeInternalInsetsListener;
import android.view.ViewTreeObserver.OnGlobalFocusChangeListener;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.ViewTreeObserver.OnPreDrawListener;
@@ -155,22 +153,6 @@
}.run();
}
- public void testAddOnComputeInternalInsetsListener() {
- final View view1 = mActivity.findViewById(R.id.view1);
- mViewTreeObserver = view1.getViewTreeObserver();
-
- MockOnComputeInternalInsetsListener listener = new MockOnComputeInternalInsetsListener();
- mViewTreeObserver.addOnComputeInternalInsetsListener(listener);
- }
-
- public void testRemoveOnComputeInternalInsetsListener() {
- final View view1 = mActivity.findViewById(R.id.view1);
- mViewTreeObserver = view1.getViewTreeObserver();
-
- MockOnComputeInternalInsetsListener listener = new MockOnComputeInternalInsetsListener();
- mViewTreeObserver.removeOnComputeInternalInsetsListener(listener);
- }
-
public void testDispatchOnGlobalLayout() {
final LinearLayout layout = (LinearLayout) mActivity.findViewById(R.id.linearlayout);
mViewTreeObserver = layout.getViewTreeObserver();
@@ -434,12 +416,6 @@
}
}
- private class MockOnComputeInternalInsetsListener implements OnComputeInternalInsetsListener {
- @Override
- public void onComputeInternalInsets(InternalInsetsInfo inoutInfo) {
- }
- }
-
private static class MockOnScrollChangedListener implements OnScrollChangedListener {
private boolean mCalledOnScrollChanged = false;
diff --git a/tests/tests/view/src/android/view/cts/util/XmlUtils.java b/tests/tests/view/src/android/view/cts/util/XmlUtils.java
index 4a13d54..f1df4ff 100644
--- a/tests/tests/view/src/android/view/cts/util/XmlUtils.java
+++ b/tests/tests/view/src/android/view/cts/util/XmlUtils.java
@@ -16,8 +16,6 @@
package android.view.cts.util;
-import com.android.internal.util.FastXmlSerializer;
-
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
@@ -44,7 +42,6 @@
import java.util.Map;
import java.util.Set;
-/** {@hide} */
public class XmlUtils {
public static void skipCurrentTag(XmlPullParser parser)
@@ -171,28 +168,6 @@
}
/**
- * Flatten a Map into an output stream as XML. The map can later be
- * read back with readMapXml().
- *
- * @param val The map to be flattened.
- * @param out Where to write the XML data.
- *
- * @see #writeMapXml(Map, String, XmlSerializer)
- * @see #writeListXml
- * @see #writeValueXml
- * @see #readMapXml
- */
- public static final void writeMapXml(Map val, OutputStream out)
- throws XmlPullParserException, IOException {
- XmlSerializer serializer = new FastXmlSerializer();
- serializer.setOutput(out, StandardCharsets.UTF_8.name());
- serializer.startDocument(null, true);
- serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
- writeMapXml(val, null, serializer);
- serializer.endDocument();
- }
-
- /**
* Flatten a List into an output stream as XML. The list can later be
* read back with readListXml().
*
@@ -224,7 +199,6 @@
* none.
* @param out XmlSerializer to write the map into.
*
- * @see #writeMapXml(Map, OutputStream)
* @see #writeListXml
* @see #writeValueXml
* @see #readMapXml
@@ -244,7 +218,6 @@
* @param out XmlSerializer to write the map into.
* @param callback Method to call when an Object type is not recognized.
*
- * @see #writeMapXml(Map, OutputStream)
* @see #writeListXml
* @see #writeValueXml
* @see #readMapXml
@@ -278,7 +251,6 @@
* @param val The map to be flattened.
* @param out XmlSerializer to write the map into.
*
- * @see #writeMapXml(Map, OutputStream)
* @see #writeListXml
* @see #writeValueXml
* @see #readMapXml
diff --git a/tests/tests/widget/src/android/widget/cts/CursorAdapterTest.java b/tests/tests/widget/src/android/widget/cts/CursorAdapterTest.java
index 7fe016f..fc5eb08 100644
--- a/tests/tests/widget/src/android/widget/cts/CursorAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/CursorAdapterTest.java
@@ -21,7 +21,6 @@
import android.content.Context;
import android.content.res.Resources.Theme;
import android.cts.util.PollingCheck;
-import android.cts.util.ReadElf;
import android.cts.util.TestThread;
import android.database.ContentObserver;
import android.database.Cursor;
@@ -40,7 +39,6 @@
import com.android.cts.widget.R;
-
/**
* Test {@link CursorAdapter}.
*/
@@ -347,14 +345,23 @@
}
private final class MockCursorAdapter extends CursorAdapter {
+ private final Context mContext;
+ private final boolean mAutoRequery;
+
private boolean mContentChanged = false;
public MockCursorAdapter(Context context, Cursor c) {
super(context, c);
+
+ mContext = context;
+ mAutoRequery = false;
}
public MockCursorAdapter(Context context, Cursor c, boolean autoRequery) {
super(context, c, autoRequery);
+
+ mContext = context;
+ mAutoRequery = autoRequery;
}
public Context getContext() {
diff --git a/tests/tests/widget/src/android/widget/cts/GalleryTest.java b/tests/tests/widget/src/android/widget/cts/GalleryTest.java
index 2813965..a3ac16c 100644
--- a/tests/tests/widget/src/android/widget/cts/GalleryTest.java
+++ b/tests/tests/widget/src/android/widget/cts/GalleryTest.java
@@ -17,16 +17,17 @@
package android.widget.cts;
import com.android.cts.widget.R;
-import com.android.internal.view.menu.ContextMenuBuilder;
-
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import android.app.Activity;
import android.app.Instrumentation;
+import android.content.ComponentName;
import android.content.Context;
+import android.content.Intent;
import android.cts.util.WidgetTestUtils;
+import android.graphics.drawable.Drawable;
import android.os.SystemClock;
import android.test.ActivityInstrumentationTestCase2;
import android.test.UiThreadTest;
@@ -36,7 +37,8 @@
import android.view.ContextMenu;
import android.view.Gravity;
import android.view.KeyEvent;
-import android.view.MotionEvent;
+import android.view.MenuItem;
+import android.view.SubMenu;
import android.view.View;
import android.view.ViewGroup;
import android.view.ContextMenu.ContextMenuInfo;
@@ -311,11 +313,165 @@
MyGallery gallery = new MyGallery(mContext);
gallery.setOnCreateContextMenuListener(listener);
assertFalse(listener.hasCreatedContextMenu());
- gallery.createContextMenu(new ContextMenuBuilder(mContext));
+ gallery.createContextMenu(new MockContextMenu());
assertTrue(listener.hasCreatedContextMenu());
assertSame(gallery.getContextMenuInfo(), listener.getContextMenuInfo());
}
+ private static class MockContextMenu implements ContextMenu {
+ @Override
+ public ContextMenu setHeaderTitle(int titleRes) {
+ return null;
+ }
+
+ @Override
+ public ContextMenu setHeaderTitle(CharSequence title) {
+ return null;
+ }
+
+ @Override
+ public ContextMenu setHeaderIcon(int iconRes) {
+ return null;
+ }
+
+ @Override
+ public ContextMenu setHeaderIcon(Drawable icon) {
+ return null;
+ }
+
+ @Override
+ public ContextMenu setHeaderView(View view) {
+ return null;
+ }
+
+ @Override
+ public void clearHeader() {
+
+ }
+
+ @Override
+ public MenuItem add(CharSequence title) {
+ return null;
+ }
+
+ @Override
+ public MenuItem add(int titleRes) {
+ return null;
+ }
+
+ @Override
+ public MenuItem add(int groupId, int itemId, int order, CharSequence title) {
+ return null;
+ }
+
+ @Override
+ public MenuItem add(int groupId, int itemId, int order, int titleRes) {
+ return null;
+ }
+
+ @Override
+ public SubMenu addSubMenu(CharSequence title) {
+ return null;
+ }
+
+ @Override
+ public SubMenu addSubMenu(int titleRes) {
+ return null;
+ }
+
+ @Override
+ public SubMenu addSubMenu(int groupId, int itemId, int order,
+ CharSequence title) {
+ return null;
+ }
+
+ @Override
+ public SubMenu addSubMenu(int groupId, int itemId, int order, int titleRes) {
+ return null;
+ }
+
+ @Override
+ public int addIntentOptions(int groupId, int itemId, int order, ComponentName caller,
+ Intent[] specifics, Intent intent, int flags, MenuItem[] outSpecificItems) {
+ return 0;
+ }
+
+ @Override
+ public void removeItem(int id) {
+
+ }
+
+ @Override
+ public void removeGroup(int groupId) {
+
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public void setGroupCheckable(int group, boolean checkable, boolean exclusive) {
+
+ }
+
+ @Override
+ public void setGroupVisible(int group, boolean visible) {
+
+ }
+
+ @Override
+ public void setGroupEnabled(int group, boolean enabled) {
+
+ }
+
+ @Override
+ public boolean hasVisibleItems() {
+ return false;
+ }
+
+ @Override
+ public MenuItem findItem(int id) {
+ return null;
+ }
+
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public MenuItem getItem(int index) {
+ return null;
+ }
+
+ @Override
+ public void close() {
+
+ }
+
+ @Override
+ public boolean performShortcut(int keyCode, KeyEvent event, int flags) {
+ return false;
+ }
+
+ @Override
+ public boolean isShortcutKey(int keyCode, KeyEvent event) {
+ return false;
+ }
+
+ @Override
+ public boolean performIdentifierAction(int id, int flags) {
+ return false;
+ }
+
+ @Override
+ public void setQwertyMode(boolean isQwerty) {
+
+ }
+ }
+
private static class MockOnCreateContextMenuListener implements OnCreateContextMenuListener {
private boolean hasCreatedContextMenu;
private ContextMenuInfo mContextMenuInfo;
diff --git a/tests/tests/widget/src/android/widget/cts/MyGallery.java b/tests/tests/widget/src/android/widget/cts/MyGallery.java
index 91665ee..27b5d45 100644
--- a/tests/tests/widget/src/android/widget/cts/MyGallery.java
+++ b/tests/tests/widget/src/android/widget/cts/MyGallery.java
@@ -49,10 +49,6 @@
return super.getChildStaticTransformation(child, t);
}
- protected void setParent(ViewParent v) {
- mParent = v;
- }
-
@Override
protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
return super.checkLayoutParams(p);
diff --git a/tests/tests/widget/src/android/widget/cts/QuickContactBadgeTest.java b/tests/tests/widget/src/android/widget/cts/QuickContactBadgeTest.java
index cfd61a2..25d8e5e 100644
--- a/tests/tests/widget/src/android/widget/cts/QuickContactBadgeTest.java
+++ b/tests/tests/widget/src/android/widget/cts/QuickContactBadgeTest.java
@@ -21,8 +21,6 @@
import android.content.ContextWrapper;
import android.content.Intent;
import android.net.Uri;
-import android.os.Bundle;
-import android.os.UserHandle;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Contacts;
import android.test.InstrumentationTestCase;
@@ -39,22 +37,12 @@
final String plainMimeType = "text/plain";
final Uri nonExistentContactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, 0);
final CountDownLatch latch = new CountDownLatch(1);
- Context context = new ContextWrapper(getInstrumentation().getContext()) {
+ final Context context = new ContextWrapper(getInstrumentation().getContext()) {
@Override
public void startActivity(Intent intent) {
testCallback(intent);
}
- @Override
- public void startActivityAsUser(Intent intent, UserHandle user) {
- testCallback(intent);
- }
-
- @Override
- public void startActivityAsUser(Intent intent, Bundle options, UserHandle user) {
- testCallback(intent);
- }
-
private void testCallback(Intent intent) {
assertEquals(plainMimeType, intent.getStringExtra(
ContactsContract.QuickContact.EXTRA_PRIORITIZED_MIMETYPE));
diff --git a/tests/tests/widget/src/android/widget/cts/ResourceCursorAdapterTest.java b/tests/tests/widget/src/android/widget/cts/ResourceCursorAdapterTest.java
index 28bfd06..52d699b 100644
--- a/tests/tests/widget/src/android/widget/cts/ResourceCursorAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ResourceCursorAdapterTest.java
@@ -170,13 +170,19 @@
}
private static class MockResourceCursorAdapter extends ResourceCursorAdapter {
+ private final boolean mAutoRequery;
+
public MockResourceCursorAdapter(Context context, int layout, Cursor c) {
super(context, layout, c);
+
+ mAutoRequery = false;
}
public MockResourceCursorAdapter(Context context, int layout,
Cursor c, boolean autoRequery) {
super(context, layout, c, autoRequery);
+
+ mAutoRequery = autoRequery;
}
@Override
diff --git a/tests/tests/widget/src/android/widget/cts/TableLayoutTest.java b/tests/tests/widget/src/android/widget/cts/TableLayoutTest.java
index 5259736..b9f0d1f 100644
--- a/tests/tests/widget/src/android/widget/cts/TableLayoutTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TableLayoutTest.java
@@ -18,7 +18,6 @@
import com.android.cts.widget.R;
-
import android.content.Context;
import android.content.res.XmlResourceParser;
import android.test.ActivityInstrumentationTestCase2;
diff --git a/tests/tests/widget/src/android/widget/cts/TableLayout_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/TableLayout_LayoutParamsTest.java
index 8a38c81..cbc41ce 100644
--- a/tests/tests/widget/src/android/widget/cts/TableLayout_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TableLayout_LayoutParamsTest.java
@@ -16,7 +16,7 @@
package android.widget.cts;
-import com.android.internal.R;
+import com.android.cts.widget.R;
import org.xmlpull.v1.XmlPullParser;
@@ -140,8 +140,7 @@
XmlResourceParser parser = null;
AttributeSet attrs = null;
try {
- parser = mTargetContext.getResources()
- .getXml(com.android.cts.widget.R.xml.base_attributes);
+ parser = mTargetContext.getResources().getXml(R.xml.base_attributes);
int type;
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
diff --git a/tests/tests/widget/src/android/widget/cts/TableRow_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/TableRow_LayoutParamsTest.java
index 06f851d..8308414 100644
--- a/tests/tests/widget/src/android/widget/cts/TableRow_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TableRow_LayoutParamsTest.java
@@ -16,7 +16,7 @@
package android.widget.cts;
-import com.android.internal.R;
+import com.android.cts.widget.R;
import org.xmlpull.v1.XmlPullParser;
@@ -91,8 +91,8 @@
assertEquals(0, layoutParams.span);
TableCtsActivity activity = getActivity();
- activity.setContentView(com.android.cts.widget.R.layout.table_layout_2);
- int idTable = com.android.cts.widget.R.id.table2;
+ activity.setContentView(R.layout.table_layout_2);
+ int idTable = R.id.table2;
TableLayout tableLayout = (TableLayout) activity.findViewById(idTable);
View vVitural1 = ((TableRow) tableLayout.getChildAt(0)).getVirtualChildAt(1);
layoutParams = (TableRow.LayoutParams) vVitural1.getLayoutParams();
@@ -186,8 +186,7 @@
XmlResourceParser parser = null;
AttributeSet attrs = null;
try {
- parser = mTargetContext.getResources()
- .getXml(com.android.cts.widget.R.xml.base_attributes);
+ parser = mTargetContext.getResources().getXml(R.xml.base_attributes);
int type;
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
diff --git a/tests/tests/widget/src/android/widget/cts/TextViewTest.java b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
index 31a4636..936f38f 100644
--- a/tests/tests/widget/src/android/widget/cts/TextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
@@ -17,7 +17,6 @@
package android.widget.cts;
import com.android.cts.widget.R;
-import com.android.internal.util.FastMath;
import org.xmlpull.v1.XmlPullParserException;
@@ -786,37 +785,37 @@
float add = 1.2f;
float mult = 1.4f;
setLineSpacing(add, mult);
- assertEquals(FastMath.round(originalLineHeight * mult + add), mTextView.getLineHeight());
+ assertEquals(Math.round(originalLineHeight * mult + add), mTextView.getLineHeight());
add = 0.0f;
mult = 1.4f;
setLineSpacing(add, mult);
- assertEquals(FastMath.round(originalLineHeight * mult + add), mTextView.getLineHeight());
+ assertEquals(Math.round(originalLineHeight * mult + add), mTextView.getLineHeight());
// abnormal
add = -1.2f;
mult = 1.4f;
setLineSpacing(add, mult);
- assertEquals(FastMath.round(originalLineHeight * mult + add), mTextView.getLineHeight());
+ assertEquals(Math.round(originalLineHeight * mult + add), mTextView.getLineHeight());
add = -1.2f;
mult = -1.4f;
setLineSpacing(add, mult);
- assertEquals(FastMath.round(originalLineHeight * mult + add), mTextView.getLineHeight());
+ assertEquals(Math.round(originalLineHeight * mult + add), mTextView.getLineHeight());
add = 1.2f;
mult = 0.0f;
setLineSpacing(add, mult);
- assertEquals(FastMath.round(originalLineHeight * mult + add), mTextView.getLineHeight());
+ assertEquals(Math.round(originalLineHeight * mult + add), mTextView.getLineHeight());
// edge
add = Float.MIN_VALUE;
mult = Float.MIN_VALUE;
setLineSpacing(add, mult);
float expected = originalLineHeight * mult + add;
- assertEquals(FastMath.round(expected), mTextView.getLineHeight());
+ assertEquals(Math.round(expected), mTextView.getLineHeight());
add = Float.MAX_VALUE;
mult = Float.MAX_VALUE;
setLineSpacing(add, mult);
expected = originalLineHeight * mult + add;
- assertEquals(FastMath.round(expected), mTextView.getLineHeight());
+ assertEquals(Math.round(expected), mTextView.getLineHeight());
}
public void testInstanceState() {
diff --git a/tests/tests/widget/src/android/widget/cts/util/ListScenario.java b/tests/tests/widget/src/android/widget/cts/util/ListScenario.java
index 11d670d..b61673c 100644
--- a/tests/tests/widget/src/android/widget/cts/util/ListScenario.java
+++ b/tests/tests/widget/src/android/widget/cts/util/ListScenario.java
@@ -17,6 +17,7 @@
package android.widget.cts.util;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -35,8 +36,6 @@
import android.widget.ListView;
import android.widget.TextView;
-import com.google.android.collect.Maps;
-
/**
* Utility base class for creating various List scenarios. Configurable by the number
* of items, how tall each item should be (in relation to the screen height), and
@@ -52,7 +51,7 @@
private int mStartingSelectionPosition;
private double mItemScreenSizeFactor;
- private Map<Integer, Double> mOverrideItemScreenSizeFactors = Maps.newHashMap();
+ private Map<Integer, Double> mOverrideItemScreenSizeFactors = new HashMap<>();
private int mScreenHeight;
@@ -102,7 +101,7 @@
private double mItemScreenSizeFactor = 1 / 5;
private Double mFadingEdgeScreenSizeFactor = null;
- private Map<Integer, Double> mOverrideItemScreenSizeFactors = Maps.newHashMap();
+ private Map<Integer, Double> mOverrideItemScreenSizeFactors = new HashMap<>();
// separators
private List<Integer> mUnselectableItems = new ArrayList<Integer>(8);
diff --git a/tests/tests/widget/src/android/widget/cts/util/XmlUtils.java b/tests/tests/widget/src/android/widget/cts/util/XmlUtils.java
index c357e5e..1ff922f 100644
--- a/tests/tests/widget/src/android/widget/cts/util/XmlUtils.java
+++ b/tests/tests/widget/src/android/widget/cts/util/XmlUtils.java
@@ -16,8 +16,6 @@
package android.widget.cts.util;
-import com.android.internal.util.FastXmlSerializer;
-
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
@@ -171,28 +169,6 @@
}
/**
- * Flatten a Map into an output stream as XML. The map can later be
- * read back with readMapXml().
- *
- * @param val The map to be flattened.
- * @param out Where to write the XML data.
- *
- * @see #writeMapXml(Map, String, XmlSerializer)
- * @see #writeListXml
- * @see #writeValueXml
- * @see #readMapXml
- */
- public static final void writeMapXml(Map val, OutputStream out)
- throws XmlPullParserException, IOException {
- XmlSerializer serializer = new FastXmlSerializer();
- serializer.setOutput(out, StandardCharsets.UTF_8.name());
- serializer.startDocument(null, true);
- serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
- writeMapXml(val, null, serializer);
- serializer.endDocument();
- }
-
- /**
* Flatten a List into an output stream as XML. The list can later be
* read back with readListXml().
*
@@ -224,7 +200,6 @@
* none.
* @param out XmlSerializer to write the map into.
*
- * @see #writeMapXml(Map, OutputStream)
* @see #writeListXml
* @see #writeValueXml
* @see #readMapXml
@@ -244,7 +219,6 @@
* @param out XmlSerializer to write the map into.
* @param callback Method to call when an Object type is not recognized.
*
- * @see #writeMapXml(Map, OutputStream)
* @see #writeListXml
* @see #writeValueXml
* @see #readMapXml
@@ -278,7 +252,6 @@
* @param val The map to be flattened.
* @param out XmlSerializer to write the map into.
*
- * @see #writeMapXml(Map, OutputStream)
* @see #writeListXml
* @see #writeValueXml
* @see #readMapXml