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

Commit bf471289 authored by Wink Saville's avatar Wink Saville
Browse files

Add FW support for CellInfo RIL commands.

Add being able to setCellInfoListRate.

Bug: 8235566
Change-Id: I7ad7dabc4b6c38bfba4461b08e6e30d0eb9efea1
parent 645e78d8
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -203,6 +203,14 @@
                android:layout_height="wrap_content"
                />

        <!-- CellInfoListRate -->
        <Button android:id="@+id/cell_info_list_rate"
                android:textSize="14sp"
                android:layout_marginTop="8dip"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                />

        <!-- IMS registration required -->
        <Button android:id="@+id/ims_reg_required"
                android:textSize="14sp"
+49 −15
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ public class RadioInfo extends Activity {
    private TextView dnsCheckState;
    private EditText smsc;
    private Button radioPowerButton;
    private Button cellInfoListRateButton;
    private Button dnsCheckToggleButton;
    private Button pingTestButton;
    private Button updateSmscButton;
@@ -167,9 +168,8 @@ public class RadioInfo extends Activity {

        @Override
        public void onCellInfoChanged(List<CellInfo> arrayCi) {
            Log.d(TAG, "[RadioInfo] onCellInfoChanged: arrayCi=" + arrayCi);
            mCellInfoValue = arrayCi;
            updateCellInfoTv();
            log("onCellInfoChanged: arrayCi=" + arrayCi);
            updateCellInfoTv(arrayCi);
        }
    };

@@ -195,7 +195,7 @@ public class RadioInfo extends Activity {
                    if (ar.exception == null) {
                        int type = ((int[])ar.result)[0];
                        if (type >= mPreferredNetworkLabels.length) {
                            Log.e(TAG, "[RadioInfo] EVENT_QUERY_PREFERRED_TYPE_DONE: unknown " +
                            log("EVENT_QUERY_PREFERRED_TYPE_DONE: unknown " +
                                    "type=" + type);
                            type = mPreferredNetworkLabels.length - 1;
                        }
@@ -289,6 +289,9 @@ public class RadioInfo extends Activity {
        radioPowerButton = (Button) findViewById(R.id.radio_power);
        radioPowerButton.setOnClickListener(mPowerButtonHandler);

        cellInfoListRateButton = (Button) findViewById(R.id.cell_info_list_rate);
        cellInfoListRateButton.setOnClickListener(mCellInfoListRateHandler);

        imsRegRequiredButton = (Button) findViewById(R.id.ims_reg_required);
        imsRegRequiredButton.setOnClickListener(mImsRegRequiredHandler);

@@ -330,7 +333,7 @@ public class RadioInfo extends Activity {

        // Get current cell info
        mCellInfoValue = mTelephonyManager.getAllCellInfo();
        Log.d(TAG, "[RadioInfo] onCreate: mCellInfoValue=" + mCellInfoValue);
        log("onCreate: mCellInfoValue=" + mCellInfoValue);
    }

    @Override
@@ -347,13 +350,14 @@ public class RadioInfo extends Activity {
        updateDataStats();
        updateDataStats2();
        updatePowerState();
        updateCellInfoListRate();
        updateImsRegRequiredState();
        updateSmsOverImsState();
        updateLteRamDumpState();
        updateProperties();
        updateDnsCheckState();

        Log.i(TAG, "[RadioInfo] onResume: register phone & data intents");
        log("onResume: register phone & data intents");

        mPhoneStateReceiver.registerIntent();
        mTelephonyManager.listen(mPhoneStateListener,
@@ -369,7 +373,7 @@ public class RadioInfo extends Activity {
    public void onPause() {
        super.onPause();

        Log.i(TAG, "[RadioInfo] onPause: unregister phone & data intents");
        log("onPause: unregister phone & data intents");

        mPhoneStateReceiver.unregisterIntent();
        mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
@@ -427,6 +431,11 @@ public class RadioInfo extends Activity {
        radioPowerButton.setText(buttonText);
    }

    private void updateCellInfoListRate() {
        cellInfoListRateButton.setText("CellInfoListRate " + mCellInfoListRateHandler.getRate());
        updateCellInfoTv(mTelephonyManager.getAllCellInfo());
    }

    private void updateDnsCheckState() {
        dnsCheckState.setText(phone.isDnsCheckDisabled() ?
                "0.0.0.0 allowed" :"0.0.0.0 not allowed");
@@ -514,7 +523,8 @@ public class RadioInfo extends Activity {
        mNeighboringCids.setText(sb.toString());
    }

    private final void updateCellInfoTv() {
    private final void updateCellInfoTv(List<CellInfo> arrayCi) {
        mCellInfoValue = arrayCi;
        StringBuilder value = new StringBuilder();
        if (mCellInfoValue != null) {
            int index = 0;
@@ -918,12 +928,32 @@ public class RadioInfo extends Activity {
        }
    };

    class CellInfoListRateHandler implements OnClickListener {
        int rates[] = {Integer.MAX_VALUE, 0, 1000};
        int index = 0;

        public int getRate() {
            return rates[index];
        }

        @Override
        public void onClick(View v) {
            index += 1;
            if (index >= rates.length) {
                index = 0;
            }
            phone.setCellInfoListRate(rates[index]);
            updateCellInfoListRate();
        }
    }
    CellInfoListRateHandler mCellInfoListRateHandler = new CellInfoListRateHandler();

    private Button imsRegRequiredButton;
    static final String PROPERTY_IMS_REG_REQUIRED = "persist.radio.imsregrequired";
    OnClickListener mImsRegRequiredHandler = new OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.d(TAG, String.format("toggle %s: currently %s",
            log(String.format("toggle %s: currently %s",
                PROPERTY_IMS_REG_REQUIRED, (isImsRegRequired() ? "on":"off")));
            boolean newValue = !isImsRegRequired();
            SystemProperties.set(PROPERTY_IMS_REG_REQUIRED,
@@ -937,7 +967,7 @@ public class RadioInfo extends Activity {
    }

    private void updateImsRegRequiredState() {
        Log.d(TAG, "updateImsRegRequiredState isImsRegRequired()=" + isImsRegRequired());
        log("updateImsRegRequiredState isImsRegRequired()=" + isImsRegRequired());
        String buttonText = isImsRegRequired() ?
                            getString(R.string.ims_reg_required_off) :
                            getString(R.string.ims_reg_required_on);
@@ -949,7 +979,7 @@ public class RadioInfo extends Activity {
    OnClickListener mSmsOverImsHandler = new OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.d(TAG, String.format("toggle %s: currently %s",
            log(String.format("toggle %s: currently %s",
                    PROPERTY_SMS_OVER_IMS, (isSmsOverImsEnabled() ? "on":"off")));
            boolean newValue = !isSmsOverImsEnabled();
            SystemProperties.set(PROPERTY_SMS_OVER_IMS, newValue ? "1":"0");
@@ -962,7 +992,7 @@ public class RadioInfo extends Activity {
    }

    private void updateSmsOverImsState() {
        Log.d(TAG, "updateSmsOverImsState isSmsOverImsEnabled()=" + isSmsOverImsEnabled());
        log("updateSmsOverImsState isSmsOverImsEnabled()=" + isSmsOverImsEnabled());
        String buttonText = isSmsOverImsEnabled() ?
                            getString(R.string.sms_over_ims_off) :
                            getString(R.string.sms_over_ims_on);
@@ -974,7 +1004,7 @@ public class RadioInfo extends Activity {
    OnClickListener mLteRamDumpHandler = new OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.d(TAG, String.format("toggle %s: currently %s",
            log(String.format("toggle %s: currently %s",
                    PROPERTY_LTE_RAM_DUMP, (isSmsOverImsEnabled() ? "on":"off")));
            boolean newValue = !isLteRamDumpEnabled();
            SystemProperties.set(PROPERTY_LTE_RAM_DUMP, newValue ? "1":"0");
@@ -987,7 +1017,7 @@ public class RadioInfo extends Activity {
    }

    private void updateLteRamDumpState() {
        Log.d(TAG, "updateLteRamDumpState isLteRamDumpEnabled()=" + isLteRamDumpEnabled());
        log("updateLteRamDumpState isLteRamDumpEnabled()=" + isLteRamDumpEnabled());
        String buttonText = isLteRamDumpEnabled() ?
                            getString(R.string.lte_ram_dump_off) :
                            getString(R.string.lte_ram_dump_on);
@@ -1007,7 +1037,7 @@ public class RadioInfo extends Activity {
            try {
                startActivity(intent);
            } catch (android.content.ActivityNotFoundException ex) {
                Log.d(TAG, "OEM-specific Info/Settings Activity Not Found : " + ex);
                log("OEM-specific Info/Settings Activity Not Found : " + ex);
                // If the activity does not exist, there are no OEM
                // settings, and so we can just do nothing...
            }
@@ -1061,4 +1091,8 @@ public class RadioInfo extends Activity {
            "LTE/GSM/CDMA auto (PRL)",
            "LTE only",
            "Unknown"};

    private void log(String s) {
        Log.d(TAG, "[RadioInfo] " + s);
    }
}