• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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 
17 package com.android.settings.bluetooth;
18 
19 import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
20 
21 import android.bluetooth.BluetoothDevice;
22 import android.content.Intent;
23 import android.os.Bundle;
24 
25 import androidx.annotation.Nullable;
26 import androidx.fragment.app.FragmentActivity;
27 
28 /** A dialog to ask the user to forget a bluetooth device when the key is missing. */
29 public class BluetoothKeyMissingDialog extends FragmentActivity {
30     public static final String FRAGMENT_TAG = "BtKeyMissingFrg";
31 
32     @Override
onCreate(@ullable Bundle savedInstanceState)33     protected void onCreate(@Nullable Bundle savedInstanceState) {
34         super.onCreate(savedInstanceState);
35 
36         getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
37         Intent intent = getIntent();
38         BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
39         if (device == null) {
40             finish();
41             return;
42         }
43         BluetoothKeyMissingDialogFragment fragment =
44                 BluetoothKeyMissingDialogFragment.newInstance(device);
45         fragment.show(getSupportFragmentManager(), FRAGMENT_TAG);
46         closeSystemDialogs();
47     }
48 }
49