Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd0a9bdb authored by Dmitri Plotnikov's avatar Dmitri Plotnikov Committed by Android Git Automerger
Browse files

am 7866b8a6: Merge "Prevent ActivityTestCase from erasing constants." into honeycomb

* commit '7866b8a6':
  Prevent ActivityTestCase from erasing constants.
parents 3065ab08 7866b8a6
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.test;
import android.app.Activity;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

/**
 * This is common code used to support Activity test cases.  For more useful classes, please see
@@ -62,7 +63,8 @@ public abstract class ActivityTestCase extends InstrumentationTestCase {
        final Field[] fields = getClass().getDeclaredFields();
        for (Field field : fields) {
            final Class<?> fieldClass = field.getDeclaringClass();
            if (testCaseClass.isAssignableFrom(fieldClass) && !field.getType().isPrimitive()) {
            if (testCaseClass.isAssignableFrom(fieldClass) && !field.getType().isPrimitive()
                    && (field.getModifiers() & Modifier.FINAL) == 0) {
                try {
                    field.setAccessible(true);
                    field.set(this, null);