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 18 import android.app.settings.SettingsEnums; 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; 27 import com.android.settings.SettingsPreferenceFragment; 28 29 public class ConfirmConvertToFbe extends SettingsPreferenceFragment { 30 static final String TAG = "ConfirmConvertToFBE"; 31 32 @Override onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)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) { 40 Intent intent = new Intent(Intent.ACTION_FACTORY_RESET); 41 intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); 42 intent.setPackage("android"); 43 intent.putExtra(Intent.EXTRA_REASON, "convert_fbe"); 44 getActivity().sendBroadcast(intent); 45 } 46 }); 47 48 return rootView; 49 } 50 51 @Override getMetricsCategory()52 public int getMetricsCategory() { 53 return SettingsEnums.CONVERT_FBE_CONFIRM; 54 } 55 } 56