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

Commit c353de47 authored by Hall Liu's avatar Hall Liu Committed by Gerrit Code Review
Browse files

Merge changes from topic "add-telephony-mts"

* changes:
  Add mts to test modules, fix tests
  apply jarjar rule for telephonyTest
  telephony-stack util API lib
parents a0891719 ba42992e
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -35,6 +35,10 @@ filegroup {
    ],
    path: "src/java",
}
filegroup {
    name: "jarjar-rules-shared",
    srcs: ["jarjar-rules-shared.txt"],
}

java_library {
    name: "telephony-common",
@@ -45,11 +49,12 @@ java_library {
    },
    srcs: [
        ":opt-telephony-common-srcs",
        ":framework-telephony-stack-shared-srcs",
        "src/java/**/I*.aidl",
        "src/java/**/*.logtags",
    ],

    jarjar_rules: ":framework-jarjar-rules",
    jarjar_rules: ":jarjar-rules-shared",

    libs: [
        "android.hardware.radio-V1.0-java",
+14 −0
Original line number Diff line number Diff line
rule android.os.RegistrantList* com.android.internal.telephony.RegistrantList@1
rule android.os.Registrant* com.android.internal.telephony.Registrant@1
rule android.hidl.** android.internal.hidl.@1
rule android.util.LocalLog* com.android.internal.telephony.LocalLog@1
rule android.util.Slog* com.android.internal.telephony.Slog@1
rule android.util.TimeUtils* com.android.internal.telephony.TimeUtils@1
rule com.android.internal.util.Preconditions* com.android.internal.telephony.Preconditions@1
rule com.android.internal.os.SomeArgs* com.android.internal.telephony.SomeArgs@1
rule com.android.internal.util.DumpUtils* com.android.internal.telephony.DumpUtils@1
rule com.android.internal.util.XmlUtils* com.android.internal.telephony.XmlUtils@1
rule com.android.internal.util.HexDump* com.android.internal.telephony.HexDump@1
rule com.android.internal.util.State* com.android.internal.telephony.State@1
rule com.android.internal.util.StateMachine* com.android.internal.telephony.StateMachine@1
rule com.android.internal.util.IndentingPrintWriter* com.android.internal.telephony.IndentingPrintWriter@1
 No newline at end of file
+0 −3
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ import android.telephony.CellLocation;
import android.telephony.DisconnectCause;
import android.telephony.PhoneNumberUtils;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.telephony.cdma.CdmaCellLocation;
import android.telephony.gsm.GsmCellLocation;
@@ -897,8 +896,6 @@ public class GsmCdmaCallTracker extends CallTracker {
                                hoConnection.mPreHandoverState != GsmCdmaCall.State.HOLDING &&
                                dc.state == DriverCall.State.ACTIVE) {
                            mConnections[i].onConnectedInOrOut();
                        } else {
                            mConnections[i].onConnectedConnectionMigrated();
                        }

                        mHandoverConnections.remove(hoConnection);
+2 −89
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.PersistableBundle;
import android.os.PowerManager;
import android.os.Registrant;
import android.os.SystemClock;
import android.telephony.CarrierConfigManager;
@@ -74,8 +73,6 @@ public class GsmCdmaConnection extends Connection {

    Handler mHandler;

    private PowerManager.WakeLock mPartialWakeLock;

    // The cached delay to be used between DTMF tones fetched from carrier config.
    private int mDtmfToneDelay = 0;

@@ -88,13 +85,11 @@ public class GsmCdmaConnection extends Connection {
    static final int EVENT_DTMF_DONE = 1;
    static final int EVENT_PAUSE_DONE = 2;
    static final int EVENT_NEXT_POST_DIAL = 3;
    static final int EVENT_WAKE_LOCK_TIMEOUT = 4;
    static final int EVENT_DTMF_DELAY_DONE = 5;

    //***** Constants
    static final int PAUSE_DELAY_MILLIS_GSM = 3 * 1000;
    static final int PAUSE_DELAY_MILLIS_CDMA = 2 * 1000;
    static final int WAKE_LOCK_TIMEOUT_MILLIS = 60*1000;

    //***** Inner Classes

@@ -111,9 +106,6 @@ public class GsmCdmaConnection extends Connection {
                case EVENT_PAUSE_DONE:
                    processNextPostDialChar();
                    break;
                case EVENT_WAKE_LOCK_TIMEOUT:
                    releaseWakeLock();
                    break;
                case EVENT_DTMF_DONE:
                    // We may need to add a delay specified by carrier between DTMF tones that are
                    // sent out.
@@ -129,8 +121,6 @@ public class GsmCdmaConnection extends Connection {
    /** This is probably an MT call that we first saw in a CLCC response or a hand over. */
    public GsmCdmaConnection (GsmCdmaPhone phone, DriverCall dc, GsmCdmaCallTracker ct, int index) {
        super(phone.getPhoneType());
        createWakeLock(phone.getContext());
        acquireWakeLock();

        mOwner = ct;
        mHandler = new MyHandler(mOwner.getLooper());
@@ -161,8 +151,6 @@ public class GsmCdmaConnection extends Connection {
    public GsmCdmaConnection (GsmCdmaPhone phone, String dialString, GsmCdmaCallTracker ct,
                              GsmCdmaCall parent, boolean isEmergencyCall) {
        super(phone.getPhoneType());
        createWakeLock(phone.getContext());
        acquireWakeLock();

        mOwner = ct;
        mHandler = new MyHandler(mOwner.getLooper());
@@ -217,8 +205,6 @@ public class GsmCdmaConnection extends Connection {
    public GsmCdmaConnection(Context context, CdmaCallWaitingNotification cw, GsmCdmaCallTracker ct,
                             GsmCdmaCall parent) {
        super(parent.getPhone().getPhoneType());
        createWakeLock(context);
        acquireWakeLock();

        mOwner = ct;
        mHandler = new MyHandler(mOwner.getLooper());
@@ -242,7 +228,6 @@ public class GsmCdmaConnection extends Connection {
        if (mParent != null) {
            mParent.detach(this);
        }
        releaseAllWakeLocks();
    }

    static boolean equalsHandlesNulls(Object a, Object b) {
@@ -623,7 +608,6 @@ public class GsmCdmaConnection extends Connection {
            mOrigConnection = null;
        }
        clearPostDialListeners();
        releaseWakeLock();
        return changed;
    }

@@ -639,7 +623,6 @@ public class GsmCdmaConnection extends Connection {
                mParent.detach(this);
            }
        }
        releaseWakeLock();
    }

    // Returns true if state has changed, false if nothing changed
@@ -780,21 +763,7 @@ public class GsmCdmaConnection extends Connection {
        if (!mIsIncoming) {
            // outgoing calls only
            processNextPostDialChar();
        } else {
            // Only release wake lock for incoming calls, for outgoing calls the wake lock
            // will be released after any pause-dial is completed
            releaseWakeLock();
        }
        }

    /**
     * We have completed the migration of another connection to this GsmCdmaConnection (for example,
     * in the case of SRVCC) and not still DIALING/ALERTING/INCOMING/WAITING.
     */
    void onConnectedConnectionMigrated() {
        // We can release the wakelock in this case, the migrated call is not still
        // DIALING/ALERTING/INCOMING/WAITING.
        releaseWakeLock();
    }

    private void
@@ -881,17 +850,7 @@ public class GsmCdmaConnection extends Connection {
    @Override
    protected void finalize()
    {
        /**
         * It is understood that This finalizer is not guaranteed
         * to be called and the release lock call is here just in
         * case there is some path that doesn't call onDisconnect
         * and or onConnectedInOrOut.
         */
        if (mPartialWakeLock != null && mPartialWakeLock.isHeld()) {
            Rlog.e(LOG_TAG, "UNEXPECTED; mPartialWakeLock is held when finalizing.");
        }
        clearPostDialListeners();
        releaseWakeLock();
    }

    private void
@@ -900,7 +859,6 @@ public class GsmCdmaConnection extends Connection {
        Registrant postDialHandler;

        if (mPostDialState == PostDialState.CANCELLED) {
            releaseWakeLock();
            return;
        }

@@ -908,9 +866,6 @@ public class GsmCdmaConnection extends Connection {
                mPostDialString.length() <= mNextPostDialChar) {
            setPostDialState(PostDialState.COMPLETE);

            // We were holding a wake lock until pause-dial was complete, so give it up now
            releaseWakeLock();

            // notifyMessage.arg1 is 0 on complete
            c = 0;
        } else {
@@ -1004,60 +959,18 @@ public class GsmCdmaConnection extends Connection {
     * @param s new PostDialState
     */
    private void setPostDialState(PostDialState s) {
        if (s == PostDialState.STARTED ||
                s == PostDialState.PAUSE) {
            synchronized (mPartialWakeLock) {
                if (mPartialWakeLock.isHeld()) {
                    mHandler.removeMessages(EVENT_WAKE_LOCK_TIMEOUT);
                } else {
                    acquireWakeLock();
                }
                Message msg = mHandler.obtainMessage(EVENT_WAKE_LOCK_TIMEOUT);
                mHandler.sendMessageDelayed(msg, WAKE_LOCK_TIMEOUT_MILLIS);
            }
        } else {
            mHandler.removeMessages(EVENT_WAKE_LOCK_TIMEOUT);
            releaseWakeLock();
        }
        mPostDialState = s;
        notifyPostDialListeners();
    }

    @UnsupportedAppUsage
    private void createWakeLock(Context context) {
        PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
        mPartialWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG);
        // no-op
    }

    @UnsupportedAppUsage
    private void acquireWakeLock() {
        if (mPartialWakeLock != null) {
            synchronized (mPartialWakeLock) {
                log("acquireWakeLock");
                mPartialWakeLock.acquire();
            }
        }
    }

    private void releaseWakeLock() {
        if (mPartialWakeLock != null) {
            synchronized (mPartialWakeLock) {
                if (mPartialWakeLock.isHeld()) {
                    log("releaseWakeLock");
                    mPartialWakeLock.release();
                }
            }
        }
    }

    private void releaseAllWakeLocks() {
        if (mPartialWakeLock != null) {
            synchronized (mPartialWakeLock) {
                while (mPartialWakeLock.isHeld()) {
                    mPartialWakeLock.release();
                }
            }
        }
        // no-op
    }

    @UnsupportedAppUsage
+6 −1
Original line number Diff line number Diff line
@@ -24,5 +24,10 @@ android_test {
    ],

    platform_apis: true,
    test_suites: ["device-tests"],
    jarjar_rules: ":jarjar-rules-shared",

    test_suites: [
        "mts",
        "device-tests",
    ],
}
Loading