use of com.android.settingslib.bluetooth.LocalBluetoothManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class Utils method showError.
static void showError(Context context, String name, int messageResId) {
String message = context.getString(messageResId, name);
LocalBluetoothManager manager = getLocalBtManager(context);
Context activity = manager.getForegroundActivity();
if (manager.isForegroundActivity()) {
new AlertDialog.Builder(activity).setTitle(R.string.bluetooth_error_title).setMessage(message).setPositiveButton(android.R.string.ok, null).show();
} else {
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
}
}
use of com.android.settingslib.bluetooth.LocalBluetoothManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DockService method onCreate.
@Override
public void onCreate() {
if (DEBUG)
Log.d(TAG, "onCreate");
LocalBluetoothManager manager = Utils.getLocalBtManager(this);
if (manager == null) {
Log.e(TAG, "Can't get LocalBluetoothManager: exiting");
return;
}
mLocalAdapter = manager.getBluetoothAdapter();
mDeviceManager = manager.getCachedDeviceManager();
mProfileManager = manager.getProfileManager();
if (mProfileManager == null) {
Log.e(TAG, "Can't get LocalBluetoothProfileManager: exiting");
return;
}
HandlerThread thread = new HandlerThread("DockService");
thread.start();
mServiceLooper = thread.getLooper();
mServiceHandler = new ServiceHandler(mServiceLooper);
}
use of com.android.settingslib.bluetooth.LocalBluetoothManager in project android_frameworks_base by crdroidandroid.
the class KeyboardUI method init.
// Shoud only be called on the handler thread
private void init() {
Context context = mContext;
mKeyboardName = context.getString(com.android.internal.R.string.config_packagedKeyboardName);
if (TextUtils.isEmpty(mKeyboardName)) {
if (DEBUG) {
Slog.d(TAG, "No packaged keyboard name given.");
}
return;
}
LocalBluetoothManager bluetoothManager = LocalBluetoothManager.getInstance(context, null);
if (bluetoothManager == null) {
if (DEBUG) {
Slog.e(TAG, "Failed to retrieve LocalBluetoothManager instance");
}
return;
}
mEnabled = true;
mCachedDeviceManager = bluetoothManager.getCachedDeviceManager();
mLocalBluetoothAdapter = bluetoothManager.getBluetoothAdapter();
mProfileManager = bluetoothManager.getProfileManager();
bluetoothManager.getEventManager().registerCallback(new BluetoothCallbackHandler());
Utils.setErrorListener(new BluetoothErrorListener());
InputManager im = context.getSystemService(InputManager.class);
im.registerOnTabletModeChangedListener(this, mHandler);
mInTabletMode = im.isInTabletMode();
processKeyboardState();
mUIHandler = new KeyboardUIHandler();
}
use of com.android.settingslib.bluetooth.LocalBluetoothManager in project android_frameworks_base by AOSPA.
the class KeyboardUI method init.
// Shoud only be called on the handler thread
private void init() {
Context context = mContext;
mKeyboardName = context.getString(com.android.internal.R.string.config_packagedKeyboardName);
if (TextUtils.isEmpty(mKeyboardName)) {
if (DEBUG) {
Slog.d(TAG, "No packaged keyboard name given.");
}
return;
}
LocalBluetoothManager bluetoothManager = LocalBluetoothManager.getInstance(context, null);
if (bluetoothManager == null) {
if (DEBUG) {
Slog.e(TAG, "Failed to retrieve LocalBluetoothManager instance");
}
return;
}
mEnabled = true;
mCachedDeviceManager = bluetoothManager.getCachedDeviceManager();
mLocalBluetoothAdapter = bluetoothManager.getBluetoothAdapter();
mProfileManager = bluetoothManager.getProfileManager();
bluetoothManager.getEventManager().registerCallback(new BluetoothCallbackHandler());
Utils.setErrorListener(new BluetoothErrorListener());
InputManager im = context.getSystemService(InputManager.class);
im.registerOnTabletModeChangedListener(this, mHandler);
mInTabletMode = im.isInTabletMode();
processKeyboardState();
mUIHandler = new KeyboardUIHandler();
}
use of com.android.settingslib.bluetooth.LocalBluetoothManager in project android_packages_apps_Settings by LineageOS.
the class LocalDeviceNameDialogFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LocalBluetoothManager localManager = Utils.getLocalBtManager(getActivity());
mLocalAdapter = localManager.getBluetoothAdapter();
}
Aggregations