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

Commit aea3240c authored by Ling Ma's avatar Ling Ma Committed by Jack Yu
Browse files

Add optional phoneId for SST TelephonyTester override

optionally specify phoneId for a SST override. If not specified, the
override applies to all phones.

Bug: 244064524
Test: adb shell am broadcast -a com.android.internal.telephony.TestServiceState --ei data_reg_state 1 --ei phone_id 1
Merged-In: I0a1ecfce2922d56a2480aba94cf3bc8c606f83c5
Change-Id: I0a1ecfce2922d56a2480aba94cf3bc8c606f83c5
parent 61cc4387
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -557,10 +557,6 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
                .makeAppSmsManager(context);
        mLocalLog = new LocalLog(64);

        if (TelephonyUtils.IS_DEBUGGABLE) {
            mTelephonyTester = new TelephonyTester(this);
        }

        setUnitTestMode(unitTestMode);

        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
@@ -600,6 +596,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
            return;
        }

        if (TelephonyUtils.IS_DEBUGGABLE) {
            mTelephonyTester = new TelephonyTester(this);
        }

        // Initialize device storage and outgoing SMS usage monitors for SMSDispatchers.
        mTelephonyComponentFactory = telephonyComponentFactory;
        mSmsStorageMonitor = mTelephonyComponentFactory.inject(SmsStorageMonitor.class.getName())
+11 −4
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ import java.util.List;
 *
 */
public class TelephonyTester {
    private static final String LOG_TAG = "TelephonyTester";
    private static final boolean DBG = true;

    /**
@@ -144,6 +143,7 @@ public class TelephonyTester {
            "com.android.internal.telephony.TestServiceState";

    private static final String EXTRA_ACTION = "action";
    private static final String EXTRA_PHONE_ID = "phone_id";
    private static final String EXTRA_VOICE_RAT = "voice_rat";
    private static final String EXTRA_DATA_RAT = "data_rat";
    private static final String EXTRA_VOICE_REG_STATE = "voice_reg_state";
@@ -157,6 +157,8 @@ public class TelephonyTester {

    private static final String ACTION_RESET = "reset";

    private String mLogTag;

    private static List<ImsExternalCallState> mImsExternalCallStates = null;

    private Intent mServiceStateTestIntent;
@@ -216,7 +218,7 @@ public class TelephonyTester {
                    if (DBG) log("onReceive: unknown action=" + action);
                }
            } catch (BadParcelableException e) {
                Rlog.w(LOG_TAG, e);
                Rlog.w(mLogTag, e);
            }
        }
    };
@@ -225,6 +227,7 @@ public class TelephonyTester {
        mPhone = phone;

        if (TelephonyUtils.IS_DEBUGGABLE) {
            mLogTag = "TelephonyTester-" + mPhone.getPhoneId();
            IntentFilter filter = new IntentFilter();

            filter.addAction(mPhone.getActionDetached());
@@ -261,8 +264,8 @@ public class TelephonyTester {
        }
    }

    private static void log(String s) {
        Rlog.d(LOG_TAG, s);
    private void log(String s) {
        Rlog.d(mLogTag, s);
    }

    private void handleSuppServiceFailedIntent(Intent intent) {
@@ -387,6 +390,10 @@ public class TelephonyTester {

    void overrideServiceState(ServiceState ss) {
        if (mServiceStateTestIntent == null || ss == null) return;
        if (mPhone.getPhoneId() != mServiceStateTestIntent.getIntExtra(
                EXTRA_PHONE_ID, mPhone.getPhoneId())) {
            return;
        }
        if (mServiceStateTestIntent.hasExtra(EXTRA_ACTION)
                && ACTION_RESET.equals(mServiceStateTestIntent.getStringExtra(EXTRA_ACTION))) {
            log("Service state override reset");