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
diff --git a/src/com/android/settings/SdCardSettings.java b/src/com/android/settings/SdCardSettings.java
index b6935a2..6033c42 100644
--- a/src/com/android/settings/SdCardSettings.java
+++ b/src/com/android/settings/SdCardSettings.java
@@ -107,48 +107,41 @@
} 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 @@
}
};
-
- private int mStatus;
private IMountService mMountService;
private CheckBox mMassStorage;