blob: 1ec99b005982defb2115981b8cb6b392d4238ff0 [file] [log] [blame]
timhypengc3bd8012020-09-02 15:54:18 +08001/*
2 * Copyright 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.settings.media;
18
19import android.app.settings.SettingsEnums;
20import android.content.BroadcastReceiver;
21import android.content.Context;
22import android.content.Intent;
23import android.text.TextUtils;
24
25import com.android.settings.R;
26import com.android.settings.bluetooth.BluetoothPairingDetail;
27import com.android.settings.core.SubSettingLauncher;
timhypenga7a73c42020-12-22 21:15:49 +080028import com.android.settingslib.media.MediaOutputConstants;
timhypengc3bd8012020-09-02 15:54:18 +080029
30/**
31 * BroadcastReceiver for handling media output intent
32 */
33public class BluetoothPairingReceiver extends BroadcastReceiver {
34 @Override
35 public void onReceive(Context context, Intent intent) {
timhypenga7a73c42020-12-22 21:15:49 +080036 if (TextUtils.equals(MediaOutputConstants.ACTION_LAUNCH_BLUETOOTH_PAIRING,
timhypengc3bd8012020-09-02 15:54:18 +080037 intent.getAction())) {
38 context.startActivity(new SubSettingLauncher(context)
39 .setDestination(BluetoothPairingDetail.class.getName())
40 .setTitleRes(R.string.bluetooth_pairing_page_title)
41 .setSourceMetricsCategory(SettingsEnums.BLUETOOTH_PAIRING_RECEIVER)
42 .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)
43 .toIntent());
44 }
45 }
46}