Replace Dependency.get with Dagger
Fixes: 218350942 Test: atest SystemUITests SystemUIGoogleTests Change-Id: I2ab2444967627c4f8e8806b74066017d68d0efcd
This commit is contained in:
@@ -50,7 +50,6 @@ import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
|
||||
import com.android.systemui.CoreStartable;
|
||||
import com.android.systemui.Dependency;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.dagger.SysUISingleton;
|
||||
|
||||
@@ -61,6 +60,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Provider;
|
||||
|
||||
/** */
|
||||
@SysUISingleton
|
||||
@@ -106,6 +106,8 @@ public class KeyboardUI extends CoreStartable implements InputManager.OnTabletMo
|
||||
|
||||
protected volatile Context mContext;
|
||||
|
||||
private final Provider<LocalBluetoothManager> mBluetoothManagerProvider;
|
||||
|
||||
private boolean mEnabled;
|
||||
private String mKeyboardName;
|
||||
private CachedBluetoothDeviceManager mCachedDeviceManager;
|
||||
@@ -122,8 +124,9 @@ public class KeyboardUI extends CoreStartable implements InputManager.OnTabletMo
|
||||
private int mState;
|
||||
|
||||
@Inject
|
||||
public KeyboardUI(Context context) {
|
||||
public KeyboardUI(Context context, Provider<LocalBluetoothManager> bluetoothManagerProvider) {
|
||||
super(context);
|
||||
this.mBluetoothManagerProvider = bluetoothManagerProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -181,7 +184,7 @@ public class KeyboardUI extends CoreStartable implements InputManager.OnTabletMo
|
||||
return;
|
||||
}
|
||||
|
||||
LocalBluetoothManager bluetoothManager = Dependency.get(LocalBluetoothManager.class);
|
||||
LocalBluetoothManager bluetoothManager = mBluetoothManagerProvider.get();
|
||||
if (bluetoothManager == null) {
|
||||
if (DEBUG) {
|
||||
Slog.e(TAG, "Failed to retrieve LocalBluetoothManager instance");
|
||||
|
||||
Reference in New Issue
Block a user