Merge change 26706 into eclair
* changes: Format cleanup.
This commit is contained in:
@@ -73,7 +73,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class RadioInfo extends Activity {
|
public class RadioInfo extends Activity {
|
||||||
private final String TAG = "phone";
|
private final String TAG = "phone";
|
||||||
|
|
||||||
private static final int EVENT_PHONE_STATE_CHANGED = 100;
|
private static final int EVENT_PHONE_STATE_CHANGED = 100;
|
||||||
private static final int EVENT_SIGNAL_STRENGTH_CHANGED = 200;
|
private static final int EVENT_SIGNAL_STRENGTH_CHANGED = 200;
|
||||||
private static final int EVENT_SERVICE_STATE_CHANGED = 300;
|
private static final int EVENT_SERVICE_STATE_CHANGED = 300;
|
||||||
@@ -223,7 +223,7 @@ public class RadioInfo extends Activity {
|
|||||||
ar= (AsyncResult) msg.obj;
|
ar= (AsyncResult) msg.obj;
|
||||||
if (ar.exception == null) {
|
if (ar.exception == null) {
|
||||||
mQxdmLogEnabled = !mQxdmLogEnabled;
|
mQxdmLogEnabled = !mQxdmLogEnabled;
|
||||||
|
|
||||||
updateQxdmState(mQxdmLogEnabled);
|
updateQxdmState(mQxdmLogEnabled);
|
||||||
displayQxdmEnableResult();
|
displayQxdmEnableResult();
|
||||||
}
|
}
|
||||||
@@ -272,7 +272,7 @@ public class RadioInfo extends Activity {
|
|||||||
static final int OEM_QXDM_SDLOG_LEN = 4;
|
static final int OEM_QXDM_SDLOG_LEN = 4;
|
||||||
static final int OEM_PS_AUTO_ATTACH_FUNCTAG = 0x00020000;
|
static final int OEM_PS_AUTO_ATTACH_FUNCTAG = 0x00020000;
|
||||||
static final int OEM_CIPHERING_FUNCTAG = 0x00020001;
|
static final int OEM_CIPHERING_FUNCTAG = 0x00020001;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The OEM interface to store QXDM to SD.
|
* The OEM interface to store QXDM to SD.
|
||||||
*
|
*
|
||||||
@@ -343,7 +343,7 @@ public class RadioInfo extends Activity {
|
|||||||
byte[] getCipheringData(boolean enable) {
|
byte[] getCipheringData(boolean enable) {
|
||||||
return getSimpleFeatureData(OEM_CIPHERING_FUNCTAG, enable);
|
return getSimpleFeatureData(OEM_CIPHERING_FUNCTAG, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] getSimpleFeatureData(int tag, boolean enable) {
|
private byte[] getSimpleFeatureData(int tag, boolean enable) {
|
||||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||||
DataOutputStream dos = new DataOutputStream(bos);
|
DataOutputStream dos = new DataOutputStream(bos);
|
||||||
@@ -408,7 +408,7 @@ public class RadioInfo extends Activity {
|
|||||||
preferredNetworkType = (Spinner) findViewById(R.id.preferredNetworkType);
|
preferredNetworkType = (Spinner) findViewById(R.id.preferredNetworkType);
|
||||||
ArrayAdapter<String> adapter = new ArrayAdapter<String> (this,
|
ArrayAdapter<String> adapter = new ArrayAdapter<String> (this,
|
||||||
android.R.layout.simple_spinner_item, mPreferredNetworkLabels);
|
android.R.layout.simple_spinner_item, mPreferredNetworkLabels);
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
preferredNetworkType.setAdapter(adapter);
|
preferredNetworkType.setAdapter(adapter);
|
||||||
preferredNetworkType.setOnItemSelectedListener(mPreferredNetworkHandler);
|
preferredNetworkType.setOnItemSelectedListener(mPreferredNetworkHandler);
|
||||||
|
|
||||||
@@ -428,12 +428,12 @@ public class RadioInfo extends Activity {
|
|||||||
refreshSmscButton.setOnClickListener(mRefreshSmscButtonHandler);
|
refreshSmscButton.setOnClickListener(mRefreshSmscButtonHandler);
|
||||||
dnsCheckToggleButton = (Button) findViewById(R.id.dns_check_toggle);
|
dnsCheckToggleButton = (Button) findViewById(R.id.dns_check_toggle);
|
||||||
dnsCheckToggleButton.setOnClickListener(mDnsCheckButtonHandler);
|
dnsCheckToggleButton.setOnClickListener(mDnsCheckButtonHandler);
|
||||||
|
|
||||||
mPhoneStateReceiver = new PhoneStateIntentReceiver(this, mHandler);
|
mPhoneStateReceiver = new PhoneStateIntentReceiver(this, mHandler);
|
||||||
mPhoneStateReceiver.notifySignalStrength(EVENT_SIGNAL_STRENGTH_CHANGED);
|
mPhoneStateReceiver.notifySignalStrength(EVENT_SIGNAL_STRENGTH_CHANGED);
|
||||||
mPhoneStateReceiver.notifyServiceState(EVENT_SERVICE_STATE_CHANGED);
|
mPhoneStateReceiver.notifyServiceState(EVENT_SERVICE_STATE_CHANGED);
|
||||||
mPhoneStateReceiver.notifyPhoneCallState(EVENT_PHONE_STATE_CHANGED);
|
mPhoneStateReceiver.notifyPhoneCallState(EVENT_PHONE_STATE_CHANGED);
|
||||||
|
|
||||||
updateQxdmState(null);
|
updateQxdmState(null);
|
||||||
mOem = new OemCommands();
|
mOem = new OemCommands();
|
||||||
|
|
||||||
@@ -545,7 +545,7 @@ public class RadioInfo extends Activity {
|
|||||||
private boolean isRadioOn() {
|
private boolean isRadioOn() {
|
||||||
return phone.getServiceState().getState() != ServiceState.STATE_POWER_OFF;
|
return phone.getServiceState().getState() != ServiceState.STATE_POWER_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePowerState() {
|
private void updatePowerState() {
|
||||||
String buttonText = isRadioOn() ?
|
String buttonText = isRadioOn() ?
|
||||||
getString(R.string.turn_off_radio) :
|
getString(R.string.turn_off_radio) :
|
||||||
@@ -554,18 +554,18 @@ public class RadioInfo extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateQxdmState(Boolean newQxdmStatus) {
|
private void updateQxdmState(Boolean newQxdmStatus) {
|
||||||
SharedPreferences sp =
|
SharedPreferences sp =
|
||||||
PreferenceManager.getDefaultSharedPreferences(phone.getContext());
|
PreferenceManager.getDefaultSharedPreferences(phone.getContext());
|
||||||
mQxdmLogEnabled = sp.getBoolean("qxdmstatus", false);
|
mQxdmLogEnabled = sp.getBoolean("qxdmstatus", false);
|
||||||
// This is called from onCreate, onResume, and the handler when the status
|
// This is called from onCreate, onResume, and the handler when the status
|
||||||
// is updated.
|
// is updated.
|
||||||
if (newQxdmStatus != null) {
|
if (newQxdmStatus != null) {
|
||||||
SharedPreferences.Editor editor = sp.edit();
|
SharedPreferences.Editor editor = sp.edit();
|
||||||
editor.putBoolean("qxdmstatus", newQxdmStatus);
|
editor.putBoolean("qxdmstatus", newQxdmStatus);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
mQxdmLogEnabled = newQxdmStatus;
|
mQxdmLogEnabled = newQxdmStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
String buttonText = mQxdmLogEnabled ?
|
String buttonText = mQxdmLogEnabled ?
|
||||||
getString(R.string.turn_off_qxdm) :
|
getString(R.string.turn_off_qxdm) :
|
||||||
getString(R.string.turn_on_qxdm);
|
getString(R.string.turn_on_qxdm);
|
||||||
@@ -645,8 +645,8 @@ public class RadioInfo extends Activity {
|
|||||||
neighborings = "no neighboring cells";
|
neighborings = "no neighboring cells";
|
||||||
} else {
|
} else {
|
||||||
for (NeighboringCellInfo cell : cids) {
|
for (NeighboringCellInfo cell : cids) {
|
||||||
neighborings += "{" + Integer.toHexString(cell.getCid())
|
neighborings += "{" + Integer.toHexString(cell.getCid())
|
||||||
+ "@" + cell.getRssi() + "} ";
|
+ "@" + cell.getRssi() + "} ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -672,7 +672,7 @@ public class RadioInfo extends Activity {
|
|||||||
int state = serviceState.getState();
|
int state = serviceState.getState();
|
||||||
Resources r = getResources();
|
Resources r = getResources();
|
||||||
String display = r.getString(R.string.radioInfo_unknown);
|
String display = r.getString(R.string.radioInfo_unknown);
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case ServiceState.STATE_IN_SERVICE:
|
case ServiceState.STATE_IN_SERVICE:
|
||||||
display = r.getString(R.string.radioInfo_service_in);
|
display = r.getString(R.string.radioInfo_service_in);
|
||||||
@@ -685,9 +685,9 @@ public class RadioInfo extends Activity {
|
|||||||
display = r.getString(R.string.radioInfo_service_off);
|
display = r.getString(R.string.radioInfo_service_off);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gsmState.setText(display);
|
gsmState.setText(display);
|
||||||
|
|
||||||
if (serviceState.getRoaming()) {
|
if (serviceState.getRoaming()) {
|
||||||
roamingState.setText(R.string.radioInfo_roaming_in);
|
roamingState.setText(R.string.radioInfo_roaming_in);
|
||||||
} else {
|
} else {
|
||||||
@@ -738,7 +738,7 @@ public class RadioInfo extends Activity {
|
|||||||
display = r.getString(R.string.radioInfo_data_suspended);
|
display = r.getString(R.string.radioInfo_data_suspended);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gprsState.setText(display);
|
gprsState.setText(display);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -756,12 +756,12 @@ public class RadioInfo extends Activity {
|
|||||||
Resources r = getResources();
|
Resources r = getResources();
|
||||||
|
|
||||||
s = phone.getDeviceId();
|
s = phone.getDeviceId();
|
||||||
if (s == null) s = r.getString(R.string.radioInfo_unknown);
|
if (s == null) s = r.getString(R.string.radioInfo_unknown);
|
||||||
mDeviceId.setText(s);
|
mDeviceId.setText(s);
|
||||||
|
|
||||||
|
|
||||||
s = phone.getLine1Number();
|
s = phone.getLine1Number();
|
||||||
if (s == null) s = r.getString(R.string.radioInfo_unknown);
|
if (s == null) s = r.getString(R.string.radioInfo_unknown);
|
||||||
number.setText(s);
|
number.setText(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -792,10 +792,10 @@ public class RadioInfo extends Activity {
|
|||||||
long rxPackets = netstat.getMobileRxPackets();
|
long rxPackets = netstat.getMobileRxPackets();
|
||||||
long txBytes = netstat.getMobileTxBytes();
|
long txBytes = netstat.getMobileTxBytes();
|
||||||
long rxBytes = netstat.getMobileRxBytes();
|
long rxBytes = netstat.getMobileRxBytes();
|
||||||
|
|
||||||
String packets = r.getString(R.string.radioInfo_display_packets);
|
String packets = r.getString(R.string.radioInfo_display_packets);
|
||||||
String bytes = r.getString(R.string.radioInfo_display_bytes);
|
String bytes = r.getString(R.string.radioInfo_display_bytes);
|
||||||
|
|
||||||
sent.setText(txPackets + " " + packets + ", " + txBytes + " " + bytes);
|
sent.setText(txPackets + " " + packets + ", " + txBytes + " " + bytes);
|
||||||
received.setText(rxPackets + " " + packets + ", " + rxBytes + " " + bytes);
|
received.setText(rxPackets + " " + packets + ", " + rxBytes + " " + bytes);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
@@ -829,7 +829,7 @@ public class RadioInfo extends Activity {
|
|||||||
*/
|
*/
|
||||||
private final void pingHostname() {
|
private final void pingHostname() {
|
||||||
try {
|
try {
|
||||||
Process p = Runtime.getRuntime().exec("ping -c 1 www.google.com");
|
Process p = Runtime.getRuntime().exec("ping -c 1 www.google.com");
|
||||||
int status = p.waitFor();
|
int status = p.waitFor();
|
||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
mPingHostnameResult = "Pass";
|
mPingHostnameResult = "Pass";
|
||||||
@@ -1045,7 +1045,7 @@ public class RadioInfo extends Activity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private MenuItem.OnMenuItemClickListener mToggleData = new MenuItem.OnMenuItemClickListener() {
|
private MenuItem.OnMenuItemClickListener mToggleData = new MenuItem.OnMenuItemClickListener() {
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
int state = mTelephonyManager.getDataState();
|
int state = mTelephonyManager.getDataState();
|
||||||
@@ -1091,7 +1091,7 @@ public class RadioInfo extends Activity {
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
mCipherOn = !getCiphPref();
|
mCipherOn = !getCiphPref();
|
||||||
byte[] data = mOem.getCipheringData(mCipherOn);
|
byte[] data = mOem.getCipheringData(mCipherOn);
|
||||||
|
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1100,14 +1100,14 @@ public class RadioInfo extends Activity {
|
|||||||
mHandler.obtainMessage(EVENT_SET_CIPHER_DONE));
|
mHandler.obtainMessage(EVENT_SET_CIPHER_DONE));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
OnClickListener mDnsCheckButtonHandler = new OnClickListener() {
|
OnClickListener mDnsCheckButtonHandler = new OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
phone.disableDnsCheck(!phone.isDnsCheckDisabled());
|
phone.disableDnsCheck(!phone.isDnsCheckDisabled());
|
||||||
updateDnsCheckState();
|
updateDnsCheckState();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
OnClickListener mPingButtonHandler = new OnClickListener() {
|
OnClickListener mPingButtonHandler = new OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
updatePingState();
|
updatePingState();
|
||||||
|
Reference in New Issue
Block a user