blob: 35ddc6b3ca565e5b41b66f39325d5acfb1a86485 [file] [log] [blame]
Paul Lawrence31467522016-02-23 07:35:27 -08001/*
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 */
16package com.android.settings.applications;
17
Fan Zhang31b21002019-01-16 13:49:47 -080018import android.app.settings.SettingsEnums;
Paul Lawrence31467522016-02-23 07:35:27 -080019import android.content.Intent;
20import android.os.Bundle;
21import android.view.LayoutInflater;
22import android.view.View;
23import android.view.ViewGroup;
24import android.widget.Button;
25
26import com.android.settings.R;
Jason Monk019aad42016-05-10 13:27:20 -040027import com.android.settings.SettingsPreferenceFragment;
Paul Lawrence31467522016-02-23 07:35:27 -080028
Jason Monk019aad42016-05-10 13:27:20 -040029public class ConfirmConvertToFbe extends SettingsPreferenceFragment {
Paul Lawrence31467522016-02-23 07:35:27 -080030 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 Trochtova3393dac2017-02-13 15:05:27 +010040 Intent intent = new Intent(Intent.ACTION_FACTORY_RESET);
Paul Lawrence31467522016-02-23 07:35:27 -080041 intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
Paul Lawrence5b729c32017-03-10 14:22:24 -080042 intent.setPackage("android");
Paul Lawrence31467522016-02-23 07:35:27 -080043 intent.putExtra(Intent.EXTRA_REASON, "convert_fbe");
44 getActivity().sendBroadcast(intent);
45 }
46 });
47
48 return rootView;
49 }
Jason Monk019aad42016-05-10 13:27:20 -040050
51 @Override
Fan Zhang65076132016-08-08 10:25:13 -070052 public int getMetricsCategory() {
Fan Zhang31b21002019-01-16 13:49:47 -080053 return SettingsEnums.CONVERT_FBE_CONFIRM;
Jason Monk019aad42016-05-10 13:27:20 -040054 }
Paul Lawrence31467522016-02-23 07:35:27 -080055}