Loading android/app/AndroidManifest.xml +20 −19 Original line number Diff line number Diff line Loading @@ -342,6 +342,26 @@ android:enabled="false"> </activity> <!-- Phonebook Access Profile (PBAP) client Profile Service and owned Service --> <service android:process="@string/process" android:name="com.android.bluetooth.pbapclient.PbapClientService" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.bluetooth.IBluetoothPbapClient"/> </intent-filter> </service> <service android:process="@string/process" android:name="com.android.bluetooth.pbapclient.AuthenticationService" android:enabled="false" android:exported="true"> <intent-filter> <action android:name="android.accounts.AccountAuthenticator"/> </intent-filter> <meta-data android:name="android.accounts.AccountAuthenticator" android:resource="@xml/authenticator"/> </service> <!-- Telephony Bearer Service (TBS) server Profile Service --> <service android:process="@string/process" Loading Loading @@ -517,25 +537,6 @@ <action android:name="android.bluetooth.IBluetoothHeadset"/> </intent-filter> </service> <service android:process="@string/process" android:name=".pbapclient.PbapClientService" android:enabled="@bool/profile_supported_pbapclient" android:exported="true"> <intent-filter> <action android:name="android.bluetooth.IBluetoothPbapClient"/> </intent-filter> </service> <!-- Authenticator for PBAP account. --> <service android:process="@string/process" android:name="com.android.bluetooth.pbapclient.AuthenticationService" android:exported="true" android:enabled="@bool/profile_supported_pbapclient"> <intent-filter> <action android:name="android.accounts.AccountAuthenticator"/> </intent-filter> <meta-data android:name="android.accounts.AccountAuthenticator" android:resource="@xml/authenticator"/> </service> <service android:name="com.android.bluetooth.telephony.BluetoothInCallService" android:permission="android.permission.BIND_INCALL_SERVICE" Loading android/app/res/values/config.xml +0 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ <bool name="pbap_include_photos_in_vcard">true</bool> <bool name="pbap_use_profile_for_owner_vcard">true</bool> <bool name="profile_supported_sap">false</bool> <bool name="profile_supported_pbapclient">false</bool> <!-- If true, we will require location to be enabled on the device to fire Bluetooth LE scan result callbacks in addition to having one Loading android/app/src/com/android/bluetooth/pbapclient/PbapClientService.java +15 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.provider.CallLog; import android.sysprop.BluetoothProperties; import android.util.Log; import com.android.bluetooth.R; Loading Loading @@ -58,6 +59,13 @@ public class PbapClientService extends ProfileService { private static final String TAG = "PbapClientService"; private static final String SERVICE_NAME = "Phonebook Access PCE"; /** * The component names for the owned authenticator service */ private static final String AUTHENTICATOR_SERVICE = AuthenticationService.class.getCanonicalName(); // MAXIMUM_DEVICES set to 10 to prevent an excessive number of simultaneous devices. private static final int MAXIMUM_DEVICES = 10; private Map<BluetoothDevice, PbapClientStateMachine> mPbapClientStateMachineMap = Loading @@ -68,6 +76,10 @@ public class PbapClientService extends ProfileService { private DatabaseManager mDatabaseManager; public static boolean isEnabled() { return BluetoothProperties.isProfilePbapClientEnabled().orElse(false); } @Override public IProfileServiceBinder initBinder() { return new BluetoothPbapClientBinder(this); Loading @@ -82,6 +94,8 @@ public class PbapClientService extends ProfileService { mDatabaseManager = Objects.requireNonNull(AdapterService.getAdapterService().getDatabase(), "DatabaseManager cannot be null when PbapClientService starts"); setComponentAvailable(AUTHENTICATOR_SERVICE, true); IntentFilter filter = new IntentFilter(); filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED); // delay initial download until after the user is unlocked to add an account. Loading Loading @@ -114,6 +128,7 @@ public class PbapClientService extends ProfileService { pbapClientStateMachine.doQuit(); } removeUncleanAccounts(); setComponentAvailable(AUTHENTICATOR_SERVICE, false); return true; } Loading android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientServiceTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ public class PbapClientServiceTest { public void setUp() throws Exception { mTargetContext = InstrumentationRegistry.getTargetContext(); Assume.assumeTrue("Ignore test when PbapClientService is not enabled", mTargetContext.getResources().getBoolean(R.bool.profile_supported_pbapclient)); PbapClientService.isEnabled()); MockitoAnnotations.initMocks(this); TestUtils.setAdapterService(mAdapterService); doReturn(mDatabaseManager).when(mAdapterService).getDatabase(); Loading @@ -73,7 +73,7 @@ public class PbapClientServiceTest { @After public void tearDown() throws Exception { if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_pbapclient)) { if (!PbapClientService.isEnabled()) { return; } TestUtils.stopService(mServiceRule, PbapClientService.class); Loading android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapParserTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ public class PbapParserTest { public void setUp() { mTargetContext = InstrumentationRegistry.getTargetContext(); Assume.assumeTrue("Ignore test when PbapClientService is not enabled", mTargetContext.getResources().getBoolean(R.bool.profile_supported_pbapclient)); PbapClientService.isEnabled()); mAccount = new Account(TEST_ACCOUNT_NAME, mTargetContext.getString(com.android.bluetooth.R.string.pbap_account_type)); try { Loading Loading
android/app/AndroidManifest.xml +20 −19 Original line number Diff line number Diff line Loading @@ -342,6 +342,26 @@ android:enabled="false"> </activity> <!-- Phonebook Access Profile (PBAP) client Profile Service and owned Service --> <service android:process="@string/process" android:name="com.android.bluetooth.pbapclient.PbapClientService" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.bluetooth.IBluetoothPbapClient"/> </intent-filter> </service> <service android:process="@string/process" android:name="com.android.bluetooth.pbapclient.AuthenticationService" android:enabled="false" android:exported="true"> <intent-filter> <action android:name="android.accounts.AccountAuthenticator"/> </intent-filter> <meta-data android:name="android.accounts.AccountAuthenticator" android:resource="@xml/authenticator"/> </service> <!-- Telephony Bearer Service (TBS) server Profile Service --> <service android:process="@string/process" Loading Loading @@ -517,25 +537,6 @@ <action android:name="android.bluetooth.IBluetoothHeadset"/> </intent-filter> </service> <service android:process="@string/process" android:name=".pbapclient.PbapClientService" android:enabled="@bool/profile_supported_pbapclient" android:exported="true"> <intent-filter> <action android:name="android.bluetooth.IBluetoothPbapClient"/> </intent-filter> </service> <!-- Authenticator for PBAP account. --> <service android:process="@string/process" android:name="com.android.bluetooth.pbapclient.AuthenticationService" android:exported="true" android:enabled="@bool/profile_supported_pbapclient"> <intent-filter> <action android:name="android.accounts.AccountAuthenticator"/> </intent-filter> <meta-data android:name="android.accounts.AccountAuthenticator" android:resource="@xml/authenticator"/> </service> <service android:name="com.android.bluetooth.telephony.BluetoothInCallService" android:permission="android.permission.BIND_INCALL_SERVICE" Loading
android/app/res/values/config.xml +0 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ <bool name="pbap_include_photos_in_vcard">true</bool> <bool name="pbap_use_profile_for_owner_vcard">true</bool> <bool name="profile_supported_sap">false</bool> <bool name="profile_supported_pbapclient">false</bool> <!-- If true, we will require location to be enabled on the device to fire Bluetooth LE scan result callbacks in addition to having one Loading
android/app/src/com/android/bluetooth/pbapclient/PbapClientService.java +15 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.provider.CallLog; import android.sysprop.BluetoothProperties; import android.util.Log; import com.android.bluetooth.R; Loading Loading @@ -58,6 +59,13 @@ public class PbapClientService extends ProfileService { private static final String TAG = "PbapClientService"; private static final String SERVICE_NAME = "Phonebook Access PCE"; /** * The component names for the owned authenticator service */ private static final String AUTHENTICATOR_SERVICE = AuthenticationService.class.getCanonicalName(); // MAXIMUM_DEVICES set to 10 to prevent an excessive number of simultaneous devices. private static final int MAXIMUM_DEVICES = 10; private Map<BluetoothDevice, PbapClientStateMachine> mPbapClientStateMachineMap = Loading @@ -68,6 +76,10 @@ public class PbapClientService extends ProfileService { private DatabaseManager mDatabaseManager; public static boolean isEnabled() { return BluetoothProperties.isProfilePbapClientEnabled().orElse(false); } @Override public IProfileServiceBinder initBinder() { return new BluetoothPbapClientBinder(this); Loading @@ -82,6 +94,8 @@ public class PbapClientService extends ProfileService { mDatabaseManager = Objects.requireNonNull(AdapterService.getAdapterService().getDatabase(), "DatabaseManager cannot be null when PbapClientService starts"); setComponentAvailable(AUTHENTICATOR_SERVICE, true); IntentFilter filter = new IntentFilter(); filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED); // delay initial download until after the user is unlocked to add an account. Loading Loading @@ -114,6 +128,7 @@ public class PbapClientService extends ProfileService { pbapClientStateMachine.doQuit(); } removeUncleanAccounts(); setComponentAvailable(AUTHENTICATOR_SERVICE, false); return true; } Loading
android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientServiceTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ public class PbapClientServiceTest { public void setUp() throws Exception { mTargetContext = InstrumentationRegistry.getTargetContext(); Assume.assumeTrue("Ignore test when PbapClientService is not enabled", mTargetContext.getResources().getBoolean(R.bool.profile_supported_pbapclient)); PbapClientService.isEnabled()); MockitoAnnotations.initMocks(this); TestUtils.setAdapterService(mAdapterService); doReturn(mDatabaseManager).when(mAdapterService).getDatabase(); Loading @@ -73,7 +73,7 @@ public class PbapClientServiceTest { @After public void tearDown() throws Exception { if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_pbapclient)) { if (!PbapClientService.isEnabled()) { return; } TestUtils.stopService(mServiceRule, PbapClientService.class); Loading
android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapParserTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ public class PbapParserTest { public void setUp() { mTargetContext = InstrumentationRegistry.getTargetContext(); Assume.assumeTrue("Ignore test when PbapClientService is not enabled", mTargetContext.getResources().getBoolean(R.bool.profile_supported_pbapclient)); PbapClientService.isEnabled()); mAccount = new Account(TEST_ACCOUNT_NAME, mTargetContext.getString(com.android.bluetooth.R.string.pbap_account_type)); try { Loading