summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2011-11-10 17:56:41 -0800
committerGlenn Kasten <gkasten@google.com>2012-01-27 16:13:00 -0800
commit30c918ce7fbe171944b28fc91b3f22b3d631872d (patch)
treeed15e7a0a2436b00ae2d6a476b612235dfb131d9
parentcf0c7d1031ea213c1b728aca972522afcd4a92c3 (diff)
downloadframeworks_base-30c918ce7fbe171944b28fc91b3f22b3d631872d.zip
frameworks_base-30c918ce7fbe171944b28fc91b3f22b3d631872d.tar.gz
frameworks_base-30c918ce7fbe171944b28fc91b3f22b3d631872d.tar.bz2
Use final on new member variables
Use final for member fields initialized to a new and that are never modified. Change-Id: I042352c7bc21879613e7a50b1205b6923f8083cf
-rw-r--r--media/java/android/media/AmrInputStream.java2
-rw-r--r--media/java/android/media/AsyncPlayer.java2
-rw-r--r--media/java/android/media/AudioManager.java8
-rw-r--r--media/java/android/media/AudioRecord.java2
-rw-r--r--media/java/android/media/AudioService.java20
-rw-r--r--media/java/android/media/ExifInterface.java2
-rw-r--r--media/java/android/media/MediaFile.java10
-rw-r--r--media/java/android/media/MediaInserter.java2
-rw-r--r--media/java/android/media/MediaScanner.java4
-rw-r--r--media/java/android/media/MediaScannerConnection.java2
-rw-r--r--media/java/android/media/MiniThumbFile.java2
-rw-r--r--media/java/android/media/RemoteControlClient.java3
-rw-r--r--media/java/android/media/RingtoneManager.java2
13 files changed, 31 insertions, 30 deletions
diff --git a/media/java/android/media/AmrInputStream.java b/media/java/android/media/AmrInputStream.java
index bc68472..8b7eee2 100644
--- a/media/java/android/media/AmrInputStream.java
+++ b/media/java/android/media/AmrInputStream.java
@@ -44,7 +44,7 @@ public final class AmrInputStream extends InputStream
private int mGae;
// result amr stream
- private byte[] mBuf = new byte[SAMPLES_PER_FRAME * 2];
+ private final byte[] mBuf = new byte[SAMPLES_PER_FRAME * 2];
private int mBufIn = 0;
private int mBufOut = 0;
diff --git a/media/java/android/media/AsyncPlayer.java b/media/java/android/media/AsyncPlayer.java
index 09aec2e..804528e 100644
--- a/media/java/android/media/AsyncPlayer.java
+++ b/media/java/android/media/AsyncPlayer.java
@@ -49,7 +49,7 @@ public class AsyncPlayer {
}
}
- private LinkedList<Command> mCmdQueue = new LinkedList();
+ private final LinkedList<Command> mCmdQueue = new LinkedList();
private void startSound(Command cmd) {
// Preparing can be slow, so if there is something else
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index de3f909..78eb89f 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -1509,7 +1509,7 @@ public class AudioManager {
* Map to convert focus event listener IDs, as used in the AudioService audio focus stack,
* to actual listener objects.
*/
- private HashMap<String, OnAudioFocusChangeListener> mAudioFocusIdListenerMap =
+ private final HashMap<String, OnAudioFocusChangeListener> mAudioFocusIdListenerMap =
new HashMap<String, OnAudioFocusChangeListener>();
/**
* Lock to prevent concurrent changes to the list of focus listeners for this AudioManager
@@ -1524,7 +1524,7 @@ public class AudioManager {
/**
* Handler for audio focus events coming from the audio service.
*/
- private FocusEventHandlerDelegate mAudioFocusEventHandlerDelegate =
+ private final FocusEventHandlerDelegate mAudioFocusEventHandlerDelegate =
new FocusEventHandlerDelegate();
/**
@@ -1563,7 +1563,7 @@ public class AudioManager {
}
}
- private IAudioFocusDispatcher mAudioFocusDispatcher = new IAudioFocusDispatcher.Stub() {
+ private final IAudioFocusDispatcher mAudioFocusDispatcher = new IAudioFocusDispatcher.Stub() {
public void dispatchAudioFocusChange(int focusChange, String id) {
Message m = mAudioFocusEventHandlerDelegate.getHandler().obtainMessage(focusChange, id);
@@ -1955,7 +1955,7 @@ public class AudioManager {
/**
* {@hide}
*/
- private IBinder mICallBack = new Binder();
+ private final IBinder mICallBack = new Binder();
/**
* Checks whether the phone is in silent mode, with or without vibrate.
diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java
index 855e831..5cc24c0 100644
--- a/media/java/android/media/AudioRecord.java
+++ b/media/java/android/media/AudioRecord.java
@@ -161,7 +161,7 @@ public class AudioRecord
/**
* Lock to make sure mRecordingState updates are reflecting the actual state of the object.
*/
- private Object mRecordingStateLock = new Object();
+ private final Object mRecordingStateLock = new Object();
/**
* The listener the AudioRecord notifies when the record position reaches a marker
* or for periodic updates during the progression of the record head.
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index e07c287..13e3982 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -151,7 +151,7 @@ public class AudioService extends IAudioService.Stub {
private boolean mMediaServerOk;
private SoundPool mSoundPool;
- private Object mSoundEffectsLock = new Object();
+ private final Object mSoundEffectsLock = new Object();
private static final int NUM_SOUNDPOOL_CHANNELS = 4;
private static final int SOUND_EFFECT_VOLUME = 1000;
@@ -168,7 +168,7 @@ public class AudioService extends IAudioService.Stub {
/* Sound effect file name mapping sound effect id (AudioManager.FX_xxx) to
* file index in SOUND_EFFECT_FILES[] (first column) and indicating if effect
* uses soundpool (second column) */
- private int[][] SOUND_EFFECT_FILES_MAP = new int[][] {
+ private final int[][] SOUND_EFFECT_FILES_MAP = new int[][] {
{0, -1}, // FX_KEY_CLICK
{0, -1}, // FX_FOCUS_NAVIGATION_UP
{0, -1}, // FX_FOCUS_NAVIGATION_DOWN
@@ -181,7 +181,7 @@ public class AudioService extends IAudioService.Stub {
};
/** @hide Maximum volume index values for audio streams */
- private int[] MAX_STREAM_VOLUME = new int[] {
+ private final int[] MAX_STREAM_VOLUME = new int[] {
5, // STREAM_VOICE_CALL
7, // STREAM_SYSTEM
7, // STREAM_RING
@@ -197,7 +197,7 @@ public class AudioService extends IAudioService.Stub {
* of another stream: This avoids multiplying the volume settings for hidden
* stream types that follow other stream behavior for volume settings
* NOTE: do not create loops in aliases! */
- private int[] STREAM_VOLUME_ALIAS = new int[] {
+ private final int[] STREAM_VOLUME_ALIAS = new int[] {
AudioSystem.STREAM_VOICE_CALL, // STREAM_VOICE_CALL
AudioSystem.STREAM_SYSTEM, // STREAM_SYSTEM
AudioSystem.STREAM_RING, // STREAM_RING
@@ -210,7 +210,7 @@ public class AudioService extends IAudioService.Stub {
AudioSystem.STREAM_MUSIC // STREAM_TTS
};
- private AudioSystem.ErrorCallback mAudioSystemCallback = new AudioSystem.ErrorCallback() {
+ private final AudioSystem.ErrorCallback mAudioSystemCallback = new AudioSystem.ErrorCallback() {
public void onError(int error) {
switch (error) {
case AudioSystem.AUDIO_STATUS_SERVER_DIED:
@@ -270,17 +270,17 @@ public class AudioService extends IAudioService.Stub {
private boolean mIsRinging = false;
// Devices currently connected
- private HashMap <Integer, String> mConnectedDevices = new HashMap <Integer, String>();
+ private final HashMap <Integer, String> mConnectedDevices = new HashMap <Integer, String>();
// Forced device usage for communications
private int mForcedUseForComm;
// List of binder death handlers for setMode() client processes.
// The last process to have called setMode() is at the top of the list.
- private ArrayList <SetModeDeathHandler> mSetModeDeathHandlers = new ArrayList <SetModeDeathHandler>();
+ private final ArrayList <SetModeDeathHandler> mSetModeDeathHandlers = new ArrayList <SetModeDeathHandler>();
// List of clients having issued a SCO start request
- private ArrayList <ScoClient> mScoClients = new ArrayList <ScoClient>();
+ private final ArrayList <ScoClient> mScoClients = new ArrayList <ScoClient>();
// BluetoothHeadset API to control SCO connection
private BluetoothHeadset mBluetoothHeadset;
@@ -2945,7 +2945,7 @@ public class AudioService extends IAudioService.Stub {
}
}
- private Stack<FocusStackEntry> mFocusStack = new Stack<FocusStackEntry>();
+ private final Stack<FocusStackEntry> mFocusStack = new Stack<FocusStackEntry>();
/**
* Helper function:
@@ -3322,7 +3322,7 @@ public class AudioService extends IAudioService.Stub {
* synchronized on mRCStack, but also BEFORE on mFocusLock as any change in either
* stack, audio focus or RC, can lead to a change in the remote control display
*/
- private Stack<RemoteControlStackEntry> mRCStack = new Stack<RemoteControlStackEntry>();
+ private final Stack<RemoteControlStackEntry> mRCStack = new Stack<RemoteControlStackEntry>();
/**
* Helper function:
diff --git a/media/java/android/media/ExifInterface.java b/media/java/android/media/ExifInterface.java
index 925f965..9d6c9f6 100644
--- a/media/java/android/media/ExifInterface.java
+++ b/media/java/android/media/ExifInterface.java
@@ -111,7 +111,7 @@ public class ExifInterface {
// there can only be one user at a time for the native functions (and
// they cannot keep state in the native code across function calls). We
// use sLock to serialize the accesses.
- private static Object sLock = new Object();
+ private static final Object sLock = new Object();
/**
* Reads Exif tags from the specified JPEG file.
diff --git a/media/java/android/media/MediaFile.java b/media/java/android/media/MediaFile.java
index e275aa6..7f7e284 100644
--- a/media/java/android/media/MediaFile.java
+++ b/media/java/android/media/MediaFile.java
@@ -120,18 +120,18 @@ public class MediaFile {
}
}
- private static HashMap<String, MediaFileType> sFileTypeMap
+ private static final HashMap<String, MediaFileType> sFileTypeMap
= new HashMap<String, MediaFileType>();
- private static HashMap<String, Integer> sMimeTypeMap
+ private static final HashMap<String, Integer> sMimeTypeMap
= new HashMap<String, Integer>();
// maps file extension to MTP format code
- private static HashMap<String, Integer> sFileTypeToFormatMap
+ private static final HashMap<String, Integer> sFileTypeToFormatMap
= new HashMap<String, Integer>();
// maps mime type to MTP format code
- private static HashMap<String, Integer> sMimeTypeToFormatMap
+ private static final HashMap<String, Integer> sMimeTypeToFormatMap
= new HashMap<String, Integer>();
// maps MTP format code to mime type
- private static HashMap<Integer, String> sFormatToMimeTypeMap
+ private static final HashMap<Integer, String> sFormatToMimeTypeMap
= new HashMap<Integer, String>();
static void addFileType(String extension, int fileType, String mimeType) {
diff --git a/media/java/android/media/MediaInserter.java b/media/java/android/media/MediaInserter.java
index a998407..e92c710 100644
--- a/media/java/android/media/MediaInserter.java
+++ b/media/java/android/media/MediaInserter.java
@@ -32,7 +32,7 @@ import java.util.List;
* {@hide}
*/
public class MediaInserter {
- private HashMap<Uri, List<ContentValues>> mRowMap =
+ private final HashMap<Uri, List<ContentValues>> mRowMap =
new HashMap<Uri, List<ContentValues>>();
private IContentProvider mProvider;
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java
index b06ef95..6815c16 100644
--- a/media/java/android/media/MediaScanner.java
+++ b/media/java/android/media/MediaScanner.java
@@ -345,7 +345,7 @@ public class MediaScanner
// this should be set when scanning files on a case insensitive file system.
private boolean mCaseInsensitivePaths;
- private BitmapFactory.Options mBitmapOptions = new BitmapFactory.Options();
+ private final BitmapFactory.Options mBitmapOptions = new BitmapFactory.Options();
private static class FileCacheEntry {
long mRowId;
@@ -401,7 +401,7 @@ public class MediaScanner
+ Settings.System.ALARM_ALERT);
}
- private MyMediaScannerClient mClient = new MyMediaScannerClient();
+ private final MyMediaScannerClient mClient = new MyMediaScannerClient();
private boolean isDrmEnabled() {
String prop = SystemProperties.get("drm.service.enabled");
diff --git a/media/java/android/media/MediaScannerConnection.java b/media/java/android/media/MediaScannerConnection.java
index 969da39..21b6e14 100644
--- a/media/java/android/media/MediaScannerConnection.java
+++ b/media/java/android/media/MediaScannerConnection.java
@@ -46,7 +46,7 @@ public class MediaScannerConnection implements ServiceConnection {
private IMediaScannerService mService;
private boolean mConnected; // true if connect() has been called since last disconnect()
- private IMediaScannerListener.Stub mListener = new IMediaScannerListener.Stub() {
+ private final IMediaScannerListener.Stub mListener = new IMediaScannerListener.Stub() {
public void scanCompleted(String path, Uri uri) {
MediaScannerConnectionClient client = mClient;
if (client != null) {
diff --git a/media/java/android/media/MiniThumbFile.java b/media/java/android/media/MiniThumbFile.java
index df141c1..63b149c 100644
--- a/media/java/android/media/MiniThumbFile.java
+++ b/media/java/android/media/MiniThumbFile.java
@@ -52,7 +52,7 @@ public class MiniThumbFile {
private RandomAccessFile mMiniThumbFile;
private FileChannel mChannel;
private ByteBuffer mBuffer;
- private static Hashtable<String, MiniThumbFile> sThumbFiles =
+ private static final Hashtable<String, MiniThumbFile> sThumbFiles =
new Hashtable<String, MiniThumbFile>();
/**
diff --git a/media/java/android/media/RemoteControlClient.java b/media/java/android/media/RemoteControlClient.java
index 77acfe6..18b4ee6 100644
--- a/media/java/android/media/RemoteControlClient.java
+++ b/media/java/android/media/RemoteControlClient.java
@@ -576,6 +576,7 @@ public class RemoteControlClient
/**
* Cache for the metadata strings.
* Access synchronized on mCacheLock
+ * This is re-initialized in apply() and so cannot be final.
*/
private Bundle mMetadata = new Bundle();
@@ -621,7 +622,7 @@ public class RemoteControlClient
/**
* The IRemoteControlClient implementation
*/
- private IRemoteControlClient mIRCC = new IRemoteControlClient.Stub() {
+ private final IRemoteControlClient mIRCC = new IRemoteControlClient.Stub() {
public void onInformationRequested(int clientGeneration, int infoFlags,
int artWidth, int artHeight) {
diff --git a/media/java/android/media/RingtoneManager.java b/media/java/android/media/RingtoneManager.java
index 9c0819f..7aaf4aa 100644
--- a/media/java/android/media/RingtoneManager.java
+++ b/media/java/android/media/RingtoneManager.java
@@ -224,7 +224,7 @@ public class RingtoneManager {
* If a column (item from this list) exists in the Cursor, its value must
* be true (value of 1) for the row to be returned.
*/
- private List<String> mFilterColumns = new ArrayList<String>();
+ private final List<String> mFilterColumns = new ArrayList<String>();
private boolean mStopPreviousRingtone = true;
private Ringtone mPreviousRingtone;