Example usage for android.telephony TelephonyManager PHONE_TYPE_SIP

List of usage examples for android.telephony TelephonyManager PHONE_TYPE_SIP

Introduction

In this page you can find the example usage for android.telephony TelephonyManager PHONE_TYPE_SIP.

Prototype

int PHONE_TYPE_SIP

To view the source code for android.telephony TelephonyManager PHONE_TYPE_SIP.

Click Source Link

Document

Phone is via SIP.

Usage

From source file:Main.java

public static String convertPhoneType(int type) {
    switch (type) {
    case TelephonyManager.PHONE_TYPE_NONE:
        return "NONE";
    case TelephonyManager.PHONE_TYPE_GSM:
        return "GSM";
    case TelephonyManager.PHONE_TYPE_CDMA:
        return "CDMA";
    case TelephonyManager.PHONE_TYPE_SIP:
        return "SIP";
    default://from  w  w w.  j  ava 2s. com
        return UNKNOWN;
    }
}

From source file:Main.java

/**
 * Returns a constant indicating the device phone type.
 * This indicates the type of radio used to transmit voice calls.
 * @param phone_type "getPhoneType()"// w w  w.jav  a 2 s.co m
 */
public static String getPhoneTypeStr(int phone_type) {
    switch (phone_type) {
    case TelephonyManager.PHONE_TYPE_NONE://0
        return "PHONE_TYPE_NONE";
    case TelephonyManager.PHONE_TYPE_GSM://1
        return "PHONE_TYPE_GSM";
    case TelephonyManager.PHONE_TYPE_CDMA://2
        return "PHONE_TYPE_CDMA";
    case TelephonyManager.PHONE_TYPE_SIP://3
        return "PHONE_TYPE_SIP";//API 11
    default:
        return UNKNOWN;
    }
}

From source file:com.secupwn.aimsicd.ui.fragments.DeviceFragment.java

private void updateUI() {
    HighlightTextView content;/*w  w w  . ja  va 2s. co m*/
    TableRow tr;
    if (mBound) {
        final AnimationManager ani = new AnimationManager();

        mAimsicdService.getCellTracker().refreshDevice();
        Device mDevice = mAimsicdService.getCellTracker().getDevice();
        switch (mDevice.getPhoneId()) {

        case TelephonyManager.PHONE_TYPE_NONE: // Maybe bad!
        case TelephonyManager.PHONE_TYPE_SIP: // Maybe bad!
        case TelephonyManager.PHONE_TYPE_GSM: {
            content = (HighlightTextView) getView().findViewById(R.id.network_lac);
            content.updateText(String.valueOf(mAimsicdService.getCell().getLocationAreaCode()), ani);
            tr = (TableRow) getView().findViewById(R.id.gsm_cellid);
            tr.setVisibility(View.VISIBLE);
            content = (HighlightTextView) getView().findViewById(R.id.network_cellid);
            content.updateText(String.valueOf(mAimsicdService.getCell().getCellId()), ani);
            break;
        }

        case TelephonyManager.PHONE_TYPE_CDMA: {
            tr = (TableRow) getView().findViewById(R.id.cdma_netid);
            tr.setVisibility(View.VISIBLE);
            content = (HighlightTextView) getView().findViewById(R.id.network_netid);
            content.updateText(String.valueOf(mAimsicdService.getCell().getLocationAreaCode()), ani);
            tr = (TableRow) getView().findViewById(R.id.cdma_sysid);
            tr.setVisibility(View.VISIBLE);
            content = (HighlightTextView) getView().findViewById(R.id.network_sysid);
            content.updateText(String.valueOf(mAimsicdService.getCell().getSid()), ani);
            tr = (TableRow) getView().findViewById(R.id.cdma_baseid);
            tr.setVisibility(View.VISIBLE);
            content = (HighlightTextView) getView().findViewById(R.id.network_baseid);
            content.updateText(String.valueOf(mAimsicdService.getCell().getCellId()), ani);
            break;
        }
        }

        if (mAimsicdService.getCell().getTimingAdvance() != Integer.MAX_VALUE) {
            tr = (TableRow) getView().findViewById(R.id.lte_timing_advance);
            tr.setVisibility(View.VISIBLE);
            content = (HighlightTextView) getView().findViewById(R.id.network_lte_timing_advance);
            content.updateText(String.valueOf(mAimsicdService.getCell().getTimingAdvance()), ani);
        } else {
            tr = (TableRow) getView().findViewById(R.id.lte_timing_advance);
            tr.setVisibility(View.GONE);
        }

        if (mAimsicdService.getCell().getPrimaryScramblingCode() != Integer.MAX_VALUE) {
            content = (HighlightTextView) getView().findViewById(R.id.network_psc);
            content.updateText(String.valueOf(mAimsicdService.getCell().getPrimaryScramblingCode()), ani);
            tr = (TableRow) getView().findViewById(R.id.primary_scrambling_code);
            tr.setVisibility(View.VISIBLE);
        }

        String notAvailable = getString(R.string.n_a);

        content = (HighlightTextView) getView().findViewById(R.id.sim_country);
        content.updateText(mDevice.getSimCountry().orElse(notAvailable), ani);
        content = (HighlightTextView) getView().findViewById(R.id.sim_operator_id);
        content.updateText(mDevice.getSimOperator().orElse(notAvailable), ani);
        content = (HighlightTextView) getView().findViewById(R.id.sim_operator_name);
        content.updateText(mDevice.getSimOperatorName().orElse(notAvailable), ani);
        content = (HighlightTextView) getView().findViewById(R.id.sim_imsi);
        content.updateText(mDevice.getSimSubs().orElse(notAvailable), ani);
        content = (HighlightTextView) getView().findViewById(R.id.sim_serial);
        content.updateText(mDevice.getSimSerial().orElse(notAvailable), ani);

        content = (HighlightTextView) getView().findViewById(R.id.device_type);
        content.updateText(mDevice.getPhoneType(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.device_imei);
        content.updateText(mDevice.getIMEI(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.device_version);
        content.updateText(mDevice.getIMEIv(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.network_name);
        content.updateText(mDevice.getNetworkName(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.network_code);
        content.updateText(mDevice.getMncMcc(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.network_type);
        content.updateText(mDevice.getNetworkTypeName(), ani);

        content = (HighlightTextView) getView().findViewById(R.id.data_activity);
        content.updateText(mDevice.getDataActivityType(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.data_status);
        content.updateText(mDevice.getDataState(), ani);
        content = (HighlightTextView) getView().findViewById(R.id.network_roaming);
        content.updateText(String.valueOf(mDevice.isRoaming()), ani);

        ani.startAnimation(5000);
    }
}

From source file:com.fallahpoor.infocenter.fragments.SimFragment.java

private String getPhoneType(TelephonyManager telephonyManager) {

    int phoneTypeInt = telephonyManager.getPhoneType();
    String phoneTypeStr;//  w w w.j a v a 2  s  .  c o m

    switch (phoneTypeInt) {
    case TelephonyManager.PHONE_TYPE_CDMA:
        phoneTypeStr = getString(R.string.sim_sub_item_cdma);
        break;
    case TelephonyManager.PHONE_TYPE_GSM:
        phoneTypeStr = getString(R.string.sim_sub_item_gsm);
        break;
    case TelephonyManager.PHONE_TYPE_SIP:
        phoneTypeStr = getString(R.string.sim_sub_item_sip);
        break;
    default:
        phoneTypeStr = getString(R.string.unknown);
    }

    return phoneTypeStr;

}

From source file:android_network.hetnet.vpn_service.Util.java

public static String getPhoneTypeName(int phoneType) {
    switch (phoneType) {
    case TelephonyManager.PHONE_TYPE_NONE:
        return "None";
    case TelephonyManager.PHONE_TYPE_GSM:
        return "GSM";
    case TelephonyManager.PHONE_TYPE_CDMA:
        return "CDMA";
    case TelephonyManager.PHONE_TYPE_SIP:
        return "SIP";
    default:/*from w  ww . j a v  a  2  s .c  o m*/
        return "Unknown";
    }
}

From source file:org.mozilla.mozstumbler.service.stumblerthread.scanners.cellscanner.CellInfo.java

@SuppressWarnings("fallthrough")
private static String getRadioTypeName(int phoneType) {
    switch (phoneType) {
    case TelephonyManager.PHONE_TYPE_CDMA:
        return RADIO_CDMA;

    case TelephonyManager.PHONE_TYPE_GSM:
        return RADIO_GSM;

    default:/*ww w .jav  a2  s .  co m*/
        Log.e(LOG_TAG, "", new IllegalArgumentException("Unexpected phone type: " + phoneType));
        // fallthrough

    case TelephonyManager.PHONE_TYPE_NONE:
    case TelephonyManager.PHONE_TYPE_SIP:
        // These devices have no radio.
        return "";
    }
}

From source file:org.mozilla.mozstumbler.service.scanners.cellscanner.CellInfo.java

@SuppressWarnings("fallthrough")
private static String getRadioTypeName(int phoneType) {
    switch (phoneType) {
    case TelephonyManager.PHONE_TYPE_CDMA:
        return RADIO_CDMA;

    case TelephonyManager.PHONE_TYPE_GSM:
        return RADIO_GSM;

    default:/* w w w  .  j a va 2  s. c o  m*/
        Log.e(LOGTAG, "", new IllegalArgumentException("Unexpected phone type: " + phoneType));
        // fallthrough

    case TelephonyManager.PHONE_TYPE_NONE:
    case TelephonyManager.PHONE_TYPE_SIP:
        // These devices have no radio.
        return "";
    }
}

From source file:com.secupwn.aimsicd.service.CellTracker.java

/**
 *          I removed the timer that activated this code and now the code will be run when
 *          the cell changes so it will detect faster rather than using a timer that might
 *          miss an imsi catcher, also says cpu rather than refreshing every x seconds.
 *
 *          original comments below from xLaMbChOpSx
 *
 *
 *  Description:    (From xLaMbChOpSx commit comment)
 *
 *      Initial implementation for detection method 1 to compare the CID & LAC with the Cell
 *      Information Table contents as an initial implementation for detection of a changed LAC,
 *      once OCID issues (API key use etc) have been finalised this detection method can be
 *      extended to include checking of external data.
 *
 *      REMOVED: refresh timer info//from  w  w w.  j  a v  a  2  s .co m
 *
 *      As I have no real way of testing this I require testing by other project members who
 *      do have access to equipment or an environment where a changing LAC can be simulated
 *      thus confirming the accuracy of this implementation.
 *
 *      Presently this will only invoke the MEDIUM threat level through the notification and
 *      does not fully implement the capturing and score based method as per the issue details
 *      once further testing is complete the alert and tracking of information can be refined.
 *
 *      See:
 *        https://github.com/xLaMbChOpSx/Android-IMSI-Catcher-Detector/commit/43ae77e2a0cad10dfd50f92da5a998f9ece95b38
 *        https://github.com/SecUpwN/Android-IMSI-Catcher-Detector/issues/91#issuecomment-64391732
 *
 *  Short explanation:
 *
 *                  This is a polling mechanism for getting the LAC/CID and location
 *                  info for the currently connected cell.
 *
 *  Variables:
 *                  FIXED: now updates on cell change rather than a timer
 *                  There is a "timer" here (REFRESH_RATE), what exactly is it timing?
 *                  "Every REFRESH_RATE seconds, get connected cell details."
 *
 *  Issues:     [ ] We shouldn't do any detection here!
 *              [ ] We might wanna use a listener to do this?
 *                  Are there any reasons why not using a listener?
 *
 *  ChangeLog:
 *              2015-03-03  E:V:A           Changed getProp() to use TinyDB (SharedPreferences)
 *              2015-0x-xx  banjaxbanjo     Update: ??? (hey dude what did you do?)
 *
 */
public void compareLac(CellLocation location) {

    @Cleanup
    Realm realm = Realm.getDefaultInstance();

    switch (device.getPhoneId()) {

    case TelephonyManager.PHONE_TYPE_NONE:
    case TelephonyManager.PHONE_TYPE_SIP:
    case TelephonyManager.PHONE_TYPE_GSM:
        GsmCellLocation gsmCellLocation = (GsmCellLocation) location;
        if (gsmCellLocation != null) {
            monitorCell.setLocationAreaCode(gsmCellLocation.getLac());
            monitorCell.setCellId(gsmCellLocation.getCid());

            // Check if LAC is ok
            boolean lacOK = dbHelper.checkLAC(realm, monitorCell);
            if (!lacOK) {
                changedLAC = true;
                dbHelper.toEventLog(realm, 1, "Changing LAC");

                // Detection Logs are made in checkLAC()
                vibrate(100, Status.MEDIUM);
            } else {
                changedLAC = false;
            }

            if (tinydb.getBoolean("ocid_downloaded")) {
                if (!dbHelper.openCellExists(realm, monitorCell.getCellId())) {
                    dbHelper.toEventLog(realm, 2, "CID not in Import realm");

                    log.info("ALERT: Connected to unknown CID not in Import realm: " + monitorCell.getCellId());
                    vibrate(100, Status.MEDIUM);

                    cellIdNotInOpenDb = true;
                } else {
                    cellIdNotInOpenDb = false;
                }
            }
        }
        break;

    case TelephonyManager.PHONE_TYPE_CDMA:
        CdmaCellLocation cdmaCellLocation = (CdmaCellLocation) location;
        if (cdmaCellLocation != null) {
            monitorCell.setLocationAreaCode(cdmaCellLocation.getNetworkId());
            monitorCell.setCellId(cdmaCellLocation.getBaseStationId());

            boolean lacOK = dbHelper.checkLAC(realm, monitorCell);
            if (!lacOK) {
                changedLAC = true;
                /*dbHelper.insertEventLog(
                        MiscUtils.getCurrentTimeStamp(),
                        monitorCell.getLAC(),
                        monitorCell.getCid(),
                        monitorCell.getPSC(),//This is giving weird values like 21478364... is this right?
                        String.valueOf(monitorCell.getLat()),
                        String.valueOf(monitorCell.getLon()),
                        (int)monitorCell.getAccuracy(),
                        1,
                        "Changing LAC"
                );*/
                dbHelper.toEventLog(realm, 1, "Changing LAC");
            } else {
                changedLAC = false;
            }
        }
    }
    setNotification();
}

From source file:com.secupwn.aimsicd.service.CellTracker.java

/**
 * Add entries to the {@link com.secupwn.aimsicd.data.model.Measure Measure} realm
 *//*from w  ww. j a  v a 2 s .com*/
public void onLocationChanged(Location loc) {
    // TODO: See issue #555 (DeviceApi17.java is using API 18 CellInfoWcdma calls.
    if (Build.VERSION.SDK_INT > 17) {
        DeviceApi18.loadCellInfo(tm, device);
    }

    if (!device.cell.isValid()) {
        CellLocation cellLocation = tm.getCellLocation();
        if (cellLocation != null) {
            switch (device.getPhoneId()) {

            case TelephonyManager.PHONE_TYPE_NONE:
            case TelephonyManager.PHONE_TYPE_SIP:
            case TelephonyManager.PHONE_TYPE_GSM:
                GsmCellLocation gsmCellLocation = (GsmCellLocation) cellLocation;
                device.cell.setCellId(gsmCellLocation.getCid()); // CID
                device.cell.setLocationAreaCode(gsmCellLocation.getLac()); // LAC
                device.cell.setPrimaryScramblingCode(gsmCellLocation.getPsc()); // PSC
                break;

            case TelephonyManager.PHONE_TYPE_CDMA:
                CdmaCellLocation cdmaCellLocation = (CdmaCellLocation) cellLocation;
                device.cell.setCellId(cdmaCellLocation.getBaseStationId()); // BSID ??
                device.cell.setLocationAreaCode(cdmaCellLocation.getNetworkId()); // NID
                device.cell.setSid(cdmaCellLocation.getSystemId()); // SID
                device.cell.setMobileNetworkCode(cdmaCellLocation.getSystemId()); // MNC <== BUG!??

                break;
            }
        }
    }

    if (loc != null && (Double.doubleToRawLongBits(loc.getLatitude()) != 0
            && Double.doubleToRawLongBits(loc.getLongitude()) != 0)) {

        device.cell.setLon(loc.getLongitude()); // gpsd_lon
        device.cell.setLat(loc.getLatitude()); // gpsd_lat
        device.cell.setSpeed(loc.getSpeed()); // speed        // TODO: Remove, we're not using it!
        device.cell.setAccuracy(loc.getAccuracy()); // gpsd_accu
        device.cell.setBearing(loc.getBearing()); // -- [deg]??   // TODO: Remove, we're not using it!
        device.setLastLocation(loc); //

        // Store last known location in preference
        SharedPreferences.Editor prefsEditor;
        prefsEditor = prefs.edit();
        prefsEditor.putString(context.getString(R.string.data_last_lat_lon),
                String.valueOf(loc.getLatitude()) + ":" + String.valueOf(loc.getLongitude()));
        prefsEditor.apply();

        // This only logs a BTS if we have GPS lock
        // TODO: Is correct behaviour? We should consider logging all cells, even without GPS.
        if (trackingCell) {
            // This also checks that the locationAreaCode are cid are not in DB before inserting
            @Cleanup
            Realm realm = Realm.getDefaultInstance();
            dbHelper.insertBTS(realm, device.cell);
        }
    }
}