Loading android/app/src/com/android/bluetooth/mapclient/MapClientService.java +3 −7 Original line number Diff line number Diff line Loading @@ -74,9 +74,10 @@ public class MapClientService extends ProfileService { } @VisibleForTesting MapClientService(Context ctx, Looper looper) { MapClientService(Context ctx, Looper looper, MnsService mnsServer) { this(ctx); mSmLooper = looper; mMnsServer = mnsServer; } public static boolean isEnabled() { Loading Loading @@ -329,12 +330,7 @@ public class MapClientService extends ProfileService { mHandler = new Handler(Looper.getMainLooper()); if (mMnsServer == null) { mMnsServer = MapUtils.newMnsServiceInstance(this); if (mMnsServer == null) { // this can't happen Log.w(TAG, "MnsService is *not* created!"); return false; } mMnsServer = new MnsService(this); } removeUncleanAccounts(); Loading android/app/src/com/android/bluetooth/mapclient/MapUtils.java +0 −10 Original line number Diff line number Diff line Loading @@ -19,27 +19,17 @@ import android.os.Binder; import android.os.SystemProperties; import com.android.bluetooth.Utils; import com.android.internal.annotations.VisibleForTesting; class MapUtils { private static MnsService sMnsService = null; private static final String FETCH_MESSAGE_TYPE = "persist.bluetooth.pts.mapclient.fetchmessagetype"; private static final String SEND_MESSAGE_TYPE = "persist.bluetooth.pts.mapclient.sendmessagetype"; @VisibleForTesting static void setMnsService(MnsService service) { sMnsService = service; } static boolean isSystemUser() { return Binder.getCallingUserHandle().isSystem(); } static MnsService newMnsServiceInstance(MapClientService mapClientService) { return (sMnsService == null) ? new MnsService(mapClientService) : sMnsService; } static byte fetchMessageType() { if (Utils.isPtsTestMode()) { return (byte) SystemProperties.getInt(FETCH_MESSAGE_TYPE, Loading android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientServiceTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.bluetooth.mapclient; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.anyString; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; Loading Loading @@ -73,7 +72,8 @@ public class MapClientServiceTest { mTestLooper = new TestLooper(); mService = new MapClientService(targetContext, mTestLooper.getLooper()); MnsService mnsServer = null; mService = new MapClientService(targetContext, mTestLooper.getLooper(), mnsServer); mService.doStart(); // Try getting the Bluetooth adapter Loading android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientTest.java +3 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.content.Context; import android.os.Looper; import android.os.UserHandle; import androidx.test.InstrumentationRegistry; Loading Loading @@ -67,9 +68,9 @@ public class MapClientTest { TestUtils.setAdapterService(mAdapterService); mIsAdapterServiceSet = true; when(mAdapterService.getDatabase()).thenReturn(mDatabaseManager); MapUtils.setMnsService(mMockMnsService); mIsMapClientServiceStarted = true; mService = new MapClientService(mTargetContext); Looper looper = null; mService = new MapClientService(mTargetContext, looper, mMockMnsService); mService.doStart(); mAdapter = BluetoothAdapter.getDefaultAdapter(); } Loading Loading
android/app/src/com/android/bluetooth/mapclient/MapClientService.java +3 −7 Original line number Diff line number Diff line Loading @@ -74,9 +74,10 @@ public class MapClientService extends ProfileService { } @VisibleForTesting MapClientService(Context ctx, Looper looper) { MapClientService(Context ctx, Looper looper, MnsService mnsServer) { this(ctx); mSmLooper = looper; mMnsServer = mnsServer; } public static boolean isEnabled() { Loading Loading @@ -329,12 +330,7 @@ public class MapClientService extends ProfileService { mHandler = new Handler(Looper.getMainLooper()); if (mMnsServer == null) { mMnsServer = MapUtils.newMnsServiceInstance(this); if (mMnsServer == null) { // this can't happen Log.w(TAG, "MnsService is *not* created!"); return false; } mMnsServer = new MnsService(this); } removeUncleanAccounts(); Loading
android/app/src/com/android/bluetooth/mapclient/MapUtils.java +0 −10 Original line number Diff line number Diff line Loading @@ -19,27 +19,17 @@ import android.os.Binder; import android.os.SystemProperties; import com.android.bluetooth.Utils; import com.android.internal.annotations.VisibleForTesting; class MapUtils { private static MnsService sMnsService = null; private static final String FETCH_MESSAGE_TYPE = "persist.bluetooth.pts.mapclient.fetchmessagetype"; private static final String SEND_MESSAGE_TYPE = "persist.bluetooth.pts.mapclient.sendmessagetype"; @VisibleForTesting static void setMnsService(MnsService service) { sMnsService = service; } static boolean isSystemUser() { return Binder.getCallingUserHandle().isSystem(); } static MnsService newMnsServiceInstance(MapClientService mapClientService) { return (sMnsService == null) ? new MnsService(mapClientService) : sMnsService; } static byte fetchMessageType() { if (Utils.isPtsTestMode()) { return (byte) SystemProperties.getInt(FETCH_MESSAGE_TYPE, Loading
android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientServiceTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.bluetooth.mapclient; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.anyString; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; Loading Loading @@ -73,7 +72,8 @@ public class MapClientServiceTest { mTestLooper = new TestLooper(); mService = new MapClientService(targetContext, mTestLooper.getLooper()); MnsService mnsServer = null; mService = new MapClientService(targetContext, mTestLooper.getLooper(), mnsServer); mService.doStart(); // Try getting the Bluetooth adapter Loading
android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientTest.java +3 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.content.Context; import android.os.Looper; import android.os.UserHandle; import androidx.test.InstrumentationRegistry; Loading Loading @@ -67,9 +68,9 @@ public class MapClientTest { TestUtils.setAdapterService(mAdapterService); mIsAdapterServiceSet = true; when(mAdapterService.getDatabase()).thenReturn(mDatabaseManager); MapUtils.setMnsService(mMockMnsService); mIsMapClientServiceStarted = true; mService = new MapClientService(mTargetContext); Looper looper = null; mService = new MapClientService(mTargetContext, looper, mMockMnsService); mService.doStart(); mAdapter = BluetoothAdapter.getDefaultAdapter(); } Loading