@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fcc_system_info_activity); Util.initializeFonts(this); Util.overrideFonts(this, findViewById(android.R.id.content)); }
private void populateInfo() { String value; if (MainService.isExecuting()) { value = getString(R.string.executing_now); } else { if (SK2AppSettings.getInstance().isServiceActivated()) { value = getString(R.string.yes); } else { value = getString(R.string.no); } } ((TextView) findViewById(R.id.tv_service_activated_value)).setText(value); if (SK2AppSettings.getInstance().isServiceEnabled()) { value = getString(R.string.enabled); } else { value = getString(R.string.disabled); } ((TextView) findViewById(R.id.tv_service_autotesting_value)).setText(value); ((TextView) findViewById(R.id.tv_service_status_value)) .setText(getString(SK2AppSettings.getSK2AppSettingsInstance().getState().sId)); String versionName = ""; try { versionName = this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName; } catch (NameNotFoundException e) { SKLogger.e(this, "Error in getting app version name.", e); } ((TextView) findViewById(R.id.version)).setText(versionName); ScheduleConfig config = CachingStorage.getInstance().loadScheduleConfig(); String schedule_version = config == null ? "" : config.getConfigVersion(); ((TextView) findViewById(R.id.schedule_version)).setText(schedule_version); String nextTestScheduled = ""; if (MainService.isExecuting()) { nextTestScheduled = getString(R.string.executing_now); } else { long nextRunTime = SK2AppSettings.getInstance().getNextRunTime(); if (nextRunTime == SKConstants.NO_NEXT_RUN_TIME) { nextTestScheduled = getString(R.string.none); } else { nextTestScheduled = new SKDateFormat(this).UITime(nextRunTime); } } ((TextView) findViewById(R.id.tv_scheduledFor_value)).setText(nextTestScheduled); PhoneIdentityData phoneData = new PhoneIdentityDataCollector(this).collect(); if (!SK2AppSettings.getSK2AppSettingsInstance().anonymous) { ((TextView) findViewById(R.id.tv_imei_value)).setText(phoneData.imei + ""); ((TextView) findViewById(R.id.tv_imsi_value)).setText(phoneData.imsi + ""); ((TextView) findViewById(R.id.tv_unitId_value)) .setText(SK2AppSettings.getInstance().getUnitId()); } value = phoneData.manufacturer + "\n\r" + phoneData.model; ((TextView) findViewById(R.id.tv_phone_value)).setText(value); value = phoneData.osType + " v" + phoneData.osVersion; ((TextView) findViewById(R.id.tv_os_value)).setText(value); NetworkData networkData = new NetworkDataCollector(this).collect(); value = DCSConvertorUtil.convertPhoneType(networkData.phoneType); ((TextView) findViewById(R.id.tv_phone_type_value)).setText(value); value = getString(DCSConvertorUtil.networkTypeToStringId(networkData.networkType)); ((TextView) findViewById(R.id.tv_network_type_value)).setText(value); value = networkData.networkOperatorCode + "/" + networkData.networkOperatorName; ((TextView) findViewById(R.id.tv_network_operator_value)).setText(value); if (networkData.isRoaming) { value = getString(R.string.yes); } else { value = getString(R.string.no); } ((TextView) findViewById(R.id.tv_roaming_value)).setText(value); Location loc1 = ((LocationManager) getSystemService(LOCATION_SERVICE)) .getLastKnownLocation(LocationManager.GPS_PROVIDER); Location loc2 = ((LocationManager) getSystemService(LOCATION_SERVICE)) .getLastKnownLocation(LocationManager.NETWORK_PROVIDER); Location loc = null; if (loc1 != null && loc2 != null) { loc = loc1.getTime() > loc2.getTime() ? loc1 : loc2; } else { loc = loc1 == null ? loc2 : loc1; } if (loc != null) { ((TextView) findViewById(R.id.tv_loc_date_value)) .setText(new SKDateFormat(this).UITime(loc.getTime())); ((TextView) findViewById(R.id.tv_loc_provider_value)).setText(loc.getProvider()); ((TextView) findViewById(R.id.tv_loc_long_value)) .setText(String.format("%1.5f", loc.getLongitude())); ((TextView) findViewById(R.id.tv_loc_lat_value)) .setText(String.format("%1.5f", loc.getLatitude())); ((TextView) findViewById(R.id.tv_loc_acc_value)).setText(loc.getAccuracy() + " m"); } // Cells CellTowersData cellData = new CellTowersDataCollector(this).collect(); if (cellData.cellLocation instanceof GsmCellLocation) { GsmCellLocation gsmLocation = (GsmCellLocation) cellData.cellLocation; ((TextView) findViewById(R.id.tv_cell_tower_type_value)).setText("GSM"); ((TextView) findViewById(R.id.tv_cell_id_value)).setText("" + gsmLocation.getCid()); ((TextView) findViewById(R.id.tv_area_code_value)).setText("" + gsmLocation.getLac()); } else if (cellData.cellLocation instanceof CdmaCellLocation) { ((TextView) findViewById(R.id.tv_cell_tower_type_value)).setText("CDMA"); // CdmaCellLocation cdmaLocation = (CdmaCellLocation) cellLocation; // builder.append(CDMA); // builder.append(time/1000); // builder.append(cdmaLocation.getBaseStationId()); // builder.append(cdmaLocation.getBaseStationLatitude()); // builder.append(cdmaLocation.getBaseStationLongitude()); // builder.append(cdmaLocation.getNetworkId()); // builder.append(cdmaLocation.getSystemId()); } if (cellData.signal.isGsm()) { int signalStrength = SKGsmSignalStrength.getGsmSignalStrength(cellData.signal); value = DCSConvertorUtil.convertGsmSignalStrength(signalStrength); } else { value = cellData.signal.getCdmaDbm() + " dBm"; } ((TextView) findViewById(R.id.tv_signal_value)).setText(value); // Note: neighbors might be NULL... if (cellData.getNeighbors() != null) { for (NeighboringCellInfo info : cellData.getNeighbors()) { appendNeighborCellInfo(info); } } Util.initializeFonts(this); Util.overrideFonts(this, findViewById(android.R.id.content)); }