Three kinds of owner info - owner, user and profile

Bug: 8736733

Put the summary "Restricted profile" under the user name in app restrictions panel.
Bug: 8736734

Change-Id: I6b724bd10a9246eb57831bffb737a48c01e0c285
diff --git a/res/layout/user_info_header.xml b/res/layout/user_info_header.xml
index f2b0c59..506dd2e2 100644
--- a/res/layout/user_info_header.xml
+++ b/res/layout/user_info_header.xml
@@ -72,11 +72,11 @@
                 android:layout_below="@android:id/title"
                 android:layout_alignStart="@android:id/title"
                 android:paddingBottom="3dip"
-                android:visibility="gone"
                 android:textAppearance="?android:attr/textAppearanceSmall"
                 android:textSize="13sp"
                 android:textColor="?android:attr/textColorSecondary"
                 android:focusable="false"
+                android:text="@string/user_summary_restricted_profile"
                 android:maxLines="4" />
         </RelativeLayout>
     </LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1b46954..1466ca6 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -679,6 +679,10 @@
     <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>
+    <!-- Text shown next to checkbox for showing profile info on LockScreen [CHAR LIMIT=50]-->
+    <string name="show_profile_info_on_lockscreen_label">Show profile info on lock screen</string>
+    <!-- Text shown for title of profile info setting [CHAR LIMIT=20]-->
+    <string name="profile_info_settings_title">Profile 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 -->
diff --git a/src/com/android/settings/OwnerInfoSettings.java b/src/com/android/settings/OwnerInfoSettings.java
index 51d166c..2f7721b 100644
--- a/src/com/android/settings/OwnerInfoSettings.java
+++ b/src/com/android/settings/OwnerInfoSettings.java
@@ -81,7 +81,11 @@
         }
         mCheckbox.setChecked(enabled);
         if (UserHandle.myUserId() != UserHandle.USER_OWNER) {
-            mCheckbox.setText(R.string.show_user_info_on_lockscreen_label);
+            if (UserManager.get(getActivity()).isLinkedUser()) {
+                mCheckbox.setText(R.string.show_profile_info_on_lockscreen_label);
+            } else {
+                mCheckbox.setText(R.string.show_user_info_on_lockscreen_label);
+            }
         }
         mCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
             public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index a64d731..535d881 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -168,7 +168,11 @@
             // Rename owner info settings
             Preference ownerInfoPref = findPreference(KEY_OWNER_INFO_SETTINGS);
             if (ownerInfoPref != null) {
-                ownerInfoPref.setTitle(R.string.user_info_settings_title);
+                if (UserManager.get(getActivity()).isLinkedUser()) {
+                    ownerInfoPref.setTitle(R.string.profile_info_settings_title);
+                } else {
+                    ownerInfoPref.setTitle(R.string.user_info_settings_title);
+                }
             }
         }
 
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 4cc4e40..02769e1 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -763,7 +763,11 @@
             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;
+            if (UserManager.get(this).isLinkedUser()) {
+                titleRes = R.string.profile_info_settings_title;
+            } else {
+                titleRes = R.string.user_info_settings_title;
+            }
         }
         startPreferencePanel(pref.getFragment(), pref.getExtras(), titleRes, pref.getTitle(),
                 null, 0);
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index 962f7b8..04f7743 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -350,11 +350,15 @@
         } else if (info.id == UserHandle.myUserId()) {
             // Jump to owner info panel
             Bundle extras = new Bundle();
-            extras.putBoolean(OwnerInfoSettings.EXTRA_SHOW_NICKNAME, true);
+            if (!info.isRestricted()) {
+                extras.putBoolean(OwnerInfoSettings.EXTRA_SHOW_NICKNAME, true);
+            }
+            int titleResId = info.id == UserHandle.USER_OWNER ? R.string.owner_info_settings_title
+                    : (info.isRestricted() ? R.string.profile_info_settings_title
+                            : R.string.user_info_settings_title);
             ((PreferenceActivity) getActivity()).startPreferencePanel(
                     OwnerInfoSettings.class.getName(),
-                    extras, R.string.user_info_settings_title, null,
-                    null, 0);
+                    extras, titleResId, null, null, 0);
         }
     }