Findbug fixes in Settings app
modified: src/com/android/settings/ApnPreference.java modified: src/com/android/settings/ApnSettings.java modified: src/com/android/settings/BandMode.java modified: src/com/android/settings/BatteryInfo.java modified: src/com/android/settings/LanguageSettings.java modified: src/com/android/settings/ManageApplications.java modified: src/com/android/settings/RadioInfo.java modified: src/com/android/settings/SdCardSettings.java modified: src/com/android/settings/UsageStats.java modified: src/com/android/settings/ZoneList.java modified: src/com/android/settings/bluetooth/LocalBluetoothDevice.java modified: src/com/android/settings/deviceinfo/Status.java modified: src/com/android/settings/quicklaunch/QuickLaunchSettings.java modified: src/com/android/settings/wifi/AccessPointDialog.java modified: src/com/android/settings/wifi/AccessPointPreference.java modified: src/com/android/settings/wifi/WifiLayer.java modified: src/com/android/settings/wifi/WifiSettings.java
This commit is contained in:
@@ -107,7 +107,7 @@ public class ApnPreference extends Preference implements
|
||||
return getKey().equals(mSelectedKey);
|
||||
}
|
||||
|
||||
public void setChecked(boolean checked) {
|
||||
public void setChecked() {
|
||||
mSelectedKey = getKey();
|
||||
}
|
||||
|
||||
|
@@ -178,7 +178,7 @@ public class ApnSettings extends PreferenceActivity implements
|
||||
pref.setSelectable(selectable);
|
||||
if (selectable) {
|
||||
if ((mSelectedKey != null) && mSelectedKey.equals(key)) {
|
||||
pref.setChecked(true);
|
||||
pref.setChecked();
|
||||
}
|
||||
apnList.addPreference(pref);
|
||||
} else {
|
||||
|
@@ -97,7 +97,7 @@ public class BandMode extends Activity {
|
||||
}
|
||||
};
|
||||
|
||||
private class BandListItem {
|
||||
static private class BandListItem {
|
||||
private int mBandMode = Phone.BM_UNSPECIFIED;
|
||||
|
||||
public BandListItem(int bm) {
|
||||
|
@@ -67,7 +67,7 @@ public class BatteryInfo extends Activity {
|
||||
*/
|
||||
private final String tenthsToFixedString(int x) {
|
||||
int tens = x / 10;
|
||||
return new String("" + tens + "." + (x - 10*tens));
|
||||
return Integer.toString(tens) + "." + (x - 10 * tens);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -54,8 +54,6 @@ public class LanguageSettings extends PreferenceActivity {
|
||||
private String mLastInputMethodId;
|
||||
private String mLastTickedInputMethodId;
|
||||
|
||||
private String mRootDirectory;
|
||||
|
||||
static public String getInputMethodIdFromKey(String key) {
|
||||
return key;
|
||||
}
|
||||
|
@@ -426,15 +426,20 @@ public class ManageApplications extends ListActivity implements
|
||||
public void onGetStatsCompleted(PackageStats pStats, boolean pSucceeded) {
|
||||
AppInfo appInfo = null;
|
||||
Bundle data = new Bundle();
|
||||
data.putString(ATTR_PKG_NAME, pStats.packageName);
|
||||
if(pSucceeded && pStats != null) {
|
||||
if (localLOGV) Log.i(TAG, "onGetStatsCompleted::"+pStats.packageName+", ("+
|
||||
pStats.cacheSize+","+
|
||||
pStats.codeSize+", "+pStats.dataSize);
|
||||
data.putParcelable(ATTR_APP_PKG_STATS, pStats);
|
||||
} else {
|
||||
if (pStats != null) {
|
||||
data.putString(ATTR_PKG_NAME, pStats.packageName);
|
||||
if(pSucceeded) {
|
||||
if (localLOGV) Log.i(TAG, "onGetStatsCompleted::"+pStats.packageName+", ("+
|
||||
pStats.cacheSize+","+
|
||||
pStats.codeSize+", "+pStats.dataSize);
|
||||
data.putParcelable(ATTR_APP_PKG_STATS, pStats);
|
||||
}
|
||||
}
|
||||
|
||||
if(!pSucceeded || pStats == null) {
|
||||
Log.w(TAG, "Invalid package stats from PackageManager");
|
||||
}
|
||||
|
||||
//post message to Handler
|
||||
Message msg = mHandler.obtainMessage(mMsgId, data);
|
||||
msg.setData(data);
|
||||
@@ -705,7 +710,7 @@ public class ManageApplications extends ListActivity implements
|
||||
|
||||
// internal structure used to track added and deleted packages when
|
||||
// the activity has focus
|
||||
class AddRemoveInfo {
|
||||
static class AddRemoveInfo {
|
||||
String pkgName;
|
||||
boolean add;
|
||||
public AddRemoveInfo(String pPkgName, boolean pAdd) {
|
||||
|
@@ -257,24 +257,24 @@ public class RadioInfo extends Activity {
|
||||
}
|
||||
};
|
||||
|
||||
private class OemCommands {
|
||||
static private class OemCommands {
|
||||
|
||||
public final int OEM_QXDM_SDLOG_DEFAULT_FILE_SIZE = 32;
|
||||
public final int OEM_QXDM_SDLOG_DEFAULT_MASK = 0;
|
||||
public final int OEM_QXDM_SDLOG_DEFAULT_MAX_INDEX = 8;
|
||||
public static final int OEM_QXDM_SDLOG_DEFAULT_FILE_SIZE = 32;
|
||||
public static final int OEM_QXDM_SDLOG_DEFAULT_MASK = 0;
|
||||
public static final int OEM_QXDM_SDLOG_DEFAULT_MAX_INDEX = 8;
|
||||
|
||||
final int SIZE_OF_INT = 4;
|
||||
final int OEM_FEATURE_ENABLE = 1;
|
||||
final int OEM_FEATURE_DISABLE = 0;
|
||||
final int OEM_SIMPE_FEAUTURE_LEN = 1;
|
||||
static final int SIZE_OF_INT = 4;
|
||||
static final int OEM_FEATURE_ENABLE = 1;
|
||||
static final int OEM_FEATURE_DISABLE = 0;
|
||||
static final int OEM_SIMPE_FEAUTURE_LEN = 1;
|
||||
|
||||
final int OEM_QXDM_SDLOG_FUNCTAG = 0x00010000;
|
||||
final int OEM_QXDM_SDLOG_LEN = 4;
|
||||
final int OEM_PS_AUTO_ATTACH_FUNCTAG = 0x00020000;
|
||||
final int OEM_CIPHERING_FUNCTAG = 0x00020001;
|
||||
final int OEM_SMSC_UPDATE_FUNCTAG = 0x00020002;
|
||||
final int OEM_SMSC_QUERY_FUNCTAG = 0x00020003;
|
||||
final int OEM_SMSC_QUERY_LEN = 0;
|
||||
static final int OEM_QXDM_SDLOG_FUNCTAG = 0x00010000;
|
||||
static final int OEM_QXDM_SDLOG_LEN = 4;
|
||||
static final int OEM_PS_AUTO_ATTACH_FUNCTAG = 0x00020000;
|
||||
static final int OEM_CIPHERING_FUNCTAG = 0x00020001;
|
||||
static final int OEM_SMSC_UPDATE_FUNCTAG = 0x00020002;
|
||||
static final int OEM_SMSC_QUERY_FUNCTAG = 0x00020003;
|
||||
static final int OEM_SMSC_QUERY_LEN = 0;
|
||||
|
||||
/**
|
||||
* The OEM interface to store QXDM to SD.
|
||||
@@ -990,8 +990,7 @@ public class RadioInfo extends Activity {
|
||||
private void displayQxdmEnableResult() {
|
||||
String status = mQxdmLogEnabled ? "Start QXDM Log" : "Stop QXDM Log";
|
||||
|
||||
DialogInterface mProgressPanel = new AlertDialog.
|
||||
Builder(this).setMessage(status).show();
|
||||
new AlertDialog.Builder(this).setMessage(status).show();
|
||||
|
||||
mHandler.postDelayed(
|
||||
new Runnable() {
|
||||
|
@@ -107,48 +107,41 @@ public class SdCardSettings extends Activity
|
||||
} catch (RemoteException ex) {
|
||||
}
|
||||
|
||||
String scanVolume = null; // this no longer exists: SystemProperties.get(MediaScanner.CURRENT_VOLUME_PROPERTY, "");
|
||||
boolean scanning = "external".equals(scanVolume);
|
||||
String status = Environment.getExternalStorageState();
|
||||
boolean readOnly = false;
|
||||
|
||||
if (scanning) {
|
||||
setLayout(mScanningLayout);
|
||||
} else {
|
||||
String status = Environment.getExternalStorageState();
|
||||
boolean readOnly = false;
|
||||
if (status.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
|
||||
status = Environment.MEDIA_MOUNTED;
|
||||
readOnly = true;
|
||||
}
|
||||
|
||||
if (status.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
|
||||
status = Environment.MEDIA_MOUNTED;
|
||||
readOnly = true;
|
||||
if (status.equals(Environment.MEDIA_MOUNTED)) {
|
||||
try {
|
||||
File path = Environment.getExternalStorageDirectory();
|
||||
StatFs stat = new StatFs(path.getPath());
|
||||
long blockSize = stat.getBlockSize();
|
||||
long totalBlocks = stat.getBlockCount();
|
||||
long availableBlocks = stat.getAvailableBlocks();
|
||||
|
||||
mTotalSize.setText(formatSize(totalBlocks * blockSize));
|
||||
mUsedSize.setText(formatSize((totalBlocks - availableBlocks) * blockSize));
|
||||
mAvailableSize.setText(formatSize(availableBlocks * blockSize));
|
||||
} catch (IllegalArgumentException e) {
|
||||
// this can occur if the SD card is removed, but we haven't received the
|
||||
// ACTION_MEDIA_REMOVED Intent yet.
|
||||
status = Environment.MEDIA_REMOVED;
|
||||
}
|
||||
|
||||
if (status.equals(Environment.MEDIA_MOUNTED)) {
|
||||
try {
|
||||
File path = Environment.getExternalStorageDirectory();
|
||||
StatFs stat = new StatFs(path.getPath());
|
||||
long blockSize = stat.getBlockSize();
|
||||
long totalBlocks = stat.getBlockCount();
|
||||
long availableBlocks = stat.getAvailableBlocks();
|
||||
|
||||
mTotalSize.setText(formatSize(totalBlocks * blockSize));
|
||||
mUsedSize.setText(formatSize((totalBlocks - availableBlocks) * blockSize));
|
||||
mAvailableSize.setText(formatSize(availableBlocks * blockSize));
|
||||
} catch (IllegalArgumentException e) {
|
||||
// this can occur if the SD card is removed, but we haven't received the
|
||||
// ACTION_MEDIA_REMOVED Intent yet.
|
||||
status = Environment.MEDIA_REMOVED;
|
||||
}
|
||||
|
||||
mReadOnlyStatus.setVisibility(readOnly ? View.VISIBLE : View.GONE);
|
||||
setLayout(mMountedLayout);
|
||||
} else if (status.equals(Environment.MEDIA_UNMOUNTED)) {
|
||||
setLayout(mUnmountedLayout);
|
||||
} else if (status.equals(Environment.MEDIA_REMOVED)) {
|
||||
setLayout(mRemovedLayout);
|
||||
} else if (status.equals(Environment.MEDIA_SHARED)) {
|
||||
setLayout(mSharedLayout);
|
||||
} else if (status.equals(Environment.MEDIA_BAD_REMOVAL)) {
|
||||
setLayout(mBadRemovalLayout);
|
||||
}
|
||||
mReadOnlyStatus.setVisibility(readOnly ? View.VISIBLE : View.GONE);
|
||||
setLayout(mMountedLayout);
|
||||
} else if (status.equals(Environment.MEDIA_UNMOUNTED)) {
|
||||
setLayout(mUnmountedLayout);
|
||||
} else if (status.equals(Environment.MEDIA_REMOVED)) {
|
||||
setLayout(mRemovedLayout);
|
||||
} else if (status.equals(Environment.MEDIA_SHARED)) {
|
||||
setLayout(mSharedLayout);
|
||||
} else if (status.equals(Environment.MEDIA_BAD_REMOVAL)) {
|
||||
setLayout(mBadRemovalLayout);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,8 +205,6 @@ public class SdCardSettings extends Activity
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private int mStatus;
|
||||
private IMountService mMountService;
|
||||
|
||||
private CheckBox mMassStorage;
|
||||
|
@@ -187,7 +187,7 @@ public class UsageStats extends Activity implements OnItemSelectedListener {
|
||||
holder.launchCount.setText(String.valueOf(pkgStats.launchCount));
|
||||
holder.usageTime.setText(String.valueOf(pkgStats.usageTime)+" ms");
|
||||
} else {
|
||||
Log.w(TAG, "No usage stats info for package:"+pkgStats.packageName);
|
||||
Log.w(TAG, "No usage stats info for package:" + position);
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
@@ -160,7 +160,7 @@ public class ZoneList extends ListActivity {
|
||||
try {
|
||||
XmlResourceParser xrp = getResources().getXml(R.xml.timezones);
|
||||
while (xrp.next() != XmlResourceParser.START_TAG)
|
||||
;
|
||||
continue;
|
||||
xrp.next();
|
||||
while (xrp.getEventType() != XmlResourceParser.END_TAG) {
|
||||
while (xrp.getEventType() != XmlResourceParser.START_TAG) {
|
||||
|
@@ -82,7 +82,7 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
|
||||
CONNECT, DISCONNECT,
|
||||
}
|
||||
|
||||
class BluetoothJob {
|
||||
static class BluetoothJob {
|
||||
final BluetoothCommand command; // CONNECT, DISCONNECT
|
||||
final LocalBluetoothDevice device;
|
||||
final Profile profile; // HEADSET, A2DP, etc
|
||||
@@ -349,7 +349,7 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
|
||||
}
|
||||
};
|
||||
|
||||
AlertDialog ad = new AlertDialog.Builder(context)
|
||||
new AlertDialog.Builder(context)
|
||||
.setTitle(getName())
|
||||
.setMessage(message)
|
||||
.setPositiveButton(android.R.string.ok, disconnectListener)
|
||||
@@ -363,7 +363,6 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
|
||||
// Reset the only-show-one-error-dialog tracking variable
|
||||
mIsConnectingErrorPossible = true;
|
||||
|
||||
Context context = mLocalManager.getContext();
|
||||
boolean hasAtLeastOnePreferredProfile = false;
|
||||
for (Profile profile : mProfiles) {
|
||||
LocalBluetoothProfileManager profileManager =
|
||||
@@ -385,7 +384,6 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
|
||||
// Reset the only-show-one-error-dialog tracking variable
|
||||
mIsConnectingErrorPossible = true;
|
||||
|
||||
Context context = mLocalManager.getContext();
|
||||
for (Profile profile : mProfiles) {
|
||||
LocalBluetoothProfileManager profileManager =
|
||||
LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
|
||||
@@ -480,8 +478,6 @@ public class LocalBluetoothDevice implements Comparable<LocalBluetoothDevice> {
|
||||
}
|
||||
|
||||
private void fillData() {
|
||||
BluetoothDevice manager = mLocalManager.getBluetoothManager();
|
||||
|
||||
fetchName();
|
||||
fetchBtClass();
|
||||
|
||||
|
@@ -356,7 +356,6 @@ public class Status extends PreferenceActivity {
|
||||
void updateTimes() {
|
||||
long at = SystemClock.uptimeMillis() / 1000;
|
||||
long ut = SystemClock.elapsedRealtime() / 1000;
|
||||
long st = ut - at;
|
||||
|
||||
if (ut == 0) {
|
||||
ut = 1;
|
||||
|
@@ -222,8 +222,7 @@ public class QuickLaunchSettings extends PreferenceActivity implements
|
||||
Log.w(TAG, "Result from bookmark picker does not have an intent.");
|
||||
return;
|
||||
}
|
||||
|
||||
String title = data.getStringExtra(BookmarkPicker.EXTRA_TITLE);
|
||||
|
||||
char shortcut = data.getCharExtra(BookmarkPicker.EXTRA_SHORTCUT, (char) 0);
|
||||
updateShortcut(shortcut, data);
|
||||
|
||||
|
@@ -321,12 +321,12 @@ public class AccessPointDialog extends AlertDialog implements DialogInterface.On
|
||||
}
|
||||
|
||||
private void updatePasswordCaption(String security) {
|
||||
|
||||
if (mPasswordText != null && security != null
|
||||
&& security.equals(AccessPointState.WEP)) {
|
||||
mPasswordText.setText(R.string.please_type_hex_key);
|
||||
} else {
|
||||
mPasswordText.setText(R.string.please_type_passphrase);
|
||||
if (mPasswordText != null) {
|
||||
if (security != null && security.equals(AccessPointState.WEP)) {
|
||||
mPasswordText.setText(R.string.please_type_hex_key);
|
||||
} else {
|
||||
mPasswordText.setText(R.string.please_type_passphrase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -33,14 +33,11 @@ public class AccessPointPreference extends Preference implements
|
||||
// Signal strength indicator
|
||||
private static final int UI_SIGNAL_LEVELS = 4;
|
||||
|
||||
private WifiSettings mWifiSettings;
|
||||
|
||||
private AccessPointState mState;
|
||||
|
||||
public AccessPointPreference(WifiSettings wifiSettings, AccessPointState state) {
|
||||
super(wifiSettings, null);
|
||||
|
||||
mWifiSettings = wifiSettings;
|
||||
mState = state;
|
||||
|
||||
setWidgetLayoutResource(R.layout.preference_widget_wifi_signal);
|
||||
|
@@ -763,7 +763,9 @@ public class WifiLayer {
|
||||
* We pass null for security since we have a network ID (i.e., it's
|
||||
* not a wildcard), and rely on it matching.
|
||||
*/
|
||||
return findApLocked(wifiInfo.getNetworkId(), wifiInfo.getBSSID(), ssid, null);
|
||||
synchronized (this) {
|
||||
return findApLocked(wifiInfo.getNetworkId(), wifiInfo.getBSSID(), ssid, null);
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@@ -1002,8 +1004,10 @@ public class WifiLayer {
|
||||
* We pass null for security since we have a network ID (i.e., it's
|
||||
* not a wildcard), and rely on it matching.
|
||||
*/
|
||||
ap = findApLocked(wifiInfo.getNetworkId(), wifiInfo.getBSSID(), wifiInfo
|
||||
.getSSID(), null);
|
||||
synchronized (this) {
|
||||
ap = findApLocked(wifiInfo.getNetworkId(), wifiInfo.getBSSID(), wifiInfo
|
||||
.getSSID(), null);
|
||||
}
|
||||
}
|
||||
|
||||
if (ap != null) {
|
||||
|
@@ -365,8 +365,8 @@ public class WifiSettings extends PreferenceActivity implements WifiLayer.Callba
|
||||
}
|
||||
|
||||
mDialog = dialog;
|
||||
dialog.setOnDismissListener(this);
|
||||
if (dialog != null) {
|
||||
dialog.setOnDismissListener(this);
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user