Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java

Issue 2548013002: Remove redundant field initialization in Java code. (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.media; 5 package org.chromium.media;
6 6
7 import android.annotation.TargetApi; 7 import android.annotation.TargetApi;
8 import android.bluetooth.BluetoothAdapter; 8 import android.bluetooth.BluetoothAdapter;
9 import android.bluetooth.BluetoothManager; 9 import android.bluetooth.BluetoothManager;
10 import android.content.BroadcastReceiver; 10 import android.content.BroadcastReceiver;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // Return this value when getProperty(PROPERTY_OUTPUT_FRAMES_PER_BUFFER) 157 // Return this value when getProperty(PROPERTY_OUTPUT_FRAMES_PER_BUFFER)
158 // fails. 158 // fails.
159 private static final int DEFAULT_FRAME_PER_BUFFER = 256; 159 private static final int DEFAULT_FRAME_PER_BUFFER = 256;
160 160
161 private final AudioManager mAudioManager; 161 private final AudioManager mAudioManager;
162 private final Context mContext; 162 private final Context mContext;
163 private final long mNativeAudioManagerAndroid; 163 private final long mNativeAudioManagerAndroid;
164 164
165 // Enabled during initialization if MODIFY_AUDIO_SETTINGS permission is 165 // Enabled during initialization if MODIFY_AUDIO_SETTINGS permission is
166 // granted. Required to shift system-wide audio settings. 166 // granted. Required to shift system-wide audio settings.
167 private boolean mHasModifyAudioSettingsPermission = false; 167 private boolean mHasModifyAudioSettingsPermission;
168 168
169 // Enabled during initialization if BLUETOOTH permission is granted. 169 // Enabled during initialization if BLUETOOTH permission is granted.
170 private boolean mHasBluetoothPermission = false; 170 private boolean mHasBluetoothPermission;
171 171
172 // Stores the audio states related to Bluetooth SCO audio, where some 172 // Stores the audio states related to Bluetooth SCO audio, where some
173 // states are needed to keep track of intermediate states while the SCO 173 // states are needed to keep track of intermediate states while the SCO
174 // channel is enabled or disabled (switching state can take a few seconds). 174 // channel is enabled or disabled (switching state can take a few seconds).
175 private int mBluetoothScoState = STATE_BLUETOOTH_SCO_INVALID; 175 private int mBluetoothScoState = STATE_BLUETOOTH_SCO_INVALID;
176 176
177 private boolean mIsInitialized = false; 177 private boolean mIsInitialized;
178 private boolean mSavedIsSpeakerphoneOn; 178 private boolean mSavedIsSpeakerphoneOn;
179 private boolean mSavedIsMicrophoneMute; 179 private boolean mSavedIsMicrophoneMute;
180 180
181 // Id of the requested audio device. Can only be modified by 181 // Id of the requested audio device. Can only be modified by
182 // call to setDevice(). 182 // call to setDevice().
183 private int mRequestedAudioDevice = DEVICE_INVALID; 183 private int mRequestedAudioDevice = DEVICE_INVALID;
184 184
185 // This class should be created, initialized and closed on the audio thread 185 // This class should be created, initialized and closed on the audio thread
186 // in the audio manager. We use |mNonThreadSafe| to ensure that this is 186 // in the audio manager. We use |mNonThreadSafe| to ensure that this is
187 // the case. Only active when |DEBUG| is set to true. 187 // the case. Only active when |DEBUG| is set to true.
188 private final NonThreadSafe mNonThreadSafe = new NonThreadSafe(); 188 private final NonThreadSafe mNonThreadSafe = new NonThreadSafe();
189 189
190 // Lock to protect |mAudioDevices| and |mRequestedAudioDevice| which can 190 // Lock to protect |mAudioDevices| and |mRequestedAudioDevice| which can
191 // be accessed from the main thread and the audio manager thread. 191 // be accessed from the main thread and the audio manager thread.
192 private final Object mLock = new Object(); 192 private final Object mLock = new Object();
193 193
194 // Contains a list of currently available audio devices. 194 // Contains a list of currently available audio devices.
195 private boolean[] mAudioDevices = new boolean[DEVICE_COUNT]; 195 private boolean[] mAudioDevices = new boolean[DEVICE_COUNT];
196 196
197 private final ContentResolver mContentResolver; 197 private final ContentResolver mContentResolver;
198 private ContentObserver mSettingsObserver = null; 198 private ContentObserver mSettingsObserver;
199 private HandlerThread mSettingsObserverThread = null; 199 private HandlerThread mSettingsObserverThread;
200 private int mCurrentVolume; 200 private int mCurrentVolume;
201 201
202 // Broadcast receiver for wired headset intent broadcasts. 202 // Broadcast receiver for wired headset intent broadcasts.
203 private BroadcastReceiver mWiredHeadsetReceiver; 203 private BroadcastReceiver mWiredHeadsetReceiver;
204 204
205 // Broadcast receiver for Bluetooth headset intent broadcasts. 205 // Broadcast receiver for Bluetooth headset intent broadcasts.
206 // Utilized to detect changes in Bluetooth headset availability. 206 // Utilized to detect changes in Bluetooth headset availability.
207 private BroadcastReceiver mBluetoothHeadsetReceiver; 207 private BroadcastReceiver mBluetoothHeadsetReceiver;
208 208
209 // Broadcast receiver for Bluetooth SCO broadcasts. 209 // Broadcast receiver for Bluetooth SCO broadcasts.
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 } 1247 }
1248 1248
1249 /** Unregister receiver for broadcasted ACTION_USB_DEVICE_ATTACHED/DETACHED intent. */ 1249 /** Unregister receiver for broadcasted ACTION_USB_DEVICE_ATTACHED/DETACHED intent. */
1250 private void unregisterForUsbAudioIntentBroadcast() { 1250 private void unregisterForUsbAudioIntentBroadcast() {
1251 mContext.unregisterReceiver(mUsbAudioReceiver); 1251 mContext.unregisterReceiver(mUsbAudioReceiver);
1252 mUsbAudioReceiver = null; 1252 mUsbAudioReceiver = null;
1253 } 1253 }
1254 1254
1255 private native void nativeSetMute(long nativeAudioManagerAndroid, boolean mu ted); 1255 private native void nativeSetMute(long nativeAudioManagerAndroid, boolean mu ted);
1256 } 1256 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698