blob: ad82ae6eb51dbcf5ac593809ae5d874860c158f1 [file] [log] [blame]
cretin45d4cea552016-04-25 11:00:04 -07001/*
2 * Copyright (C) 2016 The CyanogenMod Project
Alessandro Astone35eda3a2020-11-13 21:56:33 +01003 * Copyright (C) 2017-2018,2020 The LineageOS Project
cretin45d4cea552016-04-25 11:00:04 -07004 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
Michael Bestasc83309e2018-02-03 17:42:13 +020018package org.lineageos.setupwizard;
cretin45d4cea552016-04-25 11:00:04 -070019
Michael Bestasc83309e2018-02-03 17:42:13 +020020import static org.lineageos.setupwizard.SetupWizardApp.REQUEST_CODE_SETUP_BLUETOOTH;
cretin45d4cea552016-04-25 11:00:04 -070021
22import android.content.Intent;
23import android.util.Log;
24
Michael Bestasc83309e2018-02-03 17:42:13 +020025import org.lineageos.setupwizard.util.SetupWizardUtils;
cretin45d4cea552016-04-25 11:00:04 -070026
Alessandro Astone35eda3a2020-11-13 21:56:33 +010027public class BluetoothSetupActivity extends WrapperSubBaseActivity {
cretin45d4cea552016-04-25 11:00:04 -070028
29 public static final String TAG = BluetoothSetupActivity.class.getSimpleName();
30
31 private static final String ACTION_CONNECT_INPUT =
32 "com.google.android.intent.action.CONNECT_INPUT";
33
34 private static final String INTENT_EXTRA_NO_INPUT_MODE = "no_input_mode";
35
36 @Override
37 protected void onStartSubactivity() {
38 try {
39 Intent intent = new Intent();
Michael Bestasb7b34b92021-08-25 19:13:30 +030040 intent.setComponent(SetupWizardUtils.sTvAddAccessorySettingsActivity);
cretin45d4cea552016-04-25 11:00:04 -070041 intent.setAction(ACTION_CONNECT_INPUT);
cretin45d4cea552016-04-25 11:00:04 -070042 intent.putExtra(INTENT_EXTRA_NO_INPUT_MODE, true);
Abhisek Devkota356dcde2017-10-22 20:56:34 -070043 startActivityForResult(intent, REQUEST_CODE_SETUP_BLUETOOTH);
cretin45d4cea552016-04-25 11:00:04 -070044 } catch (Exception e) {
45 Log.e(TAG, "Error starting bluetooth setup", e);
46 nextAction(RESULT_OK);
47 SetupWizardUtils.disableComponent(this, BluetoothSetupActivity.class);
48 finish();
49 }
50 }
51
52 @Override
53 protected int getSubactivityNextTransition() {
Abhisek Devkota356dcde2017-10-22 20:56:34 -070054 nextAction(RESULT_OK);
cretin45d4cea552016-04-25 11:00:04 -070055 return TRANSITION_ID_SLIDE;
56 }
57}