Loading android/app/AndroidManifest.xml +17 −15 Original line number Diff line number Diff line Loading @@ -325,6 +325,23 @@ </intent-filter> </service> <!-- Phonebook Access Profile (PBAP) server Profile Service and owned Activiie --> <service android:process="@string/process" android:permission="android.permission.BLUETOOTH_PRIVILEGED" android:name="com.android.bluetooth.pbap.BluetoothPbapService" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.bluetooth.IBluetoothPbap"/> </intent-filter> </service> <activity android:name="com.android.bluetooth.pbap.BluetoothPbapActivity" android:process="@string/process" android:excludeFromRecents="true" android:theme="@style/dialog" android:enabled="false"> </activity> <!-- Telephony Bearer Service (TBS) server Profile Service --> <service android:process="@string/process" Loading Loading @@ -484,21 +501,6 @@ <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> <activity android:name="com.android.bluetooth.pbap.BluetoothPbapActivity" android:process="@string/process" android:excludeFromRecents="true" android:theme="@style/dialog" android:enabled="@bool/profile_supported_pbap"> </activity> <service android:process="@string/process" android:permission="android.permission.BLUETOOTH_PRIVILEGED" android:name="com.android.bluetooth.pbap.BluetoothPbapService" android:enabled="@bool/profile_supported_pbap" android:exported="true"> <intent-filter> <action android:name="android.bluetooth.IBluetoothPbap"/> </intent-filter> </service> <service android:process="@string/process" android:name=".sap.SapService" android:enabled="@bool/profile_supported_sap" Loading android/app/res/values/config.xml +0 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ <bool name="profile_supported_hs_hfp">true</bool> <bool name="profile_supported_hfp_incallservice">true</bool> <bool name="profile_supported_opp">true</bool> <bool name="profile_supported_pbap">true</bool> <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> Loading android/app/src/com/android/bluetooth/pbap/BluetoothPbapService.java +15 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.bluetooth.BluetoothSocket; import android.bluetooth.IBluetoothPbap; import android.content.AttributionSource; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; Loading @@ -55,6 +56,7 @@ import android.os.Message; import android.os.PowerManager; import android.os.UserHandle; import android.os.UserManager; import android.sysprop.BluetoothProperties; import android.telephony.TelephonyManager; import android.util.Log; Loading Loading @@ -88,6 +90,11 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect public static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE); /** * The component name of the owned BluetoothPbapActivity */ private static final String PBAP_ACTIVITY = BluetoothPbapActivity.class.getCanonicalName(); /** * Intent indicating incoming obex authentication request which is from * PCE(Carkit) Loading Loading @@ -176,6 +183,10 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect private static BluetoothPbapService sBluetoothPbapService; public static boolean isEnabled() { return BluetoothProperties.isProfilePbapServerEnabled().orElse(false); } private class BluetoothPbapContentObserver extends ContentObserver { BluetoothPbapContentObserver() { super(new Handler()); Loading Loading @@ -562,6 +573,9 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect mDatabaseManager = Objects.requireNonNull(AdapterService.getAdapterService().getDatabase(), "DatabaseManager cannot be null when PbapService starts"); // Enable owned Activity component setComponentAvailable(PBAP_ACTIVITY, true); mContext = this; mContactsLoaded = false; mHandlerThread = new HandlerThread("PbapHandlerThread"); Loading Loading @@ -613,6 +627,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect unregisterReceiver(mPbapReceiver); getContentResolver().unregisterContentObserver(mContactChangeObserver); mContactChangeObserver = null; setComponentAvailable(PBAP_ACTIVITY, false); return true; } Loading android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapServiceTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ public class BluetoothPbapServiceTest { public void setUp() throws Exception { mTargetContext = InstrumentationRegistry.getTargetContext(); Assume.assumeTrue("Ignore test when BluetoothPbapService is not enabled", mTargetContext.getResources().getBoolean(R.bool.profile_supported_pbap)); BluetoothPbapService.isEnabled()); MockitoAnnotations.initMocks(this); TestUtils.setAdapterService(mAdapterService); doReturn(mDatabaseManager).when(mAdapterService).getDatabase(); Loading @@ -72,7 +72,7 @@ public class BluetoothPbapServiceTest { @After public void tearDown() throws Exception { if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_pbap)) { if (!BluetoothPbapService.isEnabled()) { return; } TestUtils.stopService(mServiceRule, BluetoothPbapService.class); Loading android/app/tests/unit/src/com/android/bluetooth/pbap/PbapStateMachineTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ public class PbapStateMachineTest { public void setUp() throws Exception { mTargetContext = InstrumentationRegistry.getTargetContext(); Assume.assumeTrue("Ignore test when BluetoothPbapService is not enabled", mTargetContext.getResources().getBoolean(R.bool.profile_supported_pbap)); BluetoothPbapService.isEnabled()); MockitoAnnotations.initMocks(this); TestUtils.setAdapterService(mAdapterService); // This line must be called to make sure relevant objects are initialized properly Loading @@ -84,7 +84,7 @@ public class PbapStateMachineTest { @After public void tearDown() throws Exception { if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_pbap)) { if (!BluetoothPbapService.isEnabled()) { return; } mHandlerThread.quitSafely(); Loading Loading
android/app/AndroidManifest.xml +17 −15 Original line number Diff line number Diff line Loading @@ -325,6 +325,23 @@ </intent-filter> </service> <!-- Phonebook Access Profile (PBAP) server Profile Service and owned Activiie --> <service android:process="@string/process" android:permission="android.permission.BLUETOOTH_PRIVILEGED" android:name="com.android.bluetooth.pbap.BluetoothPbapService" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.bluetooth.IBluetoothPbap"/> </intent-filter> </service> <activity android:name="com.android.bluetooth.pbap.BluetoothPbapActivity" android:process="@string/process" android:excludeFromRecents="true" android:theme="@style/dialog" android:enabled="false"> </activity> <!-- Telephony Bearer Service (TBS) server Profile Service --> <service android:process="@string/process" Loading Loading @@ -484,21 +501,6 @@ <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> <activity android:name="com.android.bluetooth.pbap.BluetoothPbapActivity" android:process="@string/process" android:excludeFromRecents="true" android:theme="@style/dialog" android:enabled="@bool/profile_supported_pbap"> </activity> <service android:process="@string/process" android:permission="android.permission.BLUETOOTH_PRIVILEGED" android:name="com.android.bluetooth.pbap.BluetoothPbapService" android:enabled="@bool/profile_supported_pbap" android:exported="true"> <intent-filter> <action android:name="android.bluetooth.IBluetoothPbap"/> </intent-filter> </service> <service android:process="@string/process" android:name=".sap.SapService" android:enabled="@bool/profile_supported_sap" Loading
android/app/res/values/config.xml +0 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ <bool name="profile_supported_hs_hfp">true</bool> <bool name="profile_supported_hfp_incallservice">true</bool> <bool name="profile_supported_opp">true</bool> <bool name="profile_supported_pbap">true</bool> <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> Loading
android/app/src/com/android/bluetooth/pbap/BluetoothPbapService.java +15 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.bluetooth.BluetoothSocket; import android.bluetooth.IBluetoothPbap; import android.content.AttributionSource; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; Loading @@ -55,6 +56,7 @@ import android.os.Message; import android.os.PowerManager; import android.os.UserHandle; import android.os.UserManager; import android.sysprop.BluetoothProperties; import android.telephony.TelephonyManager; import android.util.Log; Loading Loading @@ -88,6 +90,11 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect public static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE); /** * The component name of the owned BluetoothPbapActivity */ private static final String PBAP_ACTIVITY = BluetoothPbapActivity.class.getCanonicalName(); /** * Intent indicating incoming obex authentication request which is from * PCE(Carkit) Loading Loading @@ -176,6 +183,10 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect private static BluetoothPbapService sBluetoothPbapService; public static boolean isEnabled() { return BluetoothProperties.isProfilePbapServerEnabled().orElse(false); } private class BluetoothPbapContentObserver extends ContentObserver { BluetoothPbapContentObserver() { super(new Handler()); Loading Loading @@ -562,6 +573,9 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect mDatabaseManager = Objects.requireNonNull(AdapterService.getAdapterService().getDatabase(), "DatabaseManager cannot be null when PbapService starts"); // Enable owned Activity component setComponentAvailable(PBAP_ACTIVITY, true); mContext = this; mContactsLoaded = false; mHandlerThread = new HandlerThread("PbapHandlerThread"); Loading Loading @@ -613,6 +627,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect unregisterReceiver(mPbapReceiver); getContentResolver().unregisterContentObserver(mContactChangeObserver); mContactChangeObserver = null; setComponentAvailable(PBAP_ACTIVITY, false); return true; } Loading
android/app/tests/unit/src/com/android/bluetooth/pbap/BluetoothPbapServiceTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ public class BluetoothPbapServiceTest { public void setUp() throws Exception { mTargetContext = InstrumentationRegistry.getTargetContext(); Assume.assumeTrue("Ignore test when BluetoothPbapService is not enabled", mTargetContext.getResources().getBoolean(R.bool.profile_supported_pbap)); BluetoothPbapService.isEnabled()); MockitoAnnotations.initMocks(this); TestUtils.setAdapterService(mAdapterService); doReturn(mDatabaseManager).when(mAdapterService).getDatabase(); Loading @@ -72,7 +72,7 @@ public class BluetoothPbapServiceTest { @After public void tearDown() throws Exception { if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_pbap)) { if (!BluetoothPbapService.isEnabled()) { return; } TestUtils.stopService(mServiceRule, BluetoothPbapService.class); Loading
android/app/tests/unit/src/com/android/bluetooth/pbap/PbapStateMachineTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ public class PbapStateMachineTest { public void setUp() throws Exception { mTargetContext = InstrumentationRegistry.getTargetContext(); Assume.assumeTrue("Ignore test when BluetoothPbapService is not enabled", mTargetContext.getResources().getBoolean(R.bool.profile_supported_pbap)); BluetoothPbapService.isEnabled()); MockitoAnnotations.initMocks(this); TestUtils.setAdapterService(mAdapterService); // This line must be called to make sure relevant objects are initialized properly Loading @@ -84,7 +84,7 @@ public class PbapStateMachineTest { @After public void tearDown() throws Exception { if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_pbap)) { if (!BluetoothPbapService.isEnabled()) { return; } mHandlerThread.quitSafely(); Loading