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

Side by Side Diff: webrtc/examples/androidapp/src/org/appspot/apprtc/AppRTCBluetoothManager.java

Issue 2853283002: Fix lint issues on Android. (Closed)
Patch Set: Address lint suppressions. Created 3 years, 7 months 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 /* 1 /*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 package org.appspot.apprtc; 11 package org.appspot.apprtc;
12 12
13 import org.appspot.apprtc.util.AppRTCUtils; 13 import android.annotation.SuppressLint;
14
15 import android.bluetooth.BluetoothAdapter; 14 import android.bluetooth.BluetoothAdapter;
16 import android.bluetooth.BluetoothDevice; 15 import android.bluetooth.BluetoothDevice;
17 import android.bluetooth.BluetoothHeadset; 16 import android.bluetooth.BluetoothHeadset;
18 import android.bluetooth.BluetoothProfile; 17 import android.bluetooth.BluetoothProfile;
19 import android.content.BroadcastReceiver; 18 import android.content.BroadcastReceiver;
20 import android.content.Context; 19 import android.content.Context;
21 import android.content.Intent; 20 import android.content.Intent;
22 import android.content.IntentFilter; 21 import android.content.IntentFilter;
23 import android.content.pm.PackageManager; 22 import android.content.pm.PackageManager;
24 import android.media.AudioManager; 23 import android.media.AudioManager;
25 import android.os.Handler; 24 import android.os.Handler;
26 import android.os.Looper; 25 import android.os.Looper;
27 import android.os.Process; 26 import android.os.Process;
28 import android.util.Log; 27 import android.util.Log;
29
30 import org.webrtc.ThreadUtils;
31
32 import java.util.List; 28 import java.util.List;
33 import java.util.Set; 29 import java.util.Set;
30 import org.appspot.apprtc.util.AppRTCUtils;
31 import org.webrtc.ThreadUtils;
34 32
35 /** 33 /**
36 * AppRTCProximitySensor manages functions related to Bluetoth devices in the 34 * AppRTCProximitySensor manages functions related to Bluetoth devices in the
37 * AppRTC demo. 35 * AppRTC demo.
38 */ 36 */
39 public class AppRTCBluetoothManager { 37 public class AppRTCBluetoothManager {
40 private static final String TAG = "AppRTCBluetoothManager"; 38 private static final String TAG = "AppRTCBluetoothManager";
41 39
42 // Timeout interval for starting or stopping audio to a Bluetooth SCO device. 40 // Timeout interval for starting or stopping audio to a Bluetooth SCO device.
43 private static final int BLUETOOTH_SCO_TIMEOUT_MS = 4000; 41 private static final int BLUETOOTH_SCO_TIMEOUT_MS = 4000;
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 Context context, BluetoothProfile.ServiceListener listener, int profile) { 400 Context context, BluetoothProfile.ServiceListener listener, int profile) {
403 return bluetoothAdapter.getProfileProxy(context, listener, profile); 401 return bluetoothAdapter.getProfileProxy(context, listener, profile);
404 } 402 }
405 403
406 protected boolean hasPermission(Context context, String permission) { 404 protected boolean hasPermission(Context context, String permission) {
407 return apprtcContext.checkPermission(permission, Process.myPid(), Process.my Uid()) 405 return apprtcContext.checkPermission(permission, Process.myPid(), Process.my Uid())
408 == PackageManager.PERMISSION_GRANTED; 406 == PackageManager.PERMISSION_GRANTED;
409 } 407 }
410 408
411 /** Logs the state of the local Bluetooth adapter. */ 409 /** Logs the state of the local Bluetooth adapter. */
410 @SuppressLint("HardwareIds")
412 protected void logBluetoothAdapterInfo(BluetoothAdapter localAdapter) { 411 protected void logBluetoothAdapterInfo(BluetoothAdapter localAdapter) {
413 Log.d(TAG, "BluetoothAdapter: " 412 Log.d(TAG, "BluetoothAdapter: "
414 + "enabled=" + localAdapter.isEnabled() + ", " 413 + "enabled=" + localAdapter.isEnabled() + ", "
415 + "state=" + stateToString(localAdapter.getState()) + ", " 414 + "state=" + stateToString(localAdapter.getState()) + ", "
416 + "name=" + localAdapter.getName() + ", " 415 + "name=" + localAdapter.getName() + ", "
417 + "address=" + localAdapter.getAddress()); 416 + "address=" + localAdapter.getAddress());
418 // Log the set of BluetoothDevice objects that are bonded (paired) to the lo cal adapter. 417 // Log the set of BluetoothDevice objects that are bonded (paired) to the lo cal adapter.
419 Set<BluetoothDevice> pairedDevices = localAdapter.getBondedDevices(); 418 Set<BluetoothDevice> pairedDevices = localAdapter.getBondedDevices();
420 if (!pairedDevices.isEmpty()) { 419 if (!pairedDevices.isEmpty()) {
421 Log.d(TAG, "paired devices:"); 420 Log.d(TAG, "paired devices:");
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 return "TURNING_OFF"; 511 return "TURNING_OFF";
513 case BluetoothAdapter.STATE_TURNING_ON: 512 case BluetoothAdapter.STATE_TURNING_ON:
514 // Indicates the local Bluetooth adapter is turning on. However local cl ients should wait 513 // Indicates the local Bluetooth adapter is turning on. However local cl ients should wait
515 // for STATE_ON before attempting to use the adapter. 514 // for STATE_ON before attempting to use the adapter.
516 return "TURNING_ON"; 515 return "TURNING_ON";
517 default: 516 default:
518 return "INVALID"; 517 return "INVALID";
519 } 518 }
520 } 519 }
521 } 520 }
OLDNEW
« no previous file with comments | « webrtc/examples/androidapp/res/layout/activity_connect.xml ('k') | webrtc/sdk/android/api/org/webrtc/NetworkMonitor.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698