Merge "Rename "Owner info" to "User info" for secondary users" into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
48af3cdbd9
@@ -666,6 +666,10 @@
|
||||
<string name="owner_info_settings_summary"></string>
|
||||
<!-- Hint text shown in owner info edit text [CHAR LIMIT=50] -->
|
||||
<string name="owner_info_settings_edit_text_hint">Type text to display on the lock screen</string>
|
||||
<!-- Text shown next to checkbox for showing user info on LockScreen [CHAR LIMIT=50]-->
|
||||
<string name="show_user_info_on_lockscreen_label">Show user info on lock screen</string>
|
||||
<!-- Text shown for title of user info setting [CHAR LIMIT=20]-->
|
||||
<string name="user_info_settings_title">User info</string>
|
||||
<!-- Main Settings screen setting option title for the item to take you to the location screen -->
|
||||
<string name="location_settings_title">Location access</string>
|
||||
<!-- Main Settings screen setting option title for the item to take you to the security screen -->
|
||||
|
@@ -19,6 +19,7 @@ package com.android.settings;
|
||||
import android.app.Fragment;
|
||||
import android.content.ContentResolver;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -51,6 +52,9 @@ public class OwnerInfoSettings extends Fragment {
|
||||
mEditText.setText(info);
|
||||
mEditText.setEnabled(enabled != 0);
|
||||
mCheckbox.setChecked(enabled != 0);
|
||||
if (UserHandle.myUserId() != UserHandle.USER_OWNER) {
|
||||
mCheckbox.setText(R.string.show_user_info_on_lockscreen_label);
|
||||
}
|
||||
mCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
Settings.Secure.putInt(res, Settings.Secure.LOCK_SCREEN_OWNER_INFO_ENABLED,
|
||||
|
@@ -57,6 +57,7 @@ import java.util.List;
|
||||
*/
|
||||
public class SecuritySettings extends SettingsPreferenceFragment
|
||||
implements OnPreferenceChangeListener, DialogInterface.OnClickListener {
|
||||
|
||||
static final String TAG = "SecuritySettings";
|
||||
|
||||
// Lock Settings
|
||||
@@ -73,6 +74,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
private static final String KEY_TACTILE_FEEDBACK_ENABLED = "unlock_tactile_feedback";
|
||||
private static final String KEY_SECURITY_CATEGORY = "security_category";
|
||||
private static final String KEY_LOCK_AFTER_TIMEOUT = "lock_after_timeout";
|
||||
private static final String KEY_OWNER_INFO_SETTINGS = "owner_info_settings";
|
||||
private static final String EXTRA_NO_WIDGET = "com.android.settings.NO_WIDGET";
|
||||
private static final String EXTRA_DEFAULT_WIDGET = "com.android.settings.DEFAULT_WIDGET";
|
||||
private static final int SET_OR_CHANGE_LOCK_METHOD_REQUEST = 123;
|
||||
@@ -169,6 +171,14 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
|
||||
mIsPrimary = UserHandle.myUserId() == UserHandle.USER_OWNER;
|
||||
|
||||
if (!mIsPrimary) {
|
||||
// Rename owner info settings
|
||||
Preference ownerInfoPref = findPreference(KEY_OWNER_INFO_SETTINGS);
|
||||
if (ownerInfoPref != null) {
|
||||
ownerInfoPref.setTitle(R.string.user_info_settings_title);
|
||||
}
|
||||
}
|
||||
|
||||
if (mIsPrimary) {
|
||||
switch (dpm.getStorageEncryptionStatus()) {
|
||||
case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE:
|
||||
|
@@ -723,6 +723,9 @@ public class Settings extends PreferenceActivity
|
||||
int titleRes = pref.getTitleRes();
|
||||
if (pref.getFragment().equals(WallpaperTypeSettings.class.getName())) {
|
||||
titleRes = R.string.wallpaper_settings_fragment_title;
|
||||
} else if (pref.getFragment().equals(OwnerInfoSettings.class.getName())
|
||||
&& UserHandle.myUserId() != UserHandle.USER_OWNER) {
|
||||
titleRes = R.string.user_info_settings_title;
|
||||
}
|
||||
startPreferencePanel(pref.getFragment(), pref.getExtras(), titleRes, pref.getTitle(),
|
||||
null, 0);
|
||||
|
@@ -102,6 +102,8 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
private final Object mUserLock = new Object();
|
||||
private UserManager mUserManager;
|
||||
private SparseArray<Drawable> mUserIcons = new SparseArray<Drawable>();
|
||||
private boolean mIsOwner = UserHandle.myUserId() == UserHandle.USER_OWNER;
|
||||
|
||||
|
||||
private Handler mHandler = new Handler() {
|
||||
@Override
|
||||
@@ -135,14 +137,19 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
mUserManager = (UserManager) getActivity().getSystemService(Context.USER_SERVICE);
|
||||
addPreferencesFromResource(R.xml.user_settings);
|
||||
mUserListCategory = (PreferenceGroup) findPreference(KEY_USER_LIST);
|
||||
mMePreference = (Preference) findPreference(KEY_USER_ME);
|
||||
mMePreference.setOnPreferenceClickListener(this);
|
||||
if (UserHandle.myUserId() != UserHandle.USER_OWNER) {
|
||||
if (!mIsOwner) {
|
||||
mMePreference.setSummary(null);
|
||||
}
|
||||
Preference ownerInfo = findPreference("user_owner_info");
|
||||
if (ownerInfo != null && !mIsOwner) {
|
||||
ownerInfo.setTitle(R.string.user_info_settings_title);
|
||||
}
|
||||
mNicknamePreference = (SelectableEditTextPreference) findPreference(KEY_USER_NICKNAME);
|
||||
mNicknamePreference.setOnPreferenceChangeListener(this);
|
||||
mNicknamePreference.getEditText().setInputType(
|
||||
@@ -172,7 +179,7 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
if (UserHandle.myUserId() == UserHandle.USER_OWNER) {
|
||||
if (mIsOwner) {
|
||||
if (UserManager.getMaxSupportedUsers() > mUserManager.getUsers(false).size()) {
|
||||
MenuItem addUserItem = menu.add(0, MENU_ADD_USER, 0, R.string.user_add_user_menu);
|
||||
addUserItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM
|
||||
|
Reference in New Issue
Block a user