Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +0 −14 Original line number Diff line number Diff line Loading @@ -638,10 +638,6 @@ public class AdapterService extends Service { if (mCallbacks !=null) { mCallbacks.kill(); } if (!isMock()) { System.exit(0); } } private static final int MESSAGE_PROFILE_SERVICE_STATE_CHANGED =1; Loading Loading @@ -2295,14 +2291,4 @@ public class AdapterService extends Service { } } } // Returns if this is a mock object. This is currently used in testing so that we may not call // System.exit() while finalizing the object. Otherwise GC of mock objects unfortunately ends up // calling finalize() which in turn calls System.exit() and the process crashes. // // Mock this in your testing framework to return true to avoid the mentioned behavior. In // production this has no effect. public boolean isMock() { return false; } } android/app/tests/src/com/android/bluetooth/btservice/PhonePolicyTest.java +0 −12 Original line number Diff line number Diff line Loading @@ -91,9 +91,6 @@ public class PhonePolicyTest extends AndroidTestCase { // Mock the looper when(mockAdapterService.getMainLooper()).thenReturn(mHandlerThread.getLooper()); // Tell the adapterservice that it is a mock (see isMock documentation) when(mockAdapterService.isMock()).thenReturn(true); PhonePolicy phPol = new PhonePolicy(mockAdapterService, mockServiceFactory); // Get the broadcast receiver to inject events. Loading Loading @@ -150,8 +147,6 @@ public class PhonePolicyTest extends AndroidTestCase { // Mock the looper when(mockAdapterService.getMainLooper()).thenReturn(mHandlerThread.getLooper()); // Tell the adapterservice that it is a mock (see isMock documentation) when(mockAdapterService.isMock()).thenReturn(true); PhonePolicy phPol = new PhonePolicy(mockAdapterService, mockServiceFactory); // Get the broadcast receiver to inject events Loading Loading @@ -200,8 +195,6 @@ public class PhonePolicyTest extends AndroidTestCase { // Mock the looper when(mockAdapterService.getMainLooper()).thenReturn(mHandlerThread.getLooper()); // Tell the adapterservice that it is a mock (see isMock documentation) when(mockAdapterService.isMock()).thenReturn(true); PhonePolicy phPol = new PhonePolicy(mockAdapterService, mockServiceFactory); // Get the broadcast receiver to inject events Loading Loading @@ -261,8 +254,6 @@ public class PhonePolicyTest extends AndroidTestCase { // Mock the looper when(mockAdapterService.getMainLooper()).thenReturn(mHandlerThread.getLooper()); // Tell the adapterservice that it is a mock (see isMock documentation) when(mockAdapterService.isMock()).thenReturn(true); PhonePolicy phPol = new PhonePolicy(mockAdapterService, mockServiceFactory); // Get the broadcast receiver to inject events Loading Loading @@ -322,9 +313,6 @@ public class PhonePolicyTest extends AndroidTestCase { // Mock the looper when(mockAdapterService.getMainLooper()).thenReturn(mHandlerThread.getLooper()); // Tell the adapterservice that it is a mock (see isMock documentation) when(mockAdapterService.isMock()).thenReturn(true); PhonePolicy phPol = new PhonePolicy(mockAdapterService, mockServiceFactory); // Get the broadcast receiver to inject events. Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +0 −14 Original line number Diff line number Diff line Loading @@ -638,10 +638,6 @@ public class AdapterService extends Service { if (mCallbacks !=null) { mCallbacks.kill(); } if (!isMock()) { System.exit(0); } } private static final int MESSAGE_PROFILE_SERVICE_STATE_CHANGED =1; Loading Loading @@ -2295,14 +2291,4 @@ public class AdapterService extends Service { } } } // Returns if this is a mock object. This is currently used in testing so that we may not call // System.exit() while finalizing the object. Otherwise GC of mock objects unfortunately ends up // calling finalize() which in turn calls System.exit() and the process crashes. // // Mock this in your testing framework to return true to avoid the mentioned behavior. In // production this has no effect. public boolean isMock() { return false; } }
android/app/tests/src/com/android/bluetooth/btservice/PhonePolicyTest.java +0 −12 Original line number Diff line number Diff line Loading @@ -91,9 +91,6 @@ public class PhonePolicyTest extends AndroidTestCase { // Mock the looper when(mockAdapterService.getMainLooper()).thenReturn(mHandlerThread.getLooper()); // Tell the adapterservice that it is a mock (see isMock documentation) when(mockAdapterService.isMock()).thenReturn(true); PhonePolicy phPol = new PhonePolicy(mockAdapterService, mockServiceFactory); // Get the broadcast receiver to inject events. Loading Loading @@ -150,8 +147,6 @@ public class PhonePolicyTest extends AndroidTestCase { // Mock the looper when(mockAdapterService.getMainLooper()).thenReturn(mHandlerThread.getLooper()); // Tell the adapterservice that it is a mock (see isMock documentation) when(mockAdapterService.isMock()).thenReturn(true); PhonePolicy phPol = new PhonePolicy(mockAdapterService, mockServiceFactory); // Get the broadcast receiver to inject events Loading Loading @@ -200,8 +195,6 @@ public class PhonePolicyTest extends AndroidTestCase { // Mock the looper when(mockAdapterService.getMainLooper()).thenReturn(mHandlerThread.getLooper()); // Tell the adapterservice that it is a mock (see isMock documentation) when(mockAdapterService.isMock()).thenReturn(true); PhonePolicy phPol = new PhonePolicy(mockAdapterService, mockServiceFactory); // Get the broadcast receiver to inject events Loading Loading @@ -261,8 +254,6 @@ public class PhonePolicyTest extends AndroidTestCase { // Mock the looper when(mockAdapterService.getMainLooper()).thenReturn(mHandlerThread.getLooper()); // Tell the adapterservice that it is a mock (see isMock documentation) when(mockAdapterService.isMock()).thenReturn(true); PhonePolicy phPol = new PhonePolicy(mockAdapterService, mockServiceFactory); // Get the broadcast receiver to inject events Loading Loading @@ -322,9 +313,6 @@ public class PhonePolicyTest extends AndroidTestCase { // Mock the looper when(mockAdapterService.getMainLooper()).thenReturn(mHandlerThread.getLooper()); // Tell the adapterservice that it is a mock (see isMock documentation) when(mockAdapterService.isMock()).thenReturn(true); PhonePolicy phPol = new PhonePolicy(mockAdapterService, mockServiceFactory); // Get the broadcast receiver to inject events. Loading