Correctly restrict UI for WifiSettings in Guest profile.
Makes sure the restricted user does not see Wifi Preferences or Saved Networks activity. Also fixes a bug where the progress bar is displayed starting the activity in Guest mode, and does not go away. LinkablePreference is changed to make sure titles can be multi-lined. Bug: 35317523 Bug: 35318292 Test: to be done in b/35324506 Change-Id: I4a07a2ab3a83c3adaf87226969fd6f16e41c9419
This commit is contained in:
@@ -55,11 +55,15 @@ public class LinkablePreference extends Preference {
|
|||||||
super.onBindViewHolder(view);
|
super.onBindViewHolder(view);
|
||||||
|
|
||||||
TextView textView = (TextView) view.findViewById(android.R.id.title);
|
TextView textView = (TextView) view.findViewById(android.R.id.title);
|
||||||
if (textView == null || mContentTitle == null || mClickListener == null) {
|
if (textView == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
textView.setSingleLine(false);
|
||||||
|
|
||||||
|
if (mContentTitle == null || mClickListener == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
textView.setSingleLine(false);
|
|
||||||
StringBuilder contentBuilder = new StringBuilder().append(mContentTitle);
|
StringBuilder contentBuilder = new StringBuilder().append(mContentTitle);
|
||||||
if (mContentDescription != null) {
|
if (mContentDescription != null) {
|
||||||
contentBuilder.append("\n\n");
|
contentBuilder.append("\n\n");
|
||||||
|
@@ -179,9 +179,11 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
|
if (!isUiRestricted()) {
|
||||||
mProgressHeader = (ProgressBar) setPinnedHeaderView(R.layout.wifi_progress_header);
|
mProgressHeader = (ProgressBar) setPinnedHeaderView(R.layout.wifi_progress_header);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
@@ -201,6 +203,10 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
mConfigureWifiSettingsPreference = findPreference(PREF_KEY_CONFIGURE_WIFI_SETTINGS);
|
mConfigureWifiSettingsPreference = findPreference(PREF_KEY_CONFIGURE_WIFI_SETTINGS);
|
||||||
mSavedNetworksPreference = findPreference(PREF_KEY_SAVED_NETWORKS);
|
mSavedNetworksPreference = findPreference(PREF_KEY_SAVED_NETWORKS);
|
||||||
|
|
||||||
|
if (isUiRestricted()) {
|
||||||
|
getPreferenceScreen().removePreference(mAdditionalSettingsPreferenceCategory);
|
||||||
|
}
|
||||||
|
|
||||||
Context prefContext = getPrefContext();
|
Context prefContext = getPrefContext();
|
||||||
mAddPreference = new Preference(prefContext);
|
mAddPreference = new Preference(prefContext);
|
||||||
mAddPreference.setIcon(R.drawable.ic_menu_add_inset);
|
mAddPreference.setIcon(R.drawable.ic_menu_add_inset);
|
||||||
@@ -818,11 +824,11 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
|
|
||||||
private void setOffMessage() {
|
private void setOffMessage() {
|
||||||
if (isUiRestricted()) {
|
if (isUiRestricted()) {
|
||||||
|
removeConnectedAccessPointPreference();
|
||||||
|
mAccessPointsPreferenceCategory.removeAll();
|
||||||
if (!isUiRestrictedByOnlyAdmin()) {
|
if (!isUiRestrictedByOnlyAdmin()) {
|
||||||
addMessagePreference(R.string.wifi_empty_list_user_restricted);
|
addMessagePreference(R.string.wifi_empty_list_user_restricted);
|
||||||
}
|
}
|
||||||
removeConnectedAccessPointPreference();
|
|
||||||
mAccessPointsPreferenceCategory.removeAll();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user