diff --git a/res/drawable-hdpi/ic_menu_delete_holo_dark.png b/res/drawable-hdpi/ic_menu_delete.png similarity index 100% rename from res/drawable-hdpi/ic_menu_delete_holo_dark.png rename to res/drawable-hdpi/ic_menu_delete.png diff --git a/res/drawable-mdpi/ic_menu_delete_holo_dark.png b/res/drawable-mdpi/ic_menu_delete.png similarity index 100% rename from res/drawable-mdpi/ic_menu_delete_holo_dark.png rename to res/drawable-mdpi/ic_menu_delete.png diff --git a/res/drawable-xhdpi/ic_menu_delete_holo_dark.png b/res/drawable-xhdpi/ic_menu_delete.png similarity index 100% rename from res/drawable-xhdpi/ic_menu_delete_holo_dark.png rename to res/drawable-xhdpi/ic_menu_delete.png diff --git a/res/drawable-xxhdpi/ic_menu_delete_holo_dark.png b/res/drawable-xxhdpi/ic_menu_delete.png similarity index 100% rename from res/drawable-xxhdpi/ic_menu_delete_holo_dark.png rename to res/drawable-xxhdpi/ic_menu_delete.png diff --git a/res/drawable-xxxhdpi/ic_menu_delete_holo_dark.png b/res/drawable-xxxhdpi/ic_menu_delete.png similarity index 100% rename from res/drawable-xxxhdpi/ic_menu_delete_holo_dark.png rename to res/drawable-xxxhdpi/ic_menu_delete.png diff --git a/res/layout/preference_home_app.xml b/res/layout/preference_home_app.xml index 841816171ef..0ee154e17b3 100644 --- a/res/layout/preference_home_app.xml +++ b/res/layout/preference_home_app.xml @@ -71,7 +71,7 @@ android:layout_height="fill_parent" android:paddingStart="12dip" android:paddingEnd="12dp" - android:src="@drawable/ic_menu_delete_holo_dark" + android:src="@drawable/ic_menu_delete" android:contentDescription="@string/home_app_uninstall_button" android:layout_gravity="center" android:clickable="true" diff --git a/res/layout/preference_user_delete_widget.xml b/res/layout/preference_user_delete_widget.xml index 7d563f8db6c..9c1ba728fec 100644 --- a/res/layout/preference_user_delete_widget.xml +++ b/res/layout/preference_user_delete_widget.xml @@ -50,7 +50,7 @@ android:layout_height="fill_parent" android:paddingStart="16dip" android:paddingEnd="16dip" - android:src="@drawable/ic_menu_delete_holo_dark" + android:src="@drawable/ic_menu_delete" android:contentDescription="@string/user_delete_user_description" android:layout_gravity="center" android:background="?android:attr/selectableItemBackground" /> diff --git a/res/layout/user_info_header.xml b/res/layout/user_info_header.xml index aeecc58eb9d..35cc466f777 100644 --- a/res/layout/user_info_header.xml +++ b/res/layout/user_info_header.xml @@ -80,13 +80,15 @@ android:maxLines="4" /> + android:src="@drawable/ic_menu_delete" + android:contentDescription="@string/user_delete_user_description" + android:layout_gravity="center" + android:background="?android:attr/selectableItemBackground" /> Restricted profile - Add new user + Add new user? - You can share this device with other people by creating additional users. Each user has their own space, which they can customize with their own apps, wallpaper, and so on. Users can also adjust tablet settings like Wi\u2011Fi that affect everyone.\n\nAfter you create a new user, that person needs to go through a setup process.\n\nAny user can accept updated app permissions on behalf of all other users. + You can share this device with other people by creating additional users. Each user has their own space, which they can customize with their own apps, wallpaper, and so on. Users can also adjust tablet settings like Wi\u2011Fi that affect everyone.\n\nWhen you add a new user, that person needs to set up their space.\n\nAny user can update apps for all other users. - After you create a new user, that person needs to go through a setup process.\n\nAny user can accept updated app permissions on behalf of all other users. + When you add a new user, that person needs to set up their space.\n\nAny user can update apps for all other users. Set up user now? @@ -5195,6 +5195,8 @@ Delete %1$s from this device + + Add users when device is locked New user @@ -5202,21 +5204,17 @@ Delete yourself? - Remove user? + Remove this user? - Remove profile? + Remove this profile? You will lose your space and data on this tablet. You can\'t undo this action. You will lose your space and data on this phone. You can\'t undo this action. - This user\'s space and data will disappear from this tablet. You can\'t undo this action. - - This user\'s space and data will disappear from this phone. You can\'t undo this action. + All apps and data will be deleted. - This profile\'s space and data will disappear from this tablet. You can\'t undo this action. - - This profile\'s space and data will disappear from this phone. You can\'t undo this action. + All apps and data will be deleted. Adding new user\u2026 @@ -5233,11 +5231,19 @@ Ending the guest session will remove local data. - Enable phone calls? + Allow phone calls - Enable phone calls and SMS? + Allow phone calls and SMS Remove user + + Allow phone calls? + + Call history will be shared with this user. + + Allow phone calls and SMS? + + Call and SMS history will be shared with this user. Allow apps and content @@ -5376,7 +5382,7 @@ Work SIM - Application and content restrictions + App & content access RENAME diff --git a/src/com/android/settings/ApnEditor.java b/src/com/android/settings/ApnEditor.java index 2da2d76f84f..738d4331d59 100644 --- a/src/com/android/settings/ApnEditor.java +++ b/src/com/android/settings/ApnEditor.java @@ -446,7 +446,7 @@ public class ApnEditor extends PreferenceActivity // If it's a new APN, then cancel will delete the new entry in onPause if (!mNewApn) { menu.add(0, MENU_DELETE, 0, R.string.menu_delete) - .setIcon(R.drawable.ic_menu_delete_holo_dark); + .setIcon(R.drawable.ic_menu_delete); } menu.add(0, MENU_SAVE, 0, R.string.menu_save) .setIcon(android.R.drawable.ic_menu_save); diff --git a/src/com/android/settings/accounts/AccountSyncSettings.java b/src/com/android/settings/accounts/AccountSyncSettings.java index fd35c2e49f1..f0896c963e0 100644 --- a/src/com/android/settings/accounts/AccountSyncSettings.java +++ b/src/com/android/settings/accounts/AccountSyncSettings.java @@ -242,7 +242,7 @@ public class AccountSyncSettings extends AccountPreferenceBase { if (!um.hasUserRestriction(UserManager.DISALLOW_MODIFY_ACCOUNTS, mUserHandle)) { MenuItem removeAccount = menu.add(0, MENU_REMOVE_ACCOUNT_ID, 0, getString(R.string.remove_account_label)) - .setIcon(R.drawable.ic_menu_delete_holo_dark); + .setIcon(R.drawable.ic_menu_delete); removeAccount.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); } diff --git a/src/com/android/settings/users/AppRestrictionsFragment.java b/src/com/android/settings/users/AppRestrictionsFragment.java index 9df8217b701..70b6ce96377 100644 --- a/src/com/android/settings/users/AppRestrictionsFragment.java +++ b/src/com/android/settings/users/AppRestrictionsFragment.java @@ -988,6 +988,7 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen + entry.getKey()); mAppList.addPreference(p); p.setOnPreferenceChangeListener(AppRestrictionsFragment.this); + p.setIcon(R.drawable.empty_icon); preference.mChildren.add(p); count++; } diff --git a/src/com/android/settings/users/EditUserInfoController.java b/src/com/android/settings/users/EditUserInfoController.java index 235eef3bcd4..d1352d0abed 100644 --- a/src/com/android/settings/users/EditUserInfoController.java +++ b/src/com/android/settings/users/EditUserInfoController.java @@ -38,7 +38,14 @@ import android.widget.ImageView; import com.android.settings.R; +/** + * This class encapsulates a Dialog for editing the user nickname and photo. + */ public class EditUserInfoController { + + private static final String KEY_AWAITING_RESULT = "awaiting_result"; + private static final String KEY_SAVED_PHOTO = "pending_photo"; + private Dialog mEditUserInfoDialog; private Bitmap mSavedPhoto; private EditUserPhotoController mEditUserPhotoController; @@ -48,7 +55,6 @@ public class EditUserInfoController { public interface OnContentChangedCallback { public void onPhotoChanged(Drawable photo); - public void onLabelChanged(CharSequence label); } @@ -62,17 +68,18 @@ public class EditUserInfoController { } public void onRestoreInstanceState(Bundle icicle) { - mSavedPhoto = (Bitmap) icicle.getParcelable(RestrictedProfileSettings.KEY_SAVED_PHOTO); + mSavedPhoto = (Bitmap) icicle.getParcelable(KEY_SAVED_PHOTO); + mWaitingForActivityResult = icicle.getBoolean(KEY_AWAITING_RESULT, false); } public void onSaveInstanceState(Bundle outState) { if (mEditUserInfoDialog != null && mEditUserInfoDialog.isShowing() && mEditUserPhotoController != null) { - outState.putParcelable(RestrictedProfileSettings.KEY_SAVED_PHOTO, + outState.putParcelable(KEY_SAVED_PHOTO, mEditUserPhotoController.getNewUserPhotoBitmap()); } if (mWaitingForActivityResult) { - outState.putBoolean(RestrictedProfileSettings.KEY_AWAITING_RESULT, + outState.putBoolean(KEY_AWAITING_RESULT, mWaitingForActivityResult); } } diff --git a/src/com/android/settings/users/RestrictedProfileSettings.java b/src/com/android/settings/users/RestrictedProfileSettings.java index 3915ef21bf1..8db911c8adc 100644 --- a/src/com/android/settings/users/RestrictedProfileSettings.java +++ b/src/com/android/settings/users/RestrictedProfileSettings.java @@ -17,6 +17,7 @@ package com.android.settings.users; import android.app.Dialog; +import android.content.DialogInterface; import android.content.Intent; import android.content.pm.UserInfo; import android.graphics.drawable.Drawable; @@ -28,24 +29,24 @@ import android.widget.ImageView; import android.widget.TextView; import com.android.settings.R; +import com.android.settings.Utils; import java.util.List; public class RestrictedProfileSettings extends AppRestrictionsFragment implements EditUserInfoController.OnContentChangedCallback { - static final String KEY_SAVED_PHOTO = "pending_photo"; - static final String KEY_AWAITING_RESULT = "awaiting_result"; - static final int DIALOG_ID_EDIT_USER_INFO = 1; public static final String FILE_PROVIDER_AUTHORITY = "com.android.settings.files"; + static final int DIALOG_ID_EDIT_USER_INFO = 1; + private static final int DIALOG_CONFIRM_REMOVE = 2; private View mHeaderView; private ImageView mUserIconView; private TextView mUserNameView; + private ImageView mDeleteButton; private EditUserInfoController mEditUserInfoController = new EditUserInfoController(); - private boolean mWaitingForActivityResult; @Override public void onCreate(Bundle icicle) { @@ -53,7 +54,6 @@ public class RestrictedProfileSettings extends AppRestrictionsFragment if (icicle != null) { mEditUserInfoController.onRestoreInstanceState(icicle); - mWaitingForActivityResult = icicle.getBoolean(KEY_AWAITING_RESULT, false); } init(icicle); @@ -68,6 +68,8 @@ public class RestrictedProfileSettings extends AppRestrictionsFragment mHeaderView.setOnClickListener(this); mUserIconView = (ImageView) mHeaderView.findViewById(android.R.id.icon); mUserNameView = (TextView) mHeaderView.findViewById(android.R.id.title); + mDeleteButton = (ImageView) mHeaderView.findViewById(R.id.delete); + mDeleteButton.setOnClickListener(this); getListView().setFastScrollEnabled(true); } // This is going to bind the preferences. @@ -122,6 +124,8 @@ public class RestrictedProfileSettings extends AppRestrictionsFragment public void onClick(View view) { if (view == mHeaderView) { showDialog(DIALOG_ID_EDIT_USER_INFO); + } else if (view == mDeleteButton) { + showDialog(DIALOG_CONFIRM_REMOVE); } else { super.onClick(view); // in AppRestrictionsFragment } @@ -133,11 +137,30 @@ public class RestrictedProfileSettings extends AppRestrictionsFragment return mEditUserInfoController.createDialog(this, mUserIconView.getDrawable(), mUserNameView.getText(), R.string.profile_info_settings_title, this, mUser); + } else if (dialogId == DIALOG_CONFIRM_REMOVE) { + Dialog dlg = + Utils.createRemoveConfirmationDialog(getActivity(), mUser.getIdentifier(), + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + removeUser(); + } + } + ); + return dlg; } return null; } + private void removeUser() { + getView().post(new Runnable() { + public void run() { + mUserManager.removeUser(mUser.getIdentifier()); + finishFragment(); + } + }); + } + @Override public void onPhotoChanged(Drawable photo) { mUserIconView.setImageDrawable(photo); diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java index e04791d607a..6f5a6698b90 100644 --- a/src/com/android/settings/users/UserSettings.java +++ b/src/com/android/settings/users/UserSettings.java @@ -50,6 +50,7 @@ import android.os.UserManager; import android.preference.Preference; import android.preference.Preference.OnPreferenceClickListener; import android.preference.PreferenceGroup; +import android.provider.Settings; import android.provider.Settings.Secure; import android.util.Log; import android.util.SparseArray; @@ -94,6 +95,7 @@ public class UserSettings extends SettingsPreferenceFragment private static final String KEY_ADD_USER = "user_add"; private static final int MENU_REMOVE_USER = Menu.FIRST; + private static final int MENU_ADD_ON_LOCKSCREEN = Menu.FIRST + 1; private static final int DIALOG_CONFIRM_REMOVE = 1; private static final int DIALOG_ADD_USER = 2; @@ -282,13 +284,21 @@ public class UserSettings extends SettingsPreferenceFragment @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + int pos = 0; UserManager um = (UserManager) getActivity().getSystemService(Context.USER_SERVICE); if (!mIsOwner && !um.hasUserRestriction(UserManager.DISALLOW_REMOVE_USER)) { String nickname = mUserManager.getUserName(); - MenuItem removeThisUser = menu.add(0, MENU_REMOVE_USER, 0, + MenuItem removeThisUser = menu.add(0, MENU_REMOVE_USER, pos++, getResources().getString(R.string.user_remove_user_menu, nickname)); removeThisUser.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } + if (mIsOwner && !um.hasUserRestriction(UserManager.DISALLOW_ADD_USER)) { + MenuItem allowAddOnLockscreen = menu.add(0, MENU_ADD_ON_LOCKSCREEN, pos++, + R.string.user_add_on_lockscreen_menu); + allowAddOnLockscreen.setCheckable(true); + allowAddOnLockscreen.setChecked(Settings.Global.getInt(getContentResolver(), + Settings.Global.ADD_USERS_WHEN_LOCKED, 0) == 1); + } super.onCreateOptionsMenu(menu, inflater); } @@ -298,6 +308,12 @@ public class UserSettings extends SettingsPreferenceFragment if (itemId == MENU_REMOVE_USER) { onRemoveUserClicked(UserHandle.myUserId()); return true; + } else if (itemId == MENU_ADD_ON_LOCKSCREEN) { + final boolean isChecked = item.isChecked(); + Settings.Global.putInt(getContentResolver(), Settings.Global.ADD_USERS_WHEN_LOCKED, + isChecked ? 0 : 1); + item.setChecked(!isChecked); + return true; } else { return super.onOptionsItemSelected(item); } @@ -780,6 +796,7 @@ public class UserSettings extends SettingsPreferenceFragment } } } + // Add a temporary entry for the user being created if (mAddingUser) { Preference pref = new UserPreference(getActivity(), null, UserPreference.USERID_UNKNOWN, @@ -793,7 +810,9 @@ public class UserSettings extends SettingsPreferenceFragment if (!mIsGuest) { // Add a virtual Guest user for guest defaults Preference pref = new UserPreference(getActivity(), null, - UserPreference.USERID_GUEST_DEFAULTS, mIsOwner ? this : null, null); + UserPreference.USERID_GUEST_DEFAULTS, + mIsOwner && voiceCapable? this : null /* settings icon handler */, + null /* delete icon handler */); pref.setTitle(R.string.user_guest); pref.setIcon(getEncircledGuestDrawable()); pref.setOnPreferenceClickListener(this); @@ -928,11 +947,6 @@ public class UserSettings extends SettingsPreferenceFragment return (user.flags & UserInfo.FLAG_INITIALIZED) != 0; } - private Drawable encircle(int iconResId) { - Bitmap icon = BitmapFactory.decodeResource(getResources(), iconResId); - return encircle(icon); - } - private Drawable encircle(Bitmap icon) { Drawable circled = CircleFramedDrawable.getInstance(getActivity(), icon); return circled;