| cretin45 | d4cea55 | 2016-04-25 11:00:04 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The CyanogenMod Project |
| Alessandro Astone | 35eda3a | 2020-11-13 21:56:33 +0100 | [diff] [blame] | 3 | * Copyright (C) 2017-2018,2020 The LineageOS Project |
| cretin45 | d4cea55 | 2016-04-25 11:00:04 -0700 | [diff] [blame] | 4 | * |
| 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 Bestas | c83309e | 2018-02-03 17:42:13 +0200 | [diff] [blame] | 18 | package org.lineageos.setupwizard; |
| cretin45 | d4cea55 | 2016-04-25 11:00:04 -0700 | [diff] [blame] | 19 | |
| Michael Bestas | c83309e | 2018-02-03 17:42:13 +0200 | [diff] [blame] | 20 | import static org.lineageos.setupwizard.SetupWizardApp.REQUEST_CODE_SETUP_BLUETOOTH; |
| cretin45 | d4cea55 | 2016-04-25 11:00:04 -0700 | [diff] [blame] | 21 | |
| 22 | import android.content.Intent; |
| 23 | import android.util.Log; |
| 24 | |
| Michael Bestas | c83309e | 2018-02-03 17:42:13 +0200 | [diff] [blame] | 25 | import org.lineageos.setupwizard.util.SetupWizardUtils; |
| cretin45 | d4cea55 | 2016-04-25 11:00:04 -0700 | [diff] [blame] | 26 | |
| Alessandro Astone | 35eda3a | 2020-11-13 21:56:33 +0100 | [diff] [blame] | 27 | public class BluetoothSetupActivity extends WrapperSubBaseActivity { |
| cretin45 | d4cea55 | 2016-04-25 11:00:04 -0700 | [diff] [blame] | 28 | |
| 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 Bestas | b7b34b9 | 2021-08-25 19:13:30 +0300 | [diff] [blame^] | 40 | intent.setComponent(SetupWizardUtils.sTvAddAccessorySettingsActivity); |
| cretin45 | d4cea55 | 2016-04-25 11:00:04 -0700 | [diff] [blame] | 41 | intent.setAction(ACTION_CONNECT_INPUT); |
| cretin45 | d4cea55 | 2016-04-25 11:00:04 -0700 | [diff] [blame] | 42 | intent.putExtra(INTENT_EXTRA_NO_INPUT_MODE, true); |
| Abhisek Devkota | 356dcde | 2017-10-22 20:56:34 -0700 | [diff] [blame] | 43 | startActivityForResult(intent, REQUEST_CODE_SETUP_BLUETOOTH); |
| cretin45 | d4cea55 | 2016-04-25 11:00:04 -0700 | [diff] [blame] | 44 | } 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 Devkota | 356dcde | 2017-10-22 20:56:34 -0700 | [diff] [blame] | 54 | nextAction(RESULT_OK); |
| cretin45 | d4cea55 | 2016-04-25 11:00:04 -0700 | [diff] [blame] | 55 | return TRANSITION_ID_SLIDE; |
| 56 | } |
| 57 | } |