Use BluetoothAdapter instead of LocalBluetoothAdapter

LocalBluetoothAdapter only has a few APIs that is not supported
by BluetoothAdapter, and lots of LocalBluetoothAdapter function
pass parameter to BluetoothAdapter directly.
Do the refactor in Settings, use BluetoothAdapter instead of
LocalBluetoothAdapter.

Bug: 111769754
Test: make -j42 RunSettingsRoboTests
Change-Id: I88e5a8377b5d1106c7679e6a8c3fd1ca1a80ea6f
This commit is contained in:
hughchen
2018-07-26 11:22:01 +08:00
parent 75bafefa49
commit e94b02206e
32 changed files with 327 additions and 341 deletions

View File

@@ -30,7 +30,6 @@ import com.android.settings.R;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.SettingsShadowResourcesImpl;
import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.settingslib.testutils.FragmentTestUtils;
@@ -50,10 +49,6 @@ import androidx.appcompat.app.AlertDialog;
@Config(shadows = {ShadowAlertDialogCompat.class, SettingsShadowResourcesImpl.class})
public class LocalDeviceNameDialogFragmentTest {
@Mock
private LocalBluetoothManager mManager;
@Mock
private LocalBluetoothAdapter mAdapter;
@Mock
private InputMethodManager mInputMethodManager;
@@ -65,8 +60,6 @@ public class LocalDeviceNameDialogFragmentTest {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
doReturn(mInputMethodManager).when(mContext).getSystemService(Context.INPUT_METHOD_SERVICE);
ReflectionHelpers.setStaticField(LocalBluetoothManager.class, "sInstance", mManager);
when(mManager.getBluetoothAdapter()).thenReturn(mAdapter);
mFragment = spy(LocalDeviceNameDialogFragment.newInstance());
when(mFragment.getContext()).thenReturn(mContext);