Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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.contacts.common.preference; |
| 18 | |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 19 | import android.content.Context; |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 20 | import android.content.SharedPreferences; |
| 21 | import android.content.SharedPreferences.Editor; |
| 22 | import android.content.SharedPreferences.OnSharedPreferenceChangeListener; |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 23 | import android.os.Handler; |
Marcus Hagerott | 949d4e8 | 2016-09-20 13:23:05 -0700 | [diff] [blame] | 24 | import android.os.Looper; |
Tingting Wang | 1604c1e | 2015-10-28 15:51:32 -0700 | [diff] [blame] | 25 | import android.preference.PreferenceManager; |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 26 | import android.provider.Settings; |
| 27 | import android.provider.Settings.SettingNotFoundException; |
Marcus Hagerott | 949d4e8 | 2016-09-20 13:23:05 -0700 | [diff] [blame] | 28 | import android.support.annotation.NonNull; |
| 29 | import android.support.annotation.VisibleForTesting; |
Tingting Wang | 20c6ec5 | 2015-08-20 16:35:36 -0700 | [diff] [blame] | 30 | import android.text.TextUtils; |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 31 | |
| 32 | import com.android.contacts.common.R; |
Tingting Wang | 20c6ec5 | 2015-08-20 16:35:36 -0700 | [diff] [blame] | 33 | import com.android.contacts.common.model.account.AccountWithDataSet; |
Tingting Wang | 3571ced | 2016-01-13 10:29:44 -0800 | [diff] [blame] | 34 | |
Tingting Wang | 3571ced | 2016-01-13 10:29:44 -0800 | [diff] [blame] | 35 | import java.util.List; |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 36 | |
| 37 | /** |
| 38 | * Manages user preferences for contacts. |
| 39 | */ |
Brandon Maxwell | c031636 | 2016-02-03 16:28:06 -0800 | [diff] [blame] | 40 | public class ContactsPreferences implements OnSharedPreferenceChangeListener { |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 41 | |
| 42 | /** |
| 43 | * The value for the DISPLAY_ORDER key to show the given name first. |
| 44 | */ |
| 45 | public static final int DISPLAY_ORDER_PRIMARY = 1; |
| 46 | |
| 47 | /** |
| 48 | * The value for the DISPLAY_ORDER key to show the family name first. |
| 49 | */ |
| 50 | public static final int DISPLAY_ORDER_ALTERNATIVE = 2; |
| 51 | |
| 52 | public static final String DISPLAY_ORDER_KEY = "android.contacts.DISPLAY_ORDER"; |
| 53 | |
| 54 | /** |
| 55 | * The value for the SORT_ORDER key corresponding to sort by given name first. |
| 56 | */ |
| 57 | public static final int SORT_ORDER_PRIMARY = 1; |
| 58 | |
| 59 | public static final String SORT_ORDER_KEY = "android.contacts.SORT_ORDER"; |
| 60 | |
| 61 | /** |
| 62 | * The value for the SORT_ORDER key corresponding to sort by family name first. |
| 63 | */ |
| 64 | public static final int SORT_ORDER_ALTERNATIVE = 2; |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 65 | |
| 66 | public static final String PREF_DISPLAY_ONLY_PHONES = "only_phones"; |
Brandon Maxwell | e886217 | 2015-10-22 16:19:46 -0700 | [diff] [blame] | 67 | |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 68 | public static final boolean PREF_DISPLAY_ONLY_PHONES_DEFAULT = false; |
| 69 | |
Brandon Maxwell | e886217 | 2015-10-22 16:19:46 -0700 | [diff] [blame] | 70 | /** |
| 71 | * Value to use when a preference is unassigned and needs to be read from the shared preferences |
| 72 | */ |
| 73 | private static final int PREFERENCE_UNASSIGNED = -1; |
| 74 | |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 75 | private final Context mContext; |
Brandon Maxwell | e886217 | 2015-10-22 16:19:46 -0700 | [diff] [blame] | 76 | private int mSortOrder = PREFERENCE_UNASSIGNED; |
| 77 | private int mDisplayOrder = PREFERENCE_UNASSIGNED; |
Marcus Hagerott | fac695a | 2016-08-24 17:02:40 -0700 | [diff] [blame] | 78 | private AccountWithDataSet mDefaultAccount = null; |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 79 | private ChangeListener mListener = null; |
| 80 | private Handler mHandler; |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 81 | private final SharedPreferences mPreferences; |
Marcus Hagerott | 949d4e8 | 2016-09-20 13:23:05 -0700 | [diff] [blame] | 82 | private final boolean mIsDefaultAccountUserChangeable; |
Tingting Wang | 20c6ec5 | 2015-08-20 16:35:36 -0700 | [diff] [blame] | 83 | private String mDefaultAccountKey; |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 84 | |
| 85 | public ContactsPreferences(Context context) { |
Marcus Hagerott | 949d4e8 | 2016-09-20 13:23:05 -0700 | [diff] [blame] | 86 | this(context, |
| 87 | context.getResources().getBoolean(R.bool.config_default_account_user_changeable)); |
| 88 | } |
| 89 | |
| 90 | @VisibleForTesting |
| 91 | ContactsPreferences(Context context, boolean isDefaultAccountUserChangeable) { |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 92 | mContext = context; |
Marcus Hagerott | 949d4e8 | 2016-09-20 13:23:05 -0700 | [diff] [blame] | 93 | mIsDefaultAccountUserChangeable = isDefaultAccountUserChangeable; |
| 94 | |
| 95 | mHandler = new Handler(Looper.getMainLooper()); |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 96 | mPreferences = mContext.getSharedPreferences(context.getPackageName(), |
| 97 | Context.MODE_PRIVATE); |
Tingting Wang | 20c6ec5 | 2015-08-20 16:35:36 -0700 | [diff] [blame] | 98 | mDefaultAccountKey = mContext.getResources().getString( |
| 99 | R.string.contact_editor_default_account_key); |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 100 | maybeMigrateSystemSettings(); |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | public boolean isSortOrderUserChangeable() { |
| 104 | return mContext.getResources().getBoolean(R.bool.config_sort_order_user_changeable); |
| 105 | } |
| 106 | |
| 107 | public int getDefaultSortOrder() { |
| 108 | if (mContext.getResources().getBoolean(R.bool.config_default_sort_order_primary)) { |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 109 | return SORT_ORDER_PRIMARY; |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 110 | } else { |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 111 | return SORT_ORDER_ALTERNATIVE; |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 112 | } |
| 113 | } |
| 114 | |
| 115 | public int getSortOrder() { |
| 116 | if (!isSortOrderUserChangeable()) { |
| 117 | return getDefaultSortOrder(); |
| 118 | } |
Brandon Maxwell | e886217 | 2015-10-22 16:19:46 -0700 | [diff] [blame] | 119 | if (mSortOrder == PREFERENCE_UNASSIGNED) { |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 120 | mSortOrder = mPreferences.getInt(SORT_ORDER_KEY, getDefaultSortOrder()); |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 121 | } |
| 122 | return mSortOrder; |
| 123 | } |
| 124 | |
| 125 | public void setSortOrder(int sortOrder) { |
| 126 | mSortOrder = sortOrder; |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 127 | final Editor editor = mPreferences.edit(); |
| 128 | editor.putInt(SORT_ORDER_KEY, sortOrder); |
| 129 | editor.commit(); |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 130 | } |
| 131 | |
| 132 | public boolean isDisplayOrderUserChangeable() { |
| 133 | return mContext.getResources().getBoolean(R.bool.config_display_order_user_changeable); |
| 134 | } |
| 135 | |
| 136 | public int getDefaultDisplayOrder() { |
| 137 | if (mContext.getResources().getBoolean(R.bool.config_default_display_order_primary)) { |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 138 | return DISPLAY_ORDER_PRIMARY; |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 139 | } else { |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 140 | return DISPLAY_ORDER_ALTERNATIVE; |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 141 | } |
| 142 | } |
| 143 | |
| 144 | public int getDisplayOrder() { |
| 145 | if (!isDisplayOrderUserChangeable()) { |
| 146 | return getDefaultDisplayOrder(); |
| 147 | } |
Brandon Maxwell | e886217 | 2015-10-22 16:19:46 -0700 | [diff] [blame] | 148 | if (mDisplayOrder == PREFERENCE_UNASSIGNED) { |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 149 | mDisplayOrder = mPreferences.getInt(DISPLAY_ORDER_KEY, getDefaultDisplayOrder()); |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 150 | } |
| 151 | return mDisplayOrder; |
| 152 | } |
| 153 | |
| 154 | public void setDisplayOrder(int displayOrder) { |
| 155 | mDisplayOrder = displayOrder; |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 156 | final Editor editor = mPreferences.edit(); |
| 157 | editor.putInt(DISPLAY_ORDER_KEY, displayOrder); |
| 158 | editor.commit(); |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 159 | } |
| 160 | |
Tingting Wang | 20c6ec5 | 2015-08-20 16:35:36 -0700 | [diff] [blame] | 161 | public boolean isDefaultAccountUserChangeable() { |
Marcus Hagerott | 949d4e8 | 2016-09-20 13:23:05 -0700 | [diff] [blame] | 162 | return mIsDefaultAccountUserChangeable; |
Tingting Wang | 20c6ec5 | 2015-08-20 16:35:36 -0700 | [diff] [blame] | 163 | } |
| 164 | |
Marcus Hagerott | fac695a | 2016-08-24 17:02:40 -0700 | [diff] [blame] | 165 | public AccountWithDataSet getDefaultAccount() { |
Tingting Wang | 20c6ec5 | 2015-08-20 16:35:36 -0700 | [diff] [blame] | 166 | if (!isDefaultAccountUserChangeable()) { |
| 167 | return mDefaultAccount; |
| 168 | } |
Marcus Hagerott | fac695a | 2016-08-24 17:02:40 -0700 | [diff] [blame] | 169 | if (mDefaultAccount == null) { |
Brandon Maxwell | e886217 | 2015-10-22 16:19:46 -0700 | [diff] [blame] | 170 | final String accountString = mPreferences |
Marcus Hagerott | fac695a | 2016-08-24 17:02:40 -0700 | [diff] [blame] | 171 | .getString(mDefaultAccountKey, null); |
Tingting Wang | 20c6ec5 | 2015-08-20 16:35:36 -0700 | [diff] [blame] | 172 | if (!TextUtils.isEmpty(accountString)) { |
Marcus Hagerott | fac695a | 2016-08-24 17:02:40 -0700 | [diff] [blame] | 173 | mDefaultAccount = AccountWithDataSet.unstringify(accountString); |
Tingting Wang | 20c6ec5 | 2015-08-20 16:35:36 -0700 | [diff] [blame] | 174 | } |
| 175 | } |
| 176 | return mDefaultAccount; |
| 177 | } |
| 178 | |
Marcus Hagerott | 949d4e8 | 2016-09-20 13:23:05 -0700 | [diff] [blame] | 179 | public void clearDefaultAccount() { |
| 180 | mDefaultAccount = null; |
| 181 | mPreferences.edit().remove(mDefaultAccountKey).commit(); |
| 182 | } |
| 183 | |
| 184 | public void setDefaultAccount(@NonNull AccountWithDataSet accountWithDataSet) { |
| 185 | if (accountWithDataSet == null) { |
| 186 | throw new IllegalArgumentException( |
| 187 | "argument should not be null"); |
Tingting Wang | 20c6ec5 | 2015-08-20 16:35:36 -0700 | [diff] [blame] | 188 | } |
Marcus Hagerott | 949d4e8 | 2016-09-20 13:23:05 -0700 | [diff] [blame] | 189 | mDefaultAccount = accountWithDataSet; |
| 190 | mPreferences.edit().putString(mDefaultAccountKey, accountWithDataSet.stringify()).commit(); |
| 191 | } |
| 192 | |
Marcus Hagerott | 819214d | 2016-09-29 14:58:27 -0700 | [diff] [blame] | 193 | public boolean isDefaultAccountSet() { |
| 194 | return mDefaultAccount != null || mPreferences.contains(mDefaultAccountKey); |
| 195 | } |
| 196 | |
Marcus Hagerott | 949d4e8 | 2016-09-20 13:23:05 -0700 | [diff] [blame] | 197 | /** |
| 198 | * @return false if there is only one writable account or no requirement to return true is met. |
| 199 | * true if the contact editor should show the "accounts changed" notification, that is: |
| 200 | * - If it's the first launch. |
| 201 | * - Or, if the default account has been removed. |
| 202 | * (And some extra sanity check) |
| 203 | * |
| 204 | * Note if this method returns {@code false}, the caller can safely assume that |
| 205 | * {@link #getDefaultAccount} will return a valid account. (Either an account which still |
| 206 | * exists, or {@code null} which should be interpreted as "local only".) |
| 207 | */ |
| 208 | public boolean shouldShowAccountChangedNotification(List<AccountWithDataSet> |
| 209 | currentWritableAccounts) { |
| 210 | final AccountWithDataSet defaultAccount = getDefaultAccount(); |
| 211 | |
| 212 | // This shouldn't occur anymore because a "device" account is added in the case that there |
| 213 | // are no other accounts but if there are no writable accounts then the default has been |
| 214 | // initialized if it is "device" |
| 215 | if (currentWritableAccounts.isEmpty()) { |
| 216 | return defaultAccount == null || !defaultAccount.isNullAccount(); |
| 217 | } |
| 218 | |
Gary Mai | 3107b25 | 2016-11-02 18:26:07 -0700 | [diff] [blame] | 219 | if (currentWritableAccounts.size() == 1 |
| 220 | && !currentWritableAccounts.get(0).isNullAccount()) { |
Marcus Hagerott | 949d4e8 | 2016-09-20 13:23:05 -0700 | [diff] [blame] | 221 | return false; |
| 222 | } |
| 223 | |
| 224 | if (defaultAccount == null) { |
| 225 | return true; |
| 226 | } |
| 227 | |
| 228 | if (!currentWritableAccounts.contains(defaultAccount)) { |
| 229 | return true; |
| 230 | } |
| 231 | |
| 232 | // All good. |
| 233 | return false; |
Tingting Wang | 20c6ec5 | 2015-08-20 16:35:36 -0700 | [diff] [blame] | 234 | } |
| 235 | |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 236 | public void registerChangeListener(ChangeListener listener) { |
| 237 | if (mListener != null) unregisterChangeListener(); |
| 238 | |
| 239 | mListener = listener; |
| 240 | |
| 241 | // Reset preferences to "unknown" because they may have changed while the |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 242 | // listener was unregistered. |
Brandon Maxwell | e886217 | 2015-10-22 16:19:46 -0700 | [diff] [blame] | 243 | mDisplayOrder = PREFERENCE_UNASSIGNED; |
| 244 | mSortOrder = PREFERENCE_UNASSIGNED; |
Tingting Wang | c939ae3 | 2015-09-01 16:45:08 -0700 | [diff] [blame] | 245 | mDefaultAccount = null; |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 246 | |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 247 | mPreferences.registerOnSharedPreferenceChangeListener(this); |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | public void unregisterChangeListener() { |
| 251 | if (mListener != null) { |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 252 | mListener = null; |
| 253 | } |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 254 | |
| 255 | mPreferences.unregisterOnSharedPreferenceChangeListener(this); |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 256 | } |
| 257 | |
| 258 | @Override |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 259 | public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, final String key) { |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 260 | // This notification is not sent on the Ui thread. Use the previously created Handler |
| 261 | // to switch to the Ui thread |
| 262 | mHandler.post(new Runnable() { |
| 263 | @Override |
| 264 | public void run() { |
Brandon Maxwell | e886217 | 2015-10-22 16:19:46 -0700 | [diff] [blame] | 265 | refreshValue(key); |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 266 | } |
| 267 | }); |
| 268 | } |
| 269 | |
Brandon Maxwell | e886217 | 2015-10-22 16:19:46 -0700 | [diff] [blame] | 270 | /** |
| 271 | * Forces the value for the given key to be looked up from shared preferences and notifies |
| 272 | * the registered {@link ChangeListener} |
| 273 | * |
| 274 | * @param key the {@link SharedPreferences} key to look up |
| 275 | */ |
| 276 | public void refreshValue(String key) { |
| 277 | if (DISPLAY_ORDER_KEY.equals(key)) { |
| 278 | mDisplayOrder = PREFERENCE_UNASSIGNED; |
| 279 | mDisplayOrder = getDisplayOrder(); |
| 280 | } else if (SORT_ORDER_KEY.equals(key)) { |
| 281 | mSortOrder = PREFERENCE_UNASSIGNED; |
| 282 | mSortOrder = getSortOrder(); |
| 283 | } else if (mDefaultAccountKey.equals(key)) { |
| 284 | mDefaultAccount = null; |
| 285 | mDefaultAccount = getDefaultAccount(); |
| 286 | } |
| 287 | if (mListener != null) mListener.onChange(); |
| 288 | } |
| 289 | |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 290 | public interface ChangeListener { |
| 291 | void onChange(); |
| 292 | } |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 293 | |
| 294 | /** |
| 295 | * If there are currently no preferences (which means this is the first time we are run), |
Tingting Wang | 1604c1e | 2015-10-28 15:51:32 -0700 | [diff] [blame] | 296 | * For sort order and display order, check to see if there are any preferences stored in |
| 297 | * system settings (pre-L) which can be copied into our own SharedPreferences. |
| 298 | * For default account setting, check to see if there are any preferences stored in the previous |
| 299 | * SharedPreferences which can be copied into current SharedPreferences. |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 300 | */ |
| 301 | private void maybeMigrateSystemSettings() { |
| 302 | if (!mPreferences.contains(SORT_ORDER_KEY)) { |
| 303 | int sortOrder = getDefaultSortOrder(); |
| 304 | try { |
| 305 | sortOrder = Settings.System.getInt(mContext.getContentResolver(), |
| 306 | SORT_ORDER_KEY); |
| 307 | } catch (SettingNotFoundException e) { |
| 308 | } |
| 309 | setSortOrder(sortOrder); |
| 310 | } |
| 311 | |
| 312 | if (!mPreferences.contains(DISPLAY_ORDER_KEY)) { |
| 313 | int displayOrder = getDefaultDisplayOrder(); |
| 314 | try { |
| 315 | displayOrder = Settings.System.getInt(mContext.getContentResolver(), |
| 316 | DISPLAY_ORDER_KEY); |
| 317 | } catch (SettingNotFoundException e) { |
| 318 | } |
| 319 | setDisplayOrder(displayOrder); |
| 320 | } |
Tingting Wang | 1604c1e | 2015-10-28 15:51:32 -0700 | [diff] [blame] | 321 | |
| 322 | if (!mPreferences.contains(mDefaultAccountKey)) { |
| 323 | final SharedPreferences previousPrefs = |
| 324 | PreferenceManager.getDefaultSharedPreferences(mContext); |
| 325 | final String defaultAccount = previousPrefs.getString(mDefaultAccountKey, null); |
| 326 | if (!TextUtils.isEmpty(defaultAccount)) { |
| 327 | final AccountWithDataSet accountWithDataSet = AccountWithDataSet.unstringify( |
| 328 | defaultAccount); |
| 329 | setDefaultAccount(accountWithDataSet); |
| 330 | } |
| 331 | } |
Yorke Lee | b3d841a | 2014-07-10 11:38:55 -0700 | [diff] [blame] | 332 | } |
Marcus Hagerott | 073a091 | 2016-09-28 17:05:54 -0700 | [diff] [blame] | 333 | |
Chiao Cheng | 89437e8 | 2012-11-01 13:41:51 -0700 | [diff] [blame] | 334 | } |