Loading res/values/config.xml +1 −0 Original line number Diff line number Diff line Loading @@ -79,4 +79,5 @@ <!-- Whether to hide dm apn for carrier --> <bool name="config_hide_dm_enabled">true</bool> <bool name="config_show_account_preference" translatable="false">false</bool> </resources> res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -6273,4 +6273,6 @@ <string name="cellular_to_wlan_hint_summary">Allow hint when choose manually or always ask in Cellular->WLAN</string> <string name="cellular_to_wlan_hint_toast">Cellular->WLAN connection may be affected</string> <string name="select_sim_card">Select SIM card</string> <string name="add_operator_account_label">iTelcel</string> </resources> src/com/android/settings/accounts/AccountSettings.java +43 −0 Original line number Diff line number Diff line Loading @@ -76,9 +76,19 @@ public class AccountSettings extends SettingsPreferenceFragment private static final String ADD_ACCOUNT_ACTION = "android.settings.ADD_ACCOUNT_SETTINGS"; private static final String TAG_CONFIRM_AUTO_SYNC_CHANGE = "confirmAutoSyncChange"; private static final String EMAIL_PACKAGE_NAME = "com.android.email"; private static final String EMAIL_WELCOME_CLASS_NAME = "com.android.email.activity.setup.AccountSetupFinal"; private static final String EXTRA_FLOW_MODE = "FLOW_MODE"; private static final String EXTRA_FLOW_ACCOUNT_TYPE = "FLOW_ACCOUNT_TYPE"; private static final String ACCOUNT_MANAGER_TYPE = "com.android.email.pop3"; private static final int ORDER_LAST = 1001; private static final int ORDER_NEXT_TO_LAST = 1000; private static final int FLOW_MODE_ACCOUNT_MANAGER = 1; private static final int ORDER_LAST_BUT_TWO = 999; private UserManager mUm; private SparseArray<ProfileData> mProfiles = new SparseArray<ProfileData>(); private ManagedProfileBroadcastReceiver mManagedProfileBroadcastReceiver Loading @@ -87,6 +97,8 @@ public class AccountSettings extends SettingsPreferenceFragment private String[] mAuthorities; private int mAuthoritiesCount = 0; private boolean mShowOperatorAccount = false; /** * Holds data related to the accounts belonging to one profile. */ Loading @@ -99,6 +111,10 @@ public class AccountSettings extends SettingsPreferenceFragment * The preference that displays the add account button. */ public Preference addAccountPreference; /** * The preference that displays the add operator account button. */ public Preference addOperatorAccountPreference; /** * The preference that displays the button to remove the managed profile */ Loading @@ -122,6 +138,8 @@ public class AccountSettings extends SettingsPreferenceFragment if (mAuthorities != null) { mAuthoritiesCount = mAuthorities.length; } mShowOperatorAccount = getResources() .getBoolean(R.bool.config_show_account_preference); setHasOptionsMenu(true); } Loading Loading @@ -201,6 +219,14 @@ public class AccountSettings extends SettingsPreferenceFragment startActivity(intent); return true; } if (preference == profileData.addOperatorAccountPreference) { Intent intent = new Intent(); intent.setClassName(EMAIL_PACKAGE_NAME, EMAIL_WELCOME_CLASS_NAME); intent.putExtra(EXTRA_FLOW_MODE,FLOW_MODE_ACCOUNT_MANAGER); intent.putExtra(EXTRA_FLOW_ACCOUNT_TYPE, ACCOUNT_MANAGER_TYPE); startActivity(intent); return true; } if (preference == profileData.removeWorkProfilePreference) { final int userId = profileData.userInfo.id; Utils.createRemoveConfirmationDialog(getActivity(), userId, Loading Loading @@ -273,6 +299,12 @@ public class AccountSettings extends SettingsPreferenceFragment userInfo.getUserHandle(), mUm, this); if (!mUm.hasUserRestriction(DISALLOW_MODIFY_ACCOUNTS, userInfo.getUserHandle())) { profileData.addAccountPreference = newAddAccountPreference(context); if(mShowOperatorAccount) { profileData.addOperatorAccountPreference = newAddOperatorAccountPreference(context); } else { profileData.addOperatorAccountPreference = null; } } } if (userInfo.isManagedProfile()) { Loading @@ -299,6 +331,14 @@ public class AccountSettings extends SettingsPreferenceFragment return preference; } private Preference newAddOperatorAccountPreference(Context context) { Preference preference = new Preference(context); preference.setTitle(R.string.add_operator_account_label); preference.setIcon(R.drawable.ic_menu_add_dark); preference.setOnPreferenceClickListener(this); preference.setOrder(ORDER_LAST_BUT_TWO); return preference; } private void cleanUpPreferences() { PreferenceScreen preferenceScreen = getPreferenceScreen(); if (preferenceScreen != null) { Loading Loading @@ -339,6 +379,9 @@ public class AccountSettings extends SettingsPreferenceFragment if (profileData.addAccountPreference != null) { profileData.preferenceGroup.addPreference(profileData.addAccountPreference); } if (profileData.addOperatorAccountPreference != null) { profileData.preferenceGroup.addPreference(profileData.addOperatorAccountPreference); } } else { // Put a label instead of the accounts list mProfileNotAvailablePreference.setEnabled(false); Loading Loading
res/values/config.xml +1 −0 Original line number Diff line number Diff line Loading @@ -79,4 +79,5 @@ <!-- Whether to hide dm apn for carrier --> <bool name="config_hide_dm_enabled">true</bool> <bool name="config_show_account_preference" translatable="false">false</bool> </resources>
res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -6273,4 +6273,6 @@ <string name="cellular_to_wlan_hint_summary">Allow hint when choose manually or always ask in Cellular->WLAN</string> <string name="cellular_to_wlan_hint_toast">Cellular->WLAN connection may be affected</string> <string name="select_sim_card">Select SIM card</string> <string name="add_operator_account_label">iTelcel</string> </resources>
src/com/android/settings/accounts/AccountSettings.java +43 −0 Original line number Diff line number Diff line Loading @@ -76,9 +76,19 @@ public class AccountSettings extends SettingsPreferenceFragment private static final String ADD_ACCOUNT_ACTION = "android.settings.ADD_ACCOUNT_SETTINGS"; private static final String TAG_CONFIRM_AUTO_SYNC_CHANGE = "confirmAutoSyncChange"; private static final String EMAIL_PACKAGE_NAME = "com.android.email"; private static final String EMAIL_WELCOME_CLASS_NAME = "com.android.email.activity.setup.AccountSetupFinal"; private static final String EXTRA_FLOW_MODE = "FLOW_MODE"; private static final String EXTRA_FLOW_ACCOUNT_TYPE = "FLOW_ACCOUNT_TYPE"; private static final String ACCOUNT_MANAGER_TYPE = "com.android.email.pop3"; private static final int ORDER_LAST = 1001; private static final int ORDER_NEXT_TO_LAST = 1000; private static final int FLOW_MODE_ACCOUNT_MANAGER = 1; private static final int ORDER_LAST_BUT_TWO = 999; private UserManager mUm; private SparseArray<ProfileData> mProfiles = new SparseArray<ProfileData>(); private ManagedProfileBroadcastReceiver mManagedProfileBroadcastReceiver Loading @@ -87,6 +97,8 @@ public class AccountSettings extends SettingsPreferenceFragment private String[] mAuthorities; private int mAuthoritiesCount = 0; private boolean mShowOperatorAccount = false; /** * Holds data related to the accounts belonging to one profile. */ Loading @@ -99,6 +111,10 @@ public class AccountSettings extends SettingsPreferenceFragment * The preference that displays the add account button. */ public Preference addAccountPreference; /** * The preference that displays the add operator account button. */ public Preference addOperatorAccountPreference; /** * The preference that displays the button to remove the managed profile */ Loading @@ -122,6 +138,8 @@ public class AccountSettings extends SettingsPreferenceFragment if (mAuthorities != null) { mAuthoritiesCount = mAuthorities.length; } mShowOperatorAccount = getResources() .getBoolean(R.bool.config_show_account_preference); setHasOptionsMenu(true); } Loading Loading @@ -201,6 +219,14 @@ public class AccountSettings extends SettingsPreferenceFragment startActivity(intent); return true; } if (preference == profileData.addOperatorAccountPreference) { Intent intent = new Intent(); intent.setClassName(EMAIL_PACKAGE_NAME, EMAIL_WELCOME_CLASS_NAME); intent.putExtra(EXTRA_FLOW_MODE,FLOW_MODE_ACCOUNT_MANAGER); intent.putExtra(EXTRA_FLOW_ACCOUNT_TYPE, ACCOUNT_MANAGER_TYPE); startActivity(intent); return true; } if (preference == profileData.removeWorkProfilePreference) { final int userId = profileData.userInfo.id; Utils.createRemoveConfirmationDialog(getActivity(), userId, Loading Loading @@ -273,6 +299,12 @@ public class AccountSettings extends SettingsPreferenceFragment userInfo.getUserHandle(), mUm, this); if (!mUm.hasUserRestriction(DISALLOW_MODIFY_ACCOUNTS, userInfo.getUserHandle())) { profileData.addAccountPreference = newAddAccountPreference(context); if(mShowOperatorAccount) { profileData.addOperatorAccountPreference = newAddOperatorAccountPreference(context); } else { profileData.addOperatorAccountPreference = null; } } } if (userInfo.isManagedProfile()) { Loading @@ -299,6 +331,14 @@ public class AccountSettings extends SettingsPreferenceFragment return preference; } private Preference newAddOperatorAccountPreference(Context context) { Preference preference = new Preference(context); preference.setTitle(R.string.add_operator_account_label); preference.setIcon(R.drawable.ic_menu_add_dark); preference.setOnPreferenceClickListener(this); preference.setOrder(ORDER_LAST_BUT_TWO); return preference; } private void cleanUpPreferences() { PreferenceScreen preferenceScreen = getPreferenceScreen(); if (preferenceScreen != null) { Loading Loading @@ -339,6 +379,9 @@ public class AccountSettings extends SettingsPreferenceFragment if (profileData.addAccountPreference != null) { profileData.preferenceGroup.addPreference(profileData.addAccountPreference); } if (profileData.addOperatorAccountPreference != null) { profileData.preferenceGroup.addPreference(profileData.addOperatorAccountPreference); } } else { // Put a label instead of the accounts list mProfileNotAvailablePreference.setEnabled(false); Loading