diff --git a/tests/Android.mk b/tests/Android.mk
index e8a7383..525b39e 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -19,7 +19,8 @@ include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- org.cyanogenmod.platform.sdk
+ org.cyanogenmod.platform.sdk \
+ android-support-test
LOCAL_SRC_FILES := $(call all-subdir-java-files, src/)
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 8eeb269..5016a35 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -22,7 +22,8 @@
-
+
@@ -79,6 +80,6 @@
diff --git a/tests/README.md b/tests/README.md
index a6e3b0c..9d32357 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -4,4 +4,4 @@ tests which can be ran utilizing the InstrumentationTestRunner from android.
To run the tests (on a live device):
- ```adb shell am instrument -w org.cyanogenmod.tests/android.test.InstrumentationTestRunner```
+ ```adb shell am instrument -w org.cyanogenmod.tests/android.support.test.runner.AndroidJUnitRunner```
diff --git a/tests/src/org/cyanogenmod/tests/CyanogenModTestApplication.java b/tests/src/org/cyanogenmod/tests/CyanogenModTestApplication.java
new file mode 100644
index 0000000..a738908
--- /dev/null
+++ b/tests/src/org/cyanogenmod/tests/CyanogenModTestApplication.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2016, The CyanogenMod 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 org.cyanogenmod.tests;
+
+import android.app.Application;
+import android.content.Context;
+
+/**
+ * Created by adnan on 2/4/16.
+ */
+public class CyanogenModTestApplication extends Application {
+ private static Context sApplicationContext;
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ sApplicationContext = getApplicationContext();
+ }
+
+ public static Context getStaticApplicationContext() {
+ return sApplicationContext;
+ }
+}
diff --git a/tests/src/org/cyanogenmod/tests/versioning/unit/BinderTransactionTest.java b/tests/src/org/cyanogenmod/tests/versioning/unit/BinderTransactionTest.java
new file mode 100644
index 0000000..b83b727
--- /dev/null
+++ b/tests/src/org/cyanogenmod/tests/versioning/unit/BinderTransactionTest.java
@@ -0,0 +1,165 @@
+/**
+ * Copyright (c) 2016, The CyanogenMod 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 org.cyanogenmod.tests.versioning.unit;
+
+import android.content.Context;
+import android.os.Binder;
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.LargeTest;
+import android.test.suitebuilder.annotation.SmallTest;
+import org.cyanogenmod.tests.CyanogenModTestApplication;
+import org.cyanogenmod.tests.versioning.unit.apiv2.ApiV2PriorReleaseInterfaces;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import android.support.test.runner.AndroidJUnit4;
+import android.support.test.runner.AndroidJUnitRunner;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * These tests validate the enumerated binder transaction call ids per each
+ * release api level against the current framework.
+ *
+ * This is to validate that no interface contracts are broken in terms of binder
+ * call method mapping between releases.
+ *
+ * After too much searching on the internet, I found that no one was bored enough to
+ * spend time on this awesomely boring concept. But I am.
+ *
+ * Also this is a fun endeavour into parameterized unit testing, and by fun, I mean
+ * horrible and full of drinking.
+ *
+ * If you need to blame anyone for this concept, look no further than danesh@cyngn.com
+ */
+@RunWith(Parameterized.class)
+@LargeTest
+public class BinderTransactionTest extends AndroidTestCase {
+ private static final String STUB_SUFFIX = "$Stub";
+ private static final String CYANOGENMOD_NAMESPACE = "cyanogenmod";
+ private static final String TRANSACTION_PREFIX = "TRANSACTION_";
+
+ private static final int NOT_FROM_PRIOR_RELEASE = -1;
+
+ private String mField;
+ private int mExpectedValue;
+ private int mActualValue;
+ private static Context sContext;
+
+ private static ArrayList mKnownSdkClasses;
+ private static Map mApiMethodsAndValues = new HashMap();
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Test
+ public void testClassLoaderGivesSDKClasses() {
+ /**
+ * Verify we can retrieve our sdk classes from this package
+ */
+ assertNotNull(mKnownSdkClasses);
+ assertTrue(mKnownSdkClasses.size() > 0);
+ }
+
+ private static void doSetup() {
+ mKnownSdkClasses = MagicalDexHelper.getLoadedClasses(
+ CyanogenModTestApplication.getStaticApplicationContext(), CYANOGENMOD_NAMESPACE);
+ sContext = CyanogenModTestApplication.getStaticApplicationContext();
+ mApiMethodsAndValues.putAll(ApiV2PriorReleaseInterfaces.getInterfaces());
+ }
+
+ @Parameterized.Parameters
+ public static Collection