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

Commit 9deead63 authored by Tingting Wang's avatar Tingting Wang
Browse files

Using Proguard to shrink apk size.

Contacts proguard.flags change, add keep class for tests.

BUG 27314641

Change-Id: I4a169e50602ebdcea197baa54f4f887a76acdeb5
(cherry picked from commit 6035674bd506f3c9bdb49c9ce271747d7eff229e)
parent 9b86e305
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -10,6 +10,14 @@
}

-keep class com.android.contacts.common.** { *;}
# For test:
-keep class com.android.contacts.commonbind.analytics.AnalyticsUtil { *;}
-keep class com.android.contacts.interactions.** { *;}
-keep class com.google.common.base.Objects { *;}
-keep class com.google.common.base.Preconditions { *;}
-keep class com.google.common.collect.Lists { *;}
-keep class com.google.common.collect.Maps { *;}
-keep class com.google.common.collect.Sets { *;}

# Any class or method annotated with NeededForTesting or NeededForReflection.
-keep @com.android.contacts.common.testing.NeededForTesting class *
@@ -18,5 +26,10 @@
@com.android.contacts.common.testing.NeededForTesting *;
@com.android.contacts.test.NeededForReflection *;
}
# Keep classes and methods that have the guava @VisibleForTesting annotation
-keep @com.google.common.annotations.VisibleForTesting class *
-keepclassmembers class * {
  @com.google.common.annotations.VisibleForTesting *;
}

-verbose
+2 −0
Original line number Diff line number Diff line
@@ -33,8 +33,10 @@ import com.android.contacts.common.testing.InjectedServices;
import com.android.contacts.common.util.Constants;
import com.android.contacts.commonbind.analytics.AnalyticsUtil;

import com.android.contacts.common.testing.NeededForTesting;
import com.google.common.annotations.VisibleForTesting;

@NeededForTesting
public class ContactsApplication extends Application {
    private static final boolean ENABLE_LOADER_LOG = false; // Don't submit with true
    private static final boolean ENABLE_FRAGMENT_LOG = false; // Don't submit with true
+3 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import java.util.Set;
/**
 * Utility methods for the "account changed" notification in the new contact creation flow.
 */
@NeededForTesting
public class ContactEditorUtils {
    private static final String TAG = "ContactEditorUtils";

@@ -119,6 +120,7 @@ public class ContactEditorUtils {
     * @param defaultAccount the account used to save a newly created contact.  Or pass {@code null}
     *     If the user selected "local only".
     */
    @NeededForTesting
    public void saveDefaultAndAllAccounts(AccountWithDataSet defaultAccount) {
        final SharedPreferences.Editor editor = mPrefs.edit()
                .putBoolean(mAnythingSavedKey, true);
@@ -210,6 +212,7 @@ public class ContactEditorUtils {
     * {@link #getDefaultAccount} will return a valid account.  (Either an account which still
     * exists, or {@code null} which should be interpreted as "local only".)
     */
    @NeededForTesting
    public boolean shouldShowAccountChangedNotification() {
        if (isFirstLaunch()) {
            return true;
+6 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import com.android.contacts.common.model.ValuesDelta;
import com.android.contacts.common.model.account.AccountType;
import com.android.contacts.common.model.account.GoogleAccountType;
import com.android.contacts.common.model.dataitem.DataKind;
import com.android.contacts.common.testing.NeededForTesting;
import com.android.contacts.common.util.MaterialColorMapUtils.MaterialPalette;
import com.android.contacts.util.ContactPhotoUtils;
import com.android.contacts.widget.QuickContactImageView;
@@ -64,6 +65,7 @@ import java.util.HashMap;
/**
 * Utility methods for creating contact editor.
 */
@NeededForTesting
public class EditorUiUtils {

    // Maps DataKind.mimeType to editor view layouts.
@@ -114,6 +116,7 @@ public class EditorUiUtils {
    /**
     * Returns the account name and account type labels to display for local accounts.
     */
    @NeededForTesting
    public static Pair<String,String> getLocalAccountInfo(Context context,
            String accountName, AccountType accountType) {
        if (TextUtils.isEmpty(accountName)) {
@@ -130,6 +133,7 @@ public class EditorUiUtils {
    /**
     * Returns the account name and account type labels to display for the given account type.
     */
    @NeededForTesting
    public static Pair<String,String> getAccountInfo(Context context, String accountName,
            AccountType accountType) {
        CharSequence accountTypeDisplayLabel = accountType.getDisplayLabel(context);
@@ -213,6 +217,7 @@ public class EditorUiUtils {
    /**
     * Returns a ringtone string based on the ringtone URI and version #.
     */
    @NeededForTesting
    public static String getRingtoneStringFromUri(Uri pickedUri, int currentVersion) {
        if (isNewerThanM(currentVersion)) {
            if (pickedUri == null) return ""; // silent ringtone
@@ -225,6 +230,7 @@ public class EditorUiUtils {
    /**
     * Returns a ringtone URI, based on the string and version #.
     */
    @NeededForTesting
    public static Uri getRingtoneUriFromString(String str, int currentVersion) {
        if (str != null) {
            if (isNewerThanM(currentVersion) && TextUtils.isEmpty(str)) return null;