1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.settingslib.bluetooth;
18 
19 import android.bluetooth.BluetoothClass;
20 import android.bluetooth.BluetoothDevice;
21 import android.bluetooth.BluetoothProfile;
22 
23 import com.android.settingslib.R;
24 
25 /**
26  * OppProfile handles Bluetooth OPP.
27  */
28 final class OppProfile implements LocalBluetoothProfile {
29 
30     static final String NAME = "OPP";
31 
32     // Order of this profile in device profiles list
33     private static final int ORDINAL = 2;
34 
accessProfileEnabled()35     public boolean accessProfileEnabled() {
36         return false;
37     }
38 
isAutoConnectable()39     public boolean isAutoConnectable() {
40         return false;
41     }
42 
getConnectionStatus(BluetoothDevice device)43     public int getConnectionStatus(BluetoothDevice device) {
44         return BluetoothProfile.STATE_DISCONNECTED; // Settings app doesn't handle OPP
45     }
46 
47     @Override
isEnabled(BluetoothDevice device)48     public boolean isEnabled(BluetoothDevice device) {
49         return false;
50     }
51 
52     @Override
getConnectionPolicy(BluetoothDevice device)53     public int getConnectionPolicy(BluetoothDevice device) {
54         return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; // Settings app doesn't handle OPP
55     }
56 
57     @Override
setEnabled(BluetoothDevice device, boolean enabled)58     public boolean setEnabled(BluetoothDevice device, boolean enabled) {
59         return false;
60     }
61 
isProfileReady()62     public boolean isProfileReady() {
63         return true;
64     }
65 
66     @Override
getProfileId()67     public int getProfileId() {
68         return BluetoothProfile.OPP;
69     }
70 
toString()71     public String toString() {
72         return NAME;
73     }
74 
getOrdinal()75     public int getOrdinal() {
76         return ORDINAL;
77     }
78 
getNameResource(BluetoothDevice device)79     public int getNameResource(BluetoothDevice device) {
80         return R.string.bluetooth_profile_opp;
81     }
82 
getSummaryResourceForDevice(BluetoothDevice device)83     public int getSummaryResourceForDevice(BluetoothDevice device) {
84         return 0;   // OPP profile not displayed in UI
85     }
86 
getDrawableResource(BluetoothClass btClass)87     public int getDrawableResource(BluetoothClass btClass) {
88         return 0;   // no icon for OPP
89     }
90 }
91