Paul Lawrence | 3146752 | 2016-02-23 07:35:27 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | package com.android.settings.applications; |
| 17 | |
Fan Zhang | 31b2100 | 2019-01-16 13:49:47 -0800 | [diff] [blame] | 18 | import android.app.settings.SettingsEnums; |
Paul Lawrence | 3146752 | 2016-02-23 07:35:27 -0800 | [diff] [blame] | 19 | import android.content.Intent; |
| 20 | import android.os.Bundle; |
| 21 | import android.view.LayoutInflater; |
| 22 | import android.view.View; |
| 23 | import android.view.ViewGroup; |
| 24 | import android.widget.Button; |
| 25 | |
| 26 | import com.android.settings.R; |
Jason Monk | 019aad4 | 2016-05-10 13:27:20 -0400 | [diff] [blame] | 27 | import com.android.settings.SettingsPreferenceFragment; |
Paul Lawrence | 3146752 | 2016-02-23 07:35:27 -0800 | [diff] [blame] | 28 | |
Jason Monk | 019aad4 | 2016-05-10 13:27:20 -0400 | [diff] [blame] | 29 | public class ConfirmConvertToFbe extends SettingsPreferenceFragment { |
Paul Lawrence | 3146752 | 2016-02-23 07:35:27 -0800 | [diff] [blame] | 30 | static final String TAG = "ConfirmConvertToFBE"; |
| 31 | |
| 32 | @Override |
| 33 | public View onCreateView(LayoutInflater inflater, ViewGroup container, |
| 34 | Bundle savedInstanceState) { |
| 35 | View rootView = inflater.inflate(R.layout.confirm_convert_fbe, null); |
| 36 | |
| 37 | final Button button = (Button) rootView.findViewById(R.id.button_confirm_convert_fbe); |
| 38 | button.setOnClickListener(new View.OnClickListener() { |
| 39 | public void onClick(View v) { |
Lenka Trochtova | 3393dac | 2017-02-13 15:05:27 +0100 | [diff] [blame] | 40 | Intent intent = new Intent(Intent.ACTION_FACTORY_RESET); |
Paul Lawrence | 3146752 | 2016-02-23 07:35:27 -0800 | [diff] [blame] | 41 | intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); |
Paul Lawrence | 5b729c3 | 2017-03-10 14:22:24 -0800 | [diff] [blame] | 42 | intent.setPackage("android"); |
Paul Lawrence | 3146752 | 2016-02-23 07:35:27 -0800 | [diff] [blame] | 43 | intent.putExtra(Intent.EXTRA_REASON, "convert_fbe"); |
| 44 | getActivity().sendBroadcast(intent); |
| 45 | } |
| 46 | }); |
| 47 | |
| 48 | return rootView; |
| 49 | } |
Jason Monk | 019aad4 | 2016-05-10 13:27:20 -0400 | [diff] [blame] | 50 | |
| 51 | @Override |
Fan Zhang | 6507613 | 2016-08-08 10:25:13 -0700 | [diff] [blame] | 52 | public int getMetricsCategory() { |
Fan Zhang | 31b2100 | 2019-01-16 13:49:47 -0800 | [diff] [blame] | 53 | return SettingsEnums.CONVERT_FBE_CONFIRM; |
Jason Monk | 019aad4 | 2016-05-10 13:27:20 -0400 | [diff] [blame] | 54 | } |
Paul Lawrence | 3146752 | 2016-02-23 07:35:27 -0800 | [diff] [blame] | 55 | } |