Search in sources :

Example 1 with LocalMediaManager

use of com.android.settingslib.media.LocalMediaManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class MediaDeviceUpdateWorker method onSlicePinned.

@Override
protected void onSlicePinned() {
    mMediaDevices.clear();
    if (mLocalMediaManager == null) {
        mLocalMediaManager = new LocalMediaManager(mContext, mPackageName, null);
    }
    mLocalMediaManager.registerCallback(this);
    mLocalMediaManager.startScan();
}
Also used : LocalMediaManager(com.android.settingslib.media.LocalMediaManager)

Example 2 with LocalMediaManager

use of com.android.settingslib.media.LocalMediaManager in project android_packages_apps_Settings by omnirom.

the class MediaDeviceUpdateWorker method onSlicePinned.

@Override
protected void onSlicePinned() {
    mMediaDevices.clear();
    mIsTouched = false;
    if (mLocalMediaManager == null || !TextUtils.equals(mPackageName, mLocalMediaManager.getPackageName())) {
        mLocalMediaManager = new LocalMediaManager(mContext, mPackageName, null);
    }
    mLocalMediaManager.registerCallback(this);
    final IntentFilter intentFilter = new IntentFilter(STREAM_DEVICES_CHANGED_ACTION);
    mContext.registerReceiver(mReceiver, intentFilter);
    mLocalMediaManager.startScan();
}
Also used : LocalMediaManager(com.android.settingslib.media.LocalMediaManager) IntentFilter(android.content.IntentFilter)

Example 3 with LocalMediaManager

use of com.android.settingslib.media.LocalMediaManager in project android_packages_apps_Settings by omnirom.

the class MediaOutputIndicatorWorker method onSlicePinned.

@Override
protected void onSlicePinned() {
    mMediaDevices.clear();
    mLocalBluetoothManager = Utils.getLocalBtManager(getContext());
    if (mLocalBluetoothManager == null) {
        Log.e(TAG, "Bluetooth is not supported on this device");
        return;
    }
    final IntentFilter intentFilter = new IntentFilter(STREAM_DEVICES_CHANGED_ACTION);
    mContext.registerReceiver(mReceiver, intentFilter);
    mLocalBluetoothManager.getEventManager().registerCallback(this);
    ThreadUtils.postOnBackgroundThread(() -> {
        final MediaController controller = getActiveLocalMediaController();
        if (controller == null) {
            mPackageName = null;
        } else {
            mPackageName = controller.getPackageName();
        }
        if (mLocalMediaManager == null || !TextUtils.equals(mPackageName, mLocalMediaManager.getPackageName())) {
            mLocalMediaManager = new LocalMediaManager(mContext, mPackageName, null);
        }
        mLocalMediaManager.registerCallback(this);
        mLocalMediaManager.startScan();
    });
}
Also used : IntentFilter(android.content.IntentFilter) LocalMediaManager(com.android.settingslib.media.LocalMediaManager) MediaController(android.media.session.MediaController)

Aggregations

LocalMediaManager (com.android.settingslib.media.LocalMediaManager)3 IntentFilter (android.content.IntentFilter)2 MediaController (android.media.session.MediaController)1