Show more settings and add restrictions/dialogs for secondary users
Bug: 7213029 crash in About>Status Bug: 7212495 hide System updates for second user Bug: 7212230 nickname editor should select the text Bug: 7160487 TTS settings Bug: 7129411 Settings needs visibility changes for secondary users Change-Id: Ia2d1229c08b392edfa6b671fce4a382410405b14
This commit is contained in:
@@ -590,6 +590,10 @@
|
||||
<string name="roaming_turn_it_on_button">Turn it on</string>
|
||||
<!-- mobile network settings screen, message in dialog box that appears when you select the "Data roaming" check box -->
|
||||
<string name="roaming_warning">When you allow data roaming, you may incur significant roaming charges!</string>
|
||||
<!-- mobile network settings screen, message in dialog box that appears when you select the "Data roaming" check box. This is for multiuser tablets [CHAR LIMIT=none] -->
|
||||
<string name="roaming_warning_multiuser" product="tablet">When you allow data roaming, you may incur significant roaming charges!\n\nThis setting affects all users on this tablet.</string>
|
||||
<!-- mobile network settings screen, message in dialog box that appears when you select the "Data roaming" check box. This is for multiuser phones [CHAR LIMIT=none] -->
|
||||
<string name="roaming_warning_multiuser" product="default">When you allow data roaming, you may incur significant roaming charges!\n\nThis setting affects all users on this phone.</string>
|
||||
<!-- mobile network settings screen, title of dialog box that appears when you select the "Data roaming" check box -->
|
||||
<string name="roaming_reenable_title">Allow data roaming?</string>
|
||||
<!-- mobile network settings screen, setting option name -->
|
||||
@@ -4074,6 +4078,10 @@
|
||||
<string name="data_usage_restrict_background_title">Restrict background data?</string>
|
||||
<!-- Body of dialog shown before user restricts background data usage. [CHAR LIMIT=NONE] -->
|
||||
<string name="data_usage_restrict_background">If you restrict background mobile data, some apps and services won\'t work unless you\'re connected to a Wi-Fi network.</string>
|
||||
<!-- Body of dialog shown before user restricts background data usage. This is for multiuser tablets. [CHAR LIMIT=NONE] -->
|
||||
<string name="data_usage_restrict_background_multiuser" product="tablet">If you restrict background mobile data, some apps and services won\'t work unless you\'re connected to a Wi-Fi network.\n\nThis setting affects all users on this tablet.</string>
|
||||
<!-- Body of dialog shown before user restricts background data usage. This is for multiuser phones. [CHAR LIMIT=NONE] -->
|
||||
<string name="data_usage_restrict_background_multiuser" product="default">If you restrict background mobile data, some apps and services won\'t work unless you\'re connected to a Wi-Fi network.\n\nThis setting affects all users on this phone.</string>
|
||||
|
||||
<!-- Label displaying current network data usage warning threshold. [CHAR LIMIT=18] -->
|
||||
<string name="data_usage_sweep_warning"><font size="21"><xliff:g id="number" example="128">^1</xliff:g></font> <font size="9"><xliff:g id="unit" example="KB">^2</xliff:g></font>\n<font size="12">warning</font></string>
|
||||
@@ -4279,6 +4287,15 @@
|
||||
<!-- Spoken content description for delete icon beside a user [CHAR LIMIT=none] -->
|
||||
<string name="user_delete_user_description">Delete user</string>
|
||||
|
||||
<!-- Warning message when changing a global setting for a tablet.[CHAR LIMIT=none] -->
|
||||
<string name="global_change_warning" product="tablet">This setting affects all users on this tablet.</string>
|
||||
<!-- Warning message when changing a global setting for a phone.[CHAR LIMIT=none] -->
|
||||
<string name="global_change_warning" product="default">This setting affects all users on this phone.</string>
|
||||
<!-- Warning message title for global locale change [CHAR LIMIT=40] -->
|
||||
<string name="global_locale_change_title">Change language</string>
|
||||
<!-- Warning message title for global font change [CHAR LIMIT=40] -->
|
||||
<string name="global_font_change_title">Change font size</string>
|
||||
|
||||
<!-- Label for are-notifications-enabled checkbox in app details [CHAR LIMIT=20] -->
|
||||
<string name="app_notifications_switch_label">Show notifications</string>
|
||||
|
||||
|
@@ -45,7 +45,7 @@
|
||||
android:title="@string/screensaver_settings_title"
|
||||
android:fragment="com.android.settings.DreamSettings" />
|
||||
|
||||
<ListPreference
|
||||
<com.android.settings.WarnedListPreference
|
||||
android:key="font_size"
|
||||
android:title="@string/title_font_size"
|
||||
android:summary="@string/summary_font_size"
|
||||
|
@@ -21,7 +21,7 @@
|
||||
<Preference
|
||||
android:key="user_me"
|
||||
android:summary="@string/user_owner" />
|
||||
<EditTextPreference
|
||||
<com.android.settings.SelectableEditTextPreference
|
||||
android:key="user_nickname"
|
||||
android:title="@string/user_nickname"
|
||||
android:icon="@drawable/empty_icon" />
|
||||
|
@@ -452,7 +452,6 @@ public class DataUsageSummary extends Fragment {
|
||||
mMenuDataRoaming = menu.findItem(R.id.data_usage_menu_roaming);
|
||||
mMenuDataRoaming.setVisible(hasReadyMobileRadio(context) && !appDetailMode);
|
||||
mMenuDataRoaming.setChecked(getDataRoaming());
|
||||
mMenuDataRoaming.setVisible(isOwner);
|
||||
|
||||
mMenuRestrictBackground = menu.findItem(R.id.data_usage_menu_restrict_background);
|
||||
mMenuRestrictBackground.setVisible(hasReadyMobileRadio(context) && !appDetailMode);
|
||||
@@ -485,7 +484,7 @@ public class DataUsageSummary extends Fragment {
|
||||
|
||||
final MenuItem metered = menu.findItem(R.id.data_usage_menu_metered);
|
||||
if (hasReadyMobileRadio(context) || hasWifiRadio(context)) {
|
||||
metered.setVisible(isOwner && !appDetailMode);
|
||||
metered.setVisible(!appDetailMode);
|
||||
} else {
|
||||
metered.setVisible(false);
|
||||
}
|
||||
@@ -1936,7 +1935,11 @@ public class DataUsageSummary extends Fragment {
|
||||
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(R.string.roaming_reenable_title);
|
||||
if (Utils.hasMultipleUsers(context)) {
|
||||
builder.setMessage(R.string.roaming_warning_multiuser);
|
||||
} else {
|
||||
builder.setMessage(R.string.roaming_warning);
|
||||
}
|
||||
|
||||
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
@@ -1972,7 +1975,11 @@ public class DataUsageSummary extends Fragment {
|
||||
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(R.string.data_usage_restrict_background_title);
|
||||
builder.setMessage(getString(R.string.data_usage_restrict_background));
|
||||
if (Utils.hasMultipleUsers(context)) {
|
||||
builder.setMessage(R.string.data_usage_restrict_background_multiuser);
|
||||
} else {
|
||||
builder.setMessage(R.string.data_usage_restrict_background);
|
||||
}
|
||||
|
||||
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
|
@@ -26,6 +26,7 @@ import android.os.Bundle;
|
||||
import android.os.SELinux;
|
||||
import android.os.SystemClock;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceGroup;
|
||||
import android.preference.PreferenceScreen;
|
||||
@@ -126,9 +127,14 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
|
||||
|
||||
// These are contained by the root preference screen
|
||||
parentPreference = getPreferenceScreen();
|
||||
if (UserHandle.myUserId() == UserHandle.USER_OWNER) {
|
||||
Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference,
|
||||
KEY_SYSTEM_UPDATE_SETTINGS,
|
||||
Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
|
||||
} else {
|
||||
// Remove for secondary users
|
||||
removePreference(KEY_SYSTEM_UPDATE_SETTINGS);
|
||||
}
|
||||
Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_CONTRIBUTORS,
|
||||
Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
|
||||
|
||||
|
@@ -19,6 +19,7 @@ package com.android.settings;
|
||||
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
|
||||
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.Dialog;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentResolver;
|
||||
@@ -35,9 +36,11 @@ import android.os.RemoteException;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.SettingNotFoundException;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.view.RotationPolicy;
|
||||
@@ -46,7 +49,7 @@ import com.android.settings.DreamSettings;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class DisplaySettings extends SettingsPreferenceFragment implements
|
||||
Preference.OnPreferenceChangeListener {
|
||||
Preference.OnPreferenceChangeListener, OnPreferenceClickListener {
|
||||
private static final String TAG = "DisplaySettings";
|
||||
|
||||
/** If there is no setting in the provider, use this. */
|
||||
@@ -59,10 +62,12 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
||||
private static final String KEY_SCREEN_SAVER = "screensaver";
|
||||
private static final String KEY_WIFI_DISPLAY = "wifi_display";
|
||||
|
||||
private static final int DLG_GLOBAL_CHANGE_WARNING = 1;
|
||||
|
||||
private DisplayManager mDisplayManager;
|
||||
|
||||
private CheckBoxPreference mAccelerometer;
|
||||
private ListPreference mFontSizePref;
|
||||
private WarnedListPreference mFontSizePref;
|
||||
private CheckBoxPreference mNotificationPulse;
|
||||
|
||||
private final Configuration mCurConfig = new Configuration();
|
||||
@@ -111,8 +116,9 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
||||
disableUnusableTimeouts(mScreenTimeoutPreference);
|
||||
updateTimeoutPreferenceDescription(currentTimeout);
|
||||
|
||||
mFontSizePref = (ListPreference) findPreference(KEY_FONT_SIZE);
|
||||
mFontSizePref = (WarnedListPreference) findPreference(KEY_FONT_SIZE);
|
||||
mFontSizePref.setOnPreferenceChangeListener(this);
|
||||
mFontSizePref.setOnPreferenceClickListener(this);
|
||||
mNotificationPulse = (CheckBoxPreference) findPreference(KEY_NOTIFICATION_PULSE);
|
||||
if (mNotificationPulse != null
|
||||
&& getResources().getBoolean(
|
||||
@@ -256,6 +262,20 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(int dialogId) {
|
||||
if (dialogId == DLG_GLOBAL_CHANGE_WARNING) {
|
||||
return Utils.buildGlobalChangeWarningDialog(getActivity(),
|
||||
R.string.global_font_change_title,
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
mFontSizePref.click();
|
||||
}
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void updateState() {
|
||||
updateAccelerometerRotationCheckbox();
|
||||
readFontSizePreference(mFontSizePref);
|
||||
@@ -345,4 +365,17 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
if (preference == mFontSizePref) {
|
||||
if (Utils.hasMultipleUsers(getActivity())) {
|
||||
showDialog(DLG_GLOBAL_CHANGE_WARNING);
|
||||
return true;
|
||||
} else {
|
||||
mFontSizePref.click();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -16,18 +16,87 @@
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.settings.SettingsPreferenceFragment.SettingsDialogFragment;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class LocalePicker extends com.android.internal.app.LocalePicker
|
||||
implements com.android.internal.app.LocalePicker.LocaleSelectionListener {
|
||||
implements com.android.internal.app.LocalePicker.LocaleSelectionListener,
|
||||
DialogCreatable {
|
||||
|
||||
private static final String TAG = "LocalePicker";
|
||||
|
||||
private SettingsDialogFragment mDialogFragment;
|
||||
private static final int DLG_SHOW_GLOBAL_WARNING = 1;
|
||||
private static final String SAVE_TARGET_LOCALE = "locale";
|
||||
|
||||
private Locale mTargetLocale;
|
||||
|
||||
public LocalePicker() {
|
||||
super();
|
||||
setLocaleSelectionListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocaleSelected(Locale locale) {
|
||||
getActivity().onBackPressed();
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (savedInstanceState != null && savedInstanceState.containsKey(SAVE_TARGET_LOCALE)) {
|
||||
mTargetLocale = new Locale(savedInstanceState.getString(SAVE_TARGET_LOCALE));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocaleSelected(final Locale locale) {
|
||||
if (Utils.hasMultipleUsers(getActivity())) {
|
||||
mTargetLocale = locale;
|
||||
showDialog(DLG_SHOW_GLOBAL_WARNING);
|
||||
} else {
|
||||
LocalePicker.updateLocale(locale);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
|
||||
if (mTargetLocale != null) {
|
||||
outState.putString(SAVE_TARGET_LOCALE, mTargetLocale.toString());
|
||||
}
|
||||
}
|
||||
|
||||
protected void showDialog(int dialogId) {
|
||||
if (mDialogFragment != null) {
|
||||
Log.e(TAG, "Old dialog fragment not null!");
|
||||
}
|
||||
mDialogFragment = new SettingsDialogFragment(this, dialogId);
|
||||
mDialogFragment.show(getActivity().getFragmentManager(), Integer.toString(dialogId));
|
||||
}
|
||||
|
||||
public Dialog onCreateDialog(int dialogId) {
|
||||
return Utils.buildGlobalChangeWarningDialog(getActivity(),
|
||||
R.string.global_locale_change_title,
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
getActivity().onBackPressed();
|
||||
LocalePicker.updateLocale(mTargetLocale);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
protected void removeDialog(int dialogId) {
|
||||
// mDialogFragment may not be visible yet in parent fragment's onResume().
|
||||
// To be able to dismiss dialog at that time, don't check
|
||||
// mDialogFragment.isVisible().
|
||||
if (mDialogFragment != null && mDialogFragment.getDialogId() == dialogId) {
|
||||
mDialogFragment.dismiss();
|
||||
}
|
||||
mDialogFragment = null;
|
||||
}
|
||||
}
|
||||
|
71
src/com/android/settings/SelectableEditTextPreference.java
Normal file
71
src/com/android/settings/SelectableEditTextPreference.java
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2012 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
public class SelectableEditTextPreference extends EditTextPreference {
|
||||
|
||||
private int mSelectionMode;
|
||||
|
||||
public static final int SELECTION_CURSOR_END = 0;
|
||||
public static final int SELECTION_CURSOR_START = 1;
|
||||
public static final int SELECTION_SELECT_ALL = 2;
|
||||
|
||||
public SelectableEditTextPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selection mode for the text when it shows up in the dialog
|
||||
* @hide
|
||||
* @param selectionMode can be SELECTION_CURSOR_START, SELECTION_CURSOR_END or
|
||||
* SELECTION_SELECT_ALL. Default is SELECTION_CURSOR_END
|
||||
*/
|
||||
public void setInitialSelectionMode(int selectionMode) {
|
||||
mSelectionMode = selectionMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindDialogView(View view) {
|
||||
super.onBindDialogView(view);
|
||||
|
||||
EditText editText = getEditText();
|
||||
// Set the selection based on the mSelectionMode
|
||||
int length = editText.getText() != null ? editText.getText().length() : 0;
|
||||
if (!TextUtils.isEmpty(editText.getText())) {
|
||||
switch (mSelectionMode) {
|
||||
case SELECTION_CURSOR_END:
|
||||
editText.setSelection(length);
|
||||
break;
|
||||
case SELECTION_CURSOR_START:
|
||||
editText.setSelection(0);
|
||||
break;
|
||||
case SELECTION_SELECT_ALL:
|
||||
editText.setSelection(0, length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -100,6 +100,7 @@ public class Settings extends PreferenceActivity
|
||||
R.id.wifi_settings,
|
||||
R.id.bluetooth_settings,
|
||||
R.id.data_usage_settings,
|
||||
R.id.wireless_settings,
|
||||
R.id.device_section,
|
||||
R.id.sound_settings,
|
||||
R.id.display_settings,
|
||||
@@ -107,11 +108,14 @@ public class Settings extends PreferenceActivity
|
||||
R.id.application_settings,
|
||||
R.id.battery_settings,
|
||||
R.id.personal_section,
|
||||
R.id.location_settings,
|
||||
R.id.security_settings,
|
||||
R.id.language_settings,
|
||||
R.id.user_settings,
|
||||
R.id.account_settings,
|
||||
R.id.account_add,
|
||||
R.id.system_section,
|
||||
R.id.date_time_settings,
|
||||
R.id.about_settings,
|
||||
R.id.accessibility_settings
|
||||
};
|
||||
|
@@ -25,6 +25,7 @@ import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.text.TextUtils;
|
||||
@@ -66,6 +67,13 @@ public class SettingsPreferenceFragment extends PreferenceFragment implements Di
|
||||
}
|
||||
}
|
||||
|
||||
protected void removePreference(String key) {
|
||||
Preference pref = findPreference(key);
|
||||
if (pref != null) {
|
||||
getPreferenceScreen().removePreference(pref);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this if you want to show a help item in the menu, by returning the resource id.
|
||||
* @return the resource id for the help url
|
||||
|
@@ -16,8 +16,12 @@
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -500,4 +504,26 @@ public class Utils {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Not global warming, it's global change warning. */
|
||||
public static Dialog buildGlobalChangeWarningDialog(final Context context, int titleResId,
|
||||
final Runnable positiveAction) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(titleResId);
|
||||
builder.setMessage(R.string.global_change_warning);
|
||||
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
positiveAction.run();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(android.R.string.cancel, null);
|
||||
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
public static boolean hasMultipleUsers(Context context) {
|
||||
return ((UserManager) context.getSystemService(Context.USER_SERVICE))
|
||||
.getUsers().size() > 1;
|
||||
}
|
||||
}
|
||||
|
@@ -183,6 +183,8 @@ public class VoiceInputOutputSettings implements OnPreferenceChangeListener {
|
||||
|
||||
private void updateSettingsLink(String currentSetting) {
|
||||
ResolveInfo currentRecognizer = mAvailableRecognizersMap.get(currentSetting);
|
||||
if (currentRecognizer == null) return;
|
||||
|
||||
ServiceInfo si = currentRecognizer.serviceInfo;
|
||||
XmlResourceParser parser = null;
|
||||
String settingsActivity = null;
|
||||
|
37
src/com/android/settings/WarnedListPreference.java
Normal file
37
src/com/android/settings/WarnedListPreference.java
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2012 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.preference.ListPreference;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
public class WarnedListPreference extends ListPreference {
|
||||
public WarnedListPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onClick() {
|
||||
// Ignore this until an explicit call to click()
|
||||
}
|
||||
|
||||
public void click() {
|
||||
super.onClick();
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import android.net.wifi.p2p.WifiP2pManager;
|
||||
import android.nfc.NfcAdapter;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceScreen;
|
||||
@@ -96,6 +97,8 @@ public class WirelessSettings extends SettingsPreferenceFragment {
|
||||
|
||||
addPreferencesFromResource(R.xml.wireless_settings);
|
||||
|
||||
final boolean isSecondaryUser = UserHandle.myUserId() != UserHandle.USER_OWNER;
|
||||
|
||||
final Activity activity = getActivity();
|
||||
mAirplaneModePreference = (CheckBoxPreference) findPreference(KEY_TOGGLE_AIRPLANE);
|
||||
CheckBoxPreference nfc = (CheckBoxPreference) findPreference(KEY_TOGGLE_NFC);
|
||||
@@ -113,7 +116,7 @@ public class WirelessSettings extends SettingsPreferenceFragment {
|
||||
Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
|
||||
|
||||
//enable/disable wimax depending on the value in config.xml
|
||||
boolean isWimaxEnabled = this.getResources().getBoolean(
|
||||
boolean isWimaxEnabled = !isSecondaryUser && this.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_wimaxEnabled);
|
||||
if (!isWimaxEnabled) {
|
||||
PreferenceScreen root = getPreferenceScreen();
|
||||
@@ -130,6 +133,9 @@ public class WirelessSettings extends SettingsPreferenceFragment {
|
||||
if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIFI)) {
|
||||
findPreference(KEY_VPN_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
|
||||
}
|
||||
if (isSecondaryUser) { // Disable VPN
|
||||
removePreference(KEY_VPN_SETTINGS);
|
||||
}
|
||||
|
||||
// Manually set dependencies for Bluetooth when not toggleable.
|
||||
if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_BLUETOOTH)) {
|
||||
@@ -151,8 +157,8 @@ public class WirelessSettings extends SettingsPreferenceFragment {
|
||||
}
|
||||
|
||||
// Remove Mobile Network Settings if it's a wifi-only device.
|
||||
if (Utils.isWifiOnly(getActivity())) {
|
||||
getPreferenceScreen().removePreference(findPreference(KEY_MOBILE_NETWORK_SETTINGS));
|
||||
if (isSecondaryUser || Utils.isWifiOnly(getActivity())) {
|
||||
removePreference(KEY_MOBILE_NETWORK_SETTINGS);
|
||||
}
|
||||
|
||||
// Enable Proxy selector settings if allowed.
|
||||
@@ -166,7 +172,7 @@ public class WirelessSettings extends SettingsPreferenceFragment {
|
||||
// Disable Tethering if it's not allowed or if it's a wifi-only device
|
||||
ConnectivityManager cm =
|
||||
(ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
if (!cm.isTetheringSupported()) {
|
||||
if (isSecondaryUser || !cm.isTetheringSupported()) {
|
||||
getPreferenceScreen().removePreference(findPreference(KEY_TETHER_SETTINGS));
|
||||
} else {
|
||||
Preference p = findPreference(KEY_TETHER_SETTINGS);
|
||||
@@ -187,7 +193,7 @@ public class WirelessSettings extends SettingsPreferenceFragment {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
isCellBroadcastAppLinkEnabled = false; // CMAS app not installed
|
||||
}
|
||||
if (!isCellBroadcastAppLinkEnabled) {
|
||||
if (isSecondaryUser || !isCellBroadcastAppLinkEnabled) {
|
||||
PreferenceScreen root = getPreferenceScreen();
|
||||
Preference ps = findPreference(KEY_CELL_BROADCAST_SETTINGS);
|
||||
if (ps != null) root.removePreference(ps);
|
||||
|
@@ -33,6 +33,7 @@ import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceScreen;
|
||||
@@ -190,13 +191,14 @@ public class Status extends PreferenceActivity {
|
||||
|
||||
mRes = getResources();
|
||||
sUnknown = mRes.getString(R.string.device_info_default);
|
||||
|
||||
if (UserHandle.myUserId() == UserHandle.USER_OWNER) {
|
||||
mPhone = PhoneFactory.getDefaultPhone();
|
||||
}
|
||||
// Note - missing in zaku build, be careful later...
|
||||
mSignalStrength = findPreference(KEY_SIGNAL_STRENGTH);
|
||||
mUptime = findPreference("up_time");
|
||||
|
||||
if (Utils.isWifiOnly(getApplicationContext())) {
|
||||
if (mPhone == null || Utils.isWifiOnly(getApplicationContext())) {
|
||||
for (String key : PHONE_RELATED_ENTRIES) {
|
||||
removePreferenceFromScreen(key);
|
||||
}
|
||||
@@ -267,7 +269,7 @@ public class Status extends PreferenceActivity {
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (!Utils.isWifiOnly(getApplicationContext())) {
|
||||
if (mPhone != null && !Utils.isWifiOnly(getApplicationContext())) {
|
||||
mPhoneStateReceiver.registerIntent();
|
||||
|
||||
updateSignalStrength();
|
||||
@@ -285,7 +287,7 @@ public class Status extends PreferenceActivity {
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
if (!Utils.isWifiOnly(getApplicationContext())) {
|
||||
if (mPhone != null && !Utils.isWifiOnly(getApplicationContext())) {
|
||||
mPhoneStateReceiver.unregisterIntent();
|
||||
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
|
||||
}
|
||||
|
@@ -25,29 +25,22 @@ import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.database.ContentObserver;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Bitmap.CompressFormat;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.os.RemoteException;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.PreferenceGroup;
|
||||
import android.provider.ContactsContract;
|
||||
import android.provider.ContactsContract.Contacts;
|
||||
import android.provider.ContactsContract.Profile;
|
||||
import android.provider.ContactsContract.CommonDataKinds.Phone;
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
@@ -57,16 +50,13 @@ import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Toast;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.android.internal.telephony.MccTable;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SelectableEditTextPreference;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.Utils;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -99,14 +89,9 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
R.drawable.ic_user_yellow
|
||||
};
|
||||
|
||||
private static final String[] CONTACT_PROJECTION = new String[] {
|
||||
Phone._ID, // 0
|
||||
Phone.DISPLAY_NAME, // 1
|
||||
};
|
||||
|
||||
private PreferenceGroup mUserListCategory;
|
||||
private Preference mMePreference;
|
||||
private EditTextPreference mNicknamePreference;
|
||||
private SelectableEditTextPreference mNicknamePreference;
|
||||
private int mRemovingUserId = -1;
|
||||
private int mAddedUserId = 0;
|
||||
private boolean mAddingUser;
|
||||
@@ -156,10 +141,12 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
if (UserHandle.myUserId() != UserHandle.USER_OWNER) {
|
||||
mMePreference.setSummary(null);
|
||||
}
|
||||
mNicknamePreference = (EditTextPreference) findPreference(KEY_USER_NICKNAME);
|
||||
mNicknamePreference = (SelectableEditTextPreference) findPreference(KEY_USER_NICKNAME);
|
||||
mNicknamePreference.setOnPreferenceChangeListener(this);
|
||||
mNicknamePreference.getEditText().setInputType(
|
||||
InputType.TYPE_TEXT_VARIATION_NORMAL | InputType.TYPE_TEXT_FLAG_CAP_WORDS);
|
||||
mNicknamePreference.setInitialSelectionMode(
|
||||
SelectableEditTextPreference.SELECTION_SELECT_ALL);
|
||||
loadProfile();
|
||||
setHasOptionsMenu(true);
|
||||
IntentFilter filter = new IntentFilter(Intent.ACTION_USER_REMOVED);
|
||||
@@ -385,7 +372,7 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
continue;
|
||||
} else if (user.id == UserHandle.myUserId()) {
|
||||
pref = mMePreference;
|
||||
mNicknamePreference.setText(user.name);
|
||||
mNicknamePreference.getEditText().setText(user.name);
|
||||
mNicknamePreference.setSummary(user.name);
|
||||
} else {
|
||||
pref = new UserPreference(getActivity(), null, user.id,
|
||||
|
Reference in New Issue
Block a user