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

Commit f0a714e2 authored by Flavio Lerda's avatar Flavio Lerda Committed by Android (Google) Code Review
Browse files

Merge "Introduce a NeededForTesting annotation."

parents 573f9722 155c0708
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -24,3 +24,9 @@
-keep class ** {
  *** *ForTest(...);
}

# Any class or method annotated with NeededForTesting.
-keep @com.android.contacts.test.NeededForTesting class *
-keepclassmembers class * {
@com.android.contacts.test.NeededForTesting *;
}
+3 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.contacts.calllog;

import com.android.contacts.R;
import com.android.contacts.test.NeededForTesting;
import com.google.common.collect.Lists;

import android.content.Context;
@@ -64,10 +65,12 @@ public class CallTypeIconsView extends View {
        invalidate();
    }

    @NeededForTesting
    public int getCount() {
        return mCallTypes.size();
    }

    @NeededForTesting
    public int getCallType(int index) {
        return mCallTypes.get(index);
    }
+30 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2011 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 com.android.contacts.test;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Denotes that the class, constructor, method or field is used by tests and therefore cannot be
 * removed by tools like ProGuard.
 */
@Retention(RetentionPolicy.CLASS)
@Target({ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.FIELD})
public @interface NeededForTesting {}
+3 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.contacts.util;

import com.android.contacts.test.NeededForTesting;

import android.util.LruCache;

import java.util.concurrent.atomic.AtomicInteger;
@@ -198,6 +200,7 @@ public class ExpirableCache<K, V> {
     *
     * @param key the key to look up
     */
    @NeededForTesting
    public V get(K key) {
        CachedValue<V> cachedValue = getCachedValue(key);
        return cachedValue == null || cachedValue.isExpired() ? null : cachedValue.getValue();
+3 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.contacts.util;

import com.android.contacts.test.NeededForTesting;

import android.database.Cursor;
import android.provider.ContactsContract.StreamItems;

@@ -46,6 +48,7 @@ public class StreamItemEntry implements Comparable<StreamItemEntry> {
    // Photos associated with this stream item.
    private List<StreamItemPhotoEntry> mPhotos;

    @NeededForTesting
    public StreamItemEntry(long id, String text, String comments, long timestamp, String action,
            String actionUri, String resPackage, int iconRes, int labelRes) {
        mId = id;