The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 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; |
| 18 | |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 19 | import android.accounts.Account; |
| 20 | import android.accounts.AccountManager; |
| 21 | import android.accounts.AuthenticatorDescription; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 22 | import android.app.Activity; |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 23 | import android.app.Fragment; |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 24 | import android.content.Context; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 25 | import android.content.Intent; |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 26 | import android.content.pm.PackageManager; |
Zoltan Szatmary-Ban | 7cc1b9e | 2014-10-24 18:03:18 +0100 | [diff] [blame] | 27 | import android.content.pm.UserInfo; |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 28 | import android.content.res.Resources; |
Zoltan Szatmary-Ban | 7cc1b9e | 2014-10-24 18:03:18 +0100 | [diff] [blame] | 29 | import android.content.res.TypedArray; |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 30 | import android.graphics.drawable.Drawable; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 31 | import android.os.Bundle; |
Kenny Root | 3785e39 | 2011-01-18 15:14:32 -0800 | [diff] [blame] | 32 | import android.os.Environment; |
Amith Yamasani | 4339a47 | 2014-10-22 13:51:53 -0700 | [diff] [blame] | 33 | import android.os.Process; |
Ben Komalo | 2a32192 | 2011-09-07 16:42:34 -0700 | [diff] [blame] | 34 | import android.os.SystemProperties; |
Zoltan Szatmary-Ban | 7cc1b9e | 2014-10-24 18:03:18 +0100 | [diff] [blame] | 35 | import android.os.UserHandle; |
Amith Yamasani | 7eedcf4 | 2013-07-02 14:15:29 -0700 | [diff] [blame] | 36 | import android.os.UserManager; |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 37 | import android.preference.Preference; |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 38 | import android.util.Log; |
Zoltan Szatmary-Ban | 7cc1b9e | 2014-10-24 18:03:18 +0100 | [diff] [blame] | 39 | import android.util.SparseArray; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 40 | import android.view.LayoutInflater; |
| 41 | import android.view.View; |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 42 | import android.view.ViewGroup; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 43 | import android.widget.Button; |
Dianne Hackborn | 1337d0f | 2010-10-14 11:58:30 -0700 | [diff] [blame] | 44 | import android.widget.CheckBox; |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 45 | import android.widget.LinearLayout; |
| 46 | import android.widget.TextView; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 47 | |
Zoltan Szatmary-Ban | 7cc1b9e | 2014-10-24 18:03:18 +0100 | [diff] [blame] | 48 | import java.util.List; |
| 49 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 50 | /** |
| 51 | * Confirm and execute a reset of the device to a clean "just out of the box" |
| 52 | * state. Multiple confirmations are required: first, a general "are you sure |
| 53 | * you want to do this?" prompt, followed by a keyguard pattern trace if the user |
| 54 | * has defined one, followed by a final strongly-worded "THIS WILL ERASE EVERYTHING |
| 55 | * ON THE PHONE" prompt. If at any time the phone is allowed to go to sleep, is |
| 56 | * locked, et cetera, then the confirmation sequence is abandoned. |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 57 | * |
| 58 | * This is the initial screen. |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 59 | */ |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 60 | public class MasterClear extends Fragment { |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 61 | private static final String TAG = "MasterClear"; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 62 | |
| 63 | private static final int KEYGUARD_REQUEST = 55; |
| 64 | |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 65 | static final String ERASE_EXTERNAL_EXTRA = "erase_sd"; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 66 | |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 67 | private View mContentView; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 68 | private Button mInitiateButton; |
Dianne Hackborn | 1337d0f | 2010-10-14 11:58:30 -0700 | [diff] [blame] | 69 | private View mExternalStorageContainer; |
| 70 | private CheckBox mExternalStorage; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 71 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 72 | /** |
Jim Miller | 2deec7e | 2010-04-13 17:43:36 -0700 | [diff] [blame] | 73 | * Keyguard validation is run using the standard {@link ConfirmLockPattern} |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 74 | * component as a subactivity |
Jim Miller | 2deec7e | 2010-04-13 17:43:36 -0700 | [diff] [blame] | 75 | * @param request the request code to be returned once confirmation finishes |
| 76 | * @return true if confirmation launched |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 77 | */ |
Jim Miller | 2deec7e | 2010-04-13 17:43:36 -0700 | [diff] [blame] | 78 | private boolean runKeyguardConfirmation(int request) { |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 79 | Resources res = getActivity().getResources(); |
| 80 | return new ChooseLockSettingsHelper(getActivity(), this) |
Paul Crowley | 01fbd9f | 2014-11-04 22:51:36 +0000 | [diff] [blame] | 81 | .launchConfirmationActivity(request, null, |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 82 | res.getText(R.string.master_clear_gesture_explanation)); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | @Override |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 86 | public void onActivityResult(int requestCode, int resultCode, Intent data) { |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 87 | super.onActivityResult(requestCode, resultCode, data); |
| 88 | |
Julia Reynolds | 2c53933 | 2014-06-11 12:56:02 -0400 | [diff] [blame] | 89 | if (requestCode != KEYGUARD_REQUEST) { |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 90 | return; |
| 91 | } |
| 92 | |
| 93 | // If the user entered a valid keyguard trace, present the final |
| 94 | // confirmation prompt; otherwise, go back to the initial state. |
| 95 | if (resultCode == Activity.RESULT_OK) { |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 96 | showFinalConfirmation(); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 97 | } else { |
| 98 | establishInitialState(); |
| 99 | } |
| 100 | } |
| 101 | |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 102 | private void showFinalConfirmation() { |
| 103 | Preference preference = new Preference(getActivity()); |
| 104 | preference.setFragment(MasterClearConfirm.class.getName()); |
| 105 | preference.setTitle(R.string.master_clear_confirm_title); |
| 106 | preference.getExtras().putBoolean(ERASE_EXTERNAL_EXTRA, mExternalStorage.isChecked()); |
Fabrice Di Meglio | 263bcc8 | 2014-01-17 19:17:58 -0800 | [diff] [blame] | 107 | ((SettingsActivity) getActivity()).onPreferenceStartFragment(null, preference); |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 108 | } |
| 109 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 110 | /** |
| 111 | * If the user clicks to begin the reset sequence, we next require a |
| 112 | * keyguard confirmation if the user has currently enabled one. If there |
| 113 | * is no keyguard available, we simply go to the final confirmation prompt. |
| 114 | */ |
Ben Komalo | 2a32192 | 2011-09-07 16:42:34 -0700 | [diff] [blame] | 115 | private final Button.OnClickListener mInitiateListener = new Button.OnClickListener() { |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 116 | |
| 117 | public void onClick(View v) { |
| 118 | if (!runKeyguardConfirmation(KEYGUARD_REQUEST)) { |
| 119 | showFinalConfirmation(); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 120 | } |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 121 | } |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 122 | }; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 123 | |
| 124 | /** |
| 125 | * In its initial state, the activity presents a button for the user to |
| 126 | * click in order to initiate a confirmation sequence. This method is |
| 127 | * called from various other points in the code to reset the activity to |
| 128 | * this base state. |
Jim Miller | 47d380f | 2010-01-20 13:37:14 -0800 | [diff] [blame] | 129 | * |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 130 | * <p>Reinflating views from resources is expensive and prevents us from |
| 131 | * caching widget pointers, so we use a single-inflate pattern: we lazy- |
| 132 | * inflate each view, caching all of the widget pointers we'll need at the |
| 133 | * time, then simply reuse the inflated views directly whenever we need |
| 134 | * to change contents. |
| 135 | */ |
| 136 | private void establishInitialState() { |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 137 | mInitiateButton = (Button) mContentView.findViewById(R.id.initiate_master_clear); |
| 138 | mInitiateButton.setOnClickListener(mInitiateListener); |
| 139 | mExternalStorageContainer = mContentView.findViewById(R.id.erase_external_container); |
| 140 | mExternalStorage = (CheckBox) mContentView.findViewById(R.id.erase_external); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 141 | |
Kenny Root | 3785e39 | 2011-01-18 15:14:32 -0800 | [diff] [blame] | 142 | /* |
| 143 | * If the external storage is emulated, it will be erased with a factory |
| 144 | * reset at any rate. There is no need to have a separate option until |
| 145 | * we have a factory reset that only erases some directories and not |
Ben Komalo | 2a32192 | 2011-09-07 16:42:34 -0700 | [diff] [blame] | 146 | * others. Likewise, if it's non-removable storage, it could potentially have been |
| 147 | * encrypted, and will also need to be wiped. |
Kenny Root | 3785e39 | 2011-01-18 15:14:32 -0800 | [diff] [blame] | 148 | */ |
Ben Komalo | 2a32192 | 2011-09-07 16:42:34 -0700 | [diff] [blame] | 149 | boolean isExtStorageEmulated = Environment.isExternalStorageEmulated(); |
| 150 | if (isExtStorageEmulated |
| 151 | || (!Environment.isExternalStorageRemovable() && isExtStorageEncrypted())) { |
Kenny Root | 3785e39 | 2011-01-18 15:14:32 -0800 | [diff] [blame] | 152 | mExternalStorageContainer.setVisibility(View.GONE); |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 153 | |
Kenny Root | 3785e39 | 2011-01-18 15:14:32 -0800 | [diff] [blame] | 154 | final View externalOption = mContentView.findViewById(R.id.erase_external_option_text); |
| 155 | externalOption.setVisibility(View.GONE); |
| 156 | |
| 157 | final View externalAlsoErased = mContentView.findViewById(R.id.also_erases_external); |
| 158 | externalAlsoErased.setVisibility(View.VISIBLE); |
Ben Komalo | 2a32192 | 2011-09-07 16:42:34 -0700 | [diff] [blame] | 159 | |
| 160 | // If it's not emulated, it is on a separate partition but it means we're doing |
| 161 | // a force wipe due to encryption. |
| 162 | mExternalStorage.setChecked(!isExtStorageEmulated); |
Kenny Root | 3785e39 | 2011-01-18 15:14:32 -0800 | [diff] [blame] | 163 | } else { |
| 164 | mExternalStorageContainer.setOnClickListener(new View.OnClickListener() { |
| 165 | |
| 166 | @Override |
| 167 | public void onClick(View v) { |
| 168 | mExternalStorage.toggle(); |
| 169 | } |
| 170 | }); |
| 171 | } |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 172 | |
Zoltan Szatmary-Ban | 7cc1b9e | 2014-10-24 18:03:18 +0100 | [diff] [blame] | 173 | final UserManager um = (UserManager) getActivity().getSystemService(Context.USER_SERVICE); |
| 174 | loadAccountList(um); |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 175 | } |
| 176 | |
Ben Komalo | 2a32192 | 2011-09-07 16:42:34 -0700 | [diff] [blame] | 177 | private boolean isExtStorageEncrypted() { |
| 178 | String state = SystemProperties.get("vold.decrypt"); |
| 179 | return !"".equals(state); |
| 180 | } |
| 181 | |
Zoltan Szatmary-Ban | 7cc1b9e | 2014-10-24 18:03:18 +0100 | [diff] [blame] | 182 | private void loadAccountList(final UserManager um) { |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 183 | View accountsLabel = mContentView.findViewById(R.id.accounts_label); |
| 184 | LinearLayout contents = (LinearLayout)mContentView.findViewById(R.id.accounts); |
Amith Yamasani | 3f45de5 | 2011-09-22 14:34:17 -0700 | [diff] [blame] | 185 | contents.removeAllViews(); |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 186 | |
| 187 | Context context = getActivity(); |
Zoltan Szatmary-Ban | 7cc1b9e | 2014-10-24 18:03:18 +0100 | [diff] [blame] | 188 | final List<UserInfo> profiles = um.getProfiles(UserHandle.myUserId()); |
| 189 | final int profilesSize = profiles.size(); |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 190 | |
| 191 | AccountManager mgr = AccountManager.get(context); |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 192 | |
| 193 | LayoutInflater inflater = (LayoutInflater)context.getSystemService( |
| 194 | Context.LAYOUT_INFLATER_SERVICE); |
| 195 | |
Zoltan Szatmary-Ban | 7cc1b9e | 2014-10-24 18:03:18 +0100 | [diff] [blame] | 196 | int accountsCount = 0; |
| 197 | for (int profileIndex = 0; profileIndex < profilesSize; profileIndex++) { |
| 198 | final UserInfo userInfo = profiles.get(profileIndex); |
| 199 | final int profileId = userInfo.id; |
| 200 | final UserHandle userHandle = new UserHandle(profileId); |
| 201 | Account[] accounts = mgr.getAccountsAsUser(profileId); |
| 202 | final int N = accounts.length; |
| 203 | if (N == 0) { |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 204 | continue; |
| 205 | } |
Zoltan Szatmary-Ban | 7cc1b9e | 2014-10-24 18:03:18 +0100 | [diff] [blame] | 206 | accountsCount += N; |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 207 | |
Zoltan Szatmary-Ban | 7cc1b9e | 2014-10-24 18:03:18 +0100 | [diff] [blame] | 208 | AuthenticatorDescription[] descs = AccountManager.get(context) |
| 209 | .getAuthenticatorTypesAsUser(profileId); |
| 210 | final int M = descs.length; |
| 211 | |
| 212 | View titleView = newTitleView(contents, inflater); |
| 213 | final TextView titleText = (TextView) titleView.findViewById(android.R.id.title); |
| 214 | titleText.setText(userInfo.isManagedProfile() ? R.string.category_work |
| 215 | : R.string.category_personal); |
| 216 | contents.addView(titleView); |
| 217 | |
| 218 | for (int i = 0; i < N; i++) { |
| 219 | Account account = accounts[i]; |
| 220 | AuthenticatorDescription desc = null; |
| 221 | for (int j = 0; j < M; j++) { |
| 222 | if (account.type.equals(descs[j].type)) { |
| 223 | desc = descs[j]; |
| 224 | break; |
| 225 | } |
| 226 | } |
| 227 | if (desc == null) { |
| 228 | Log.w(TAG, "No descriptor for account name=" + account.name |
| 229 | + " type=" + account.type); |
| 230 | continue; |
| 231 | } |
| 232 | Drawable icon = null; |
| 233 | try { |
| 234 | if (desc.iconId != 0) { |
Zoltan Szatmary-Ban | 546790c | 2014-12-02 17:22:10 +0000 | [diff] [blame] | 235 | Context authContext = context.createPackageContextAsUser(desc.packageName, |
| 236 | 0, userHandle); |
Zoltan Szatmary-Ban | 7cc1b9e | 2014-10-24 18:03:18 +0100 | [diff] [blame] | 237 | icon = context.getPackageManager().getUserBadgedIcon( |
| 238 | authContext.getDrawable(desc.iconId), userHandle); |
| 239 | } |
| 240 | } catch (PackageManager.NameNotFoundException e) { |
| 241 | Log.w(TAG, "No icon for account type " + desc.type); |
| 242 | } |
| 243 | |
| 244 | TextView child = (TextView)inflater.inflate(R.layout.master_clear_account, |
| 245 | contents, false); |
| 246 | child.setText(account.name); |
| 247 | if (icon != null) { |
| 248 | child.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); |
| 249 | } |
| 250 | contents.addView(child); |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 251 | } |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 252 | } |
| 253 | |
Zoltan Szatmary-Ban | 7cc1b9e | 2014-10-24 18:03:18 +0100 | [diff] [blame] | 254 | if (accountsCount > 0) { |
| 255 | accountsLabel.setVisibility(View.VISIBLE); |
| 256 | contents.setVisibility(View.VISIBLE); |
| 257 | } |
| 258 | // Checking for all other users and their profiles if any. |
| 259 | View otherUsers = mContentView.findViewById(R.id.other_users_present); |
| 260 | final boolean hasOtherUsers = (um.getUserCount() - profilesSize) > 0; |
| 261 | otherUsers.setVisibility(hasOtherUsers ? View.VISIBLE : View.GONE); |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | @Override |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 265 | public View onCreateView(LayoutInflater inflater, ViewGroup container, |
| 266 | Bundle savedInstanceState) { |
Amith Yamasani | 4339a47 | 2014-10-22 13:51:53 -0700 | [diff] [blame] | 267 | if (!Process.myUserHandle().isOwner() |
| 268 | || UserManager.get(getActivity()).hasUserRestriction( |
Julia Reynolds | 2c53933 | 2014-06-11 12:56:02 -0400 | [diff] [blame] | 269 | UserManager.DISALLOW_FACTORY_RESET)) { |
| 270 | return inflater.inflate(R.layout.master_clear_disallowed_screen, null); |
| 271 | } |
| 272 | |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 273 | mContentView = inflater.inflate(R.layout.master_clear, null); |
Joe Onorato | b51886d | 2010-11-08 18:25:51 -0800 | [diff] [blame] | 274 | |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 275 | establishInitialState(); |
Amith Yamasani | b14e1e0 | 2010-11-02 09:52:29 -0700 | [diff] [blame] | 276 | return mContentView; |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 277 | } |
Zoltan Szatmary-Ban | 7cc1b9e | 2014-10-24 18:03:18 +0100 | [diff] [blame] | 278 | |
| 279 | private View newTitleView(ViewGroup parent, LayoutInflater inflater) { |
| 280 | final TypedArray a = inflater.getContext().obtainStyledAttributes(null, |
| 281 | com.android.internal.R.styleable.Preference, |
| 282 | com.android.internal.R.attr.preferenceCategoryStyle, 0); |
| 283 | final int resId = a.getResourceId(com.android.internal.R.styleable.Preference_layout, |
| 284 | 0); |
| 285 | return inflater.inflate(resId, parent, false); |
| 286 | } |
The Android Open Source Project | afc4ab2 | 2009-03-03 19:32:34 -0800 | [diff] [blame] | 287 | } |