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

Commit b7fe2f99 authored by Chi Zhang's avatar Chi Zhang Committed by Gerrit Code Review
Browse files

Merge "Enable proguard for telephony library."

parents eddd69f2 1d177d71
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -136,4 +136,11 @@ java_library {
            enabled: false,
        },
    },

    optimize: {
        enabled: true,
        shrink: true,
        obfuscate: false,
        proguard_flags_files: ["proguard.flags"],
    },
}

proguard.flags

0 → 100644
+29 −0
Original line number Diff line number Diff line
# Uncomment the following to show all included rules during build
#-printconfiguration

# Generate usage file (for shrinking)
-printusage

# Keep deprecated GSM SMS API
-keepclasseswithmembers class android.telephony.gsm.SmsManager {
public *;
}
-keepclasseswithmembers class android.telephony.gsm.SmsMessage {
public *;
}

# Keep telephony sysprop
-keepclasseswithmembers class android.internal.telephony.sysprop.TelephonyProperties {
public *;
}

# Keep public classes and members
-keepclasseswithmembers class com.android.internal.telephony.** {
public *;
}

# Keep classes and members that have the @UnsupportedAppUsage annotation
-keep @**.UnsupportedAppUsage class *
-keepclassmembers class * {
@**.UnsupportedAppUsage *;
}
+4 −3
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.telephony.PhoneNumberUtils;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.imsphone.ImsPhoneConnection;
import com.android.internal.telephony.sip.SipPhone;
import com.android.telephony.Rlog;
@@ -61,14 +62,14 @@ public class CallManager {
    private static final boolean VDBG = false;

    private static final int EVENT_DISCONNECT = 100;
    private static final int EVENT_PRECISE_CALL_STATE_CHANGED = 101;
    @VisibleForTesting static final int EVENT_PRECISE_CALL_STATE_CHANGED = 101;
    private static final int EVENT_NEW_RINGING_CONNECTION = 102;
    private static final int EVENT_UNKNOWN_CONNECTION = 103;
    private static final int EVENT_INCOMING_RING = 104;
    private static final int EVENT_RINGBACK_TONE = 105;
    @VisibleForTesting static final int EVENT_RINGBACK_TONE = 105;
    private static final int EVENT_IN_CALL_VOICE_PRIVACY_ON = 106;
    private static final int EVENT_IN_CALL_VOICE_PRIVACY_OFF = 107;
    private static final int EVENT_CALL_WAITING = 108;
    @VisibleForTesting static final int EVENT_CALL_WAITING = 108;
    private static final int EVENT_DISPLAY_INFO = 109;
    private static final int EVENT_SIGNAL_INFO = 110;
    private static final int EVENT_CDMA_OTA_STATUS_CHANGE = 111;
+1 −1
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@ public class ImsPhoneConnection extends Connection implements
    private static final int EVENT_DTMF_DELAY_DONE = 5;

    //***** Constants
    private static final int PAUSE_DELAY_MILLIS = 3 * 1000;
    @VisibleForTesting static final int PAUSE_DELAY_MILLIS = 3 * 1000;
    private static final int WAKE_LOCK_TIMEOUT_MILLIS = 60*1000;

    //***** Inner Classes
+3 −16
Original line number Diff line number Diff line
@@ -46,8 +46,6 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;

import java.lang.reflect.Field;

@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
public class CallManagerTest extends TelephonyTest {
@@ -212,23 +210,12 @@ public class CallManagerTest extends TelephonyTest {

    @Test @SmallTest
    public void testRegisterEvent() throws Exception {
        Field field = CallManager.class.getDeclaredField("EVENT_CALL_WAITING");
        field.setAccessible(true);
        int mEvent = (Integer) field.get(CallManager.getInstance());
        verify(mPhone, times(1)).registerForCallWaiting(isA(Handler.class),
                eq(mEvent), isNull());

        field = CallManager.class.getDeclaredField("EVENT_PRECISE_CALL_STATE_CHANGED");
        field.setAccessible(true);
        mEvent = (Integer) field.get(CallManager.getInstance());
                eq(CallManager.EVENT_CALL_WAITING), isNull());
        verify(mPhone, times(1)).registerForPreciseCallStateChanged(isA(Handler.class),
                eq(mEvent), isA(Object.class));

        field = CallManager.class.getDeclaredField("EVENT_RINGBACK_TONE");
        field.setAccessible(true);
        mEvent = (Integer) field.get(CallManager.getInstance());
                eq(CallManager.EVENT_PRECISE_CALL_STATE_CHANGED), isA(Object.class));
        verify(mPhone, times(1)).registerForRingbackTone(isA(Handler.class),
                eq(mEvent), isA(Object.class));
                eq(CallManager.EVENT_RINGBACK_TONE), isA(Object.class));
    }

    @Test @SmallTest
Loading