Merge "VPN: UI for forgetting disconnected VPNs" into mnc-dev
diff --git a/res/layout/manage_assist_footer.xml b/res/layout/manage_assist_footer.xml
new file mode 100644
index 0000000..8e10d62
--- /dev/null
+++ b/res/layout/manage_assist_footer.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ Copyright (C) 2015 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
+ -->
+<TextView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@android:style/TextAppearance.Material.Body1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="?android:attr/textColorSecondary"
+ android:paddingTop="16dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ android:paddingBottom="16dp"
+ android:selectable="false"
+ android:clickable="false"
+ android:text="@string/assist_footer">
+</TextView>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6e8fba4..feb10a7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -761,7 +761,7 @@
<string name="security_settings_fingerprint_enroll_onboard_message">To use your fingerprint to unlock your screen or confirm purchases, you\u2019ll need to:</string>
<!-- Introduction message shown in fingerprint enrollment dialog, first item to describe what
the user needs to do. -->
- <string name="security_settings_fingerprint_enroll_onboard_message_1">Setup your backup screen lock method</string>
+ <string name="security_settings_fingerprint_enroll_onboard_message_1">Set up your backup screen lock method</string>
<!-- Introduction message shown in fingerprint enrollment dialog, second item to describe what
the user needs to do. -->
<string name="security_settings_fingerprint_enroll_onboard_message_2">Add your fingerprint</string>
@@ -791,7 +791,7 @@
<!-- Message shown in fingerprint enrollment dialog once enrollment is completed -->
<string name="security_settings_fingerprint_enroll_finish_message">Whenever you see this icon, you can use your fingerprint for identification or to authorize a purchase.</string>
<!-- Button text to setup screen lock in onboard dialog [CHAR LIMIT=34] -->
- <string name="security_settings_fingerprint_enroll_setup_screen_lock">Setup screen lock</string>
+ <string name="security_settings_fingerprint_enroll_setup_screen_lock">Set up screen lock</string>
<!-- Button text to exit fingerprint wizard after everything is done [CHAR LIMIT=15] -->
<string name="security_settings_fingerprint_enroll_done">Done</string>
<!-- Dialog title for dialog which shows when user touches the icon on the screen, instead of the sensor at the back [CHAR LIMIT=45] -->
@@ -1552,7 +1552,7 @@
<!-- Label for the check box to show password -->
<string name="wifi_show_password">Show password</string>
<!-- Label for the RadioGroup to choose wifi ap band -->
- <string name="wifi_ap_band_config">Config AP Band</string>
+ <string name="wifi_ap_band_config">Select AP Band</string>
<!-- Label for the radio button to choose wifi ap 2.4 GHz band -->
<string name="wifi_ap_choose_2G">2.4 GHz Band</string>
<!-- Label for the radio button to choose wifi ap 5GHz band -->
@@ -4593,7 +4593,10 @@
<string name="backup_erase_dialog_title"></string>
<!-- Dialog title for confirmation to erase backup data from server -->
<string name="backup_erase_dialog_message">Stop backing up your Wi\u2011Fi passwords, bookmarks, other settings, and app data, plus erase all copies on Google servers?</string>
-
+ <!-- Dialog title for confirmation to erase full backup data from server -->
+ <string name="fullbackup_erase_dialog_message">Stop backing up device data (such as Wi-Fi passwords and call history) and app data (such as settings and files stored by apps), plus erase all copies on Google Drive?</string>
+ <!-- Summary for explanation of what full app data backup means. Manufacturers may wish to overlay this resource with their own text -->
+ <string name="fullbackup_data_summary">Automatically back up device data (such as Wi-Fi passwords and call history) and app data (such as settings and files stored by apps) remotely.\n\nWhen you turn on automatic backup, device and app data is periodically saved remotely. App data can be any data that an app has saved (based on developer settings), including potentially sensitive data such as contacts, messages, and photos.</string>
<!-- Device admin settings screen --><skip />
<!-- Device admin settings activity title -->
<string name="device_admin_settings_title">Device administration settings</string>
@@ -6507,6 +6510,12 @@
<!-- Title for Default Apps settings [CHAR LIMIT=30] -->
<string name="default_apps_title">Default Apps</string>
+ <!-- Title for Default Assist settings [CHAR LIMIT=30] -->
+ <string name="default_assist_title">Assist</string>
+
+ <!-- Summary for No Default Assist settings [CHAR LIMIT=45] -->
+ <string name="default_assist_none">No default Assist</string>
+
<!-- Title for Default Browser settings [CHAR LIMIT=30] -->
<string name="default_browser_title">Browser app</string>
@@ -6634,4 +6643,12 @@
<!-- Settings item summary for active app [CHAR LIMIT=100] -->
<string name="inactive_app_active_summary">Active. Touch to toggle.</string>
+ <!-- Title for the "context" preference to determine whether assist can access the data currently displayed on-screen [CHAR LIMIT=40] -->
+ <string name="assist_access_context_title">Use current context</string>
+
+ <!-- Summary for the "context" preference to determine whether assist can access the data currently displayed on-screen [CHAR LIMIT=NONE] -->
+ <string name="assist_access_context_summary">When you open the assist app, let it see what you\'ve been doing on your screen</string>
+
+ <!-- Footer text in the manage assist screen. [CHAR LIMIT=NONE] -->
+ <string name="assist_footer">Assist apps help you identify and act on useful information without having to ask. Some apps support both launcher and voice input services to give you integrated assistance.</string>
</resources>
diff --git a/res/xml/advanced_apps.xml b/res/xml/advanced_apps.xml
index 1bb9c58..1e2d516 100644
--- a/res/xml/advanced_apps.xml
+++ b/res/xml/advanced_apps.xml
@@ -36,7 +36,6 @@
<PreferenceScreen
android:key="manage_perms"
- android:fragment="com.android.settings.applications.ManagePermissions"
android:title="@string/app_permissions"
settings:keywords="@string/keywords_app_permissions" />
@@ -50,4 +49,8 @@
android:value="com.android.settings.Settings$HighPowerApplicationsActivity" />
</PreferenceScreen>
+ <PreferenceScreen
+ android:title="@string/memory_settings_title"
+ android:fragment="com.android.settings.applications.ProcessStatsUi" />
+
</PreferenceScreen>
diff --git a/res/xml/dashboard_categories.xml b/res/xml/dashboard_categories.xml
index cdc1166..14a4db6 100644
--- a/res/xml/dashboard_categories.xml
+++ b/res/xml/dashboard_categories.xml
@@ -134,13 +134,13 @@
android:icon="@drawable/ic_settings_multiuser"
/>
- <!-- Memory -->
+ <!-- Memory (hidden for now)
<dashboard-tile
android:id="@+id/manage_memory"
android:title="@string/memory_settings_title"
android:fragment="com.android.settings.applications.ProcessStatsUi"
android:icon="@drawable/ic_settings_memory"
- />
+ /> -->
<!-- Manage NFC payment apps -->
<dashboard-tile
diff --git a/res/xml/default_apps.xml b/res/xml/default_apps.xml
index 7fc32fd..ab65ac8 100644
--- a/res/xml/default_apps.xml
+++ b/res/xml/default_apps.xml
@@ -19,6 +19,12 @@
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:key="default_apps">
+ <Preference
+ android:key="default_assist"
+ android:fragment="com.android.settings.applications.ManageAssist"
+ android:title="@string/default_assist_title"
+ />
+
<com.android.settings.applications.DefaultBrowserPreference
android:key="default_browser"
android:title="@string/default_browser_title"
diff --git a/res/xml/manage_assist.xml b/res/xml/manage_assist.xml
new file mode 100644
index 0000000..00e86ad
--- /dev/null
+++ b/res/xml/manage_assist.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 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
+ -->
+
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:key="manage_assist">
+
+ <SwitchPreference
+ android:key="context"
+ android:title="@string/assist_access_context_title"
+ android:summary="@string/assist_access_context_summary"
+ android:persistent="false" />
+</PreferenceScreen>
diff --git a/res/xml/privacy_settings.xml b/res/xml/privacy_settings.xml
index 4607254..f9b4fbe 100644
--- a/res/xml/privacy_settings.xml
+++ b/res/xml/privacy_settings.xml
@@ -19,11 +19,11 @@
android:title="@string/privacy_settings_title">
<!-- Backup settings -->
- <SwitchPreference
+ <PreferenceScreen
android:key="backup_data"
android:title="@string/backup_data_title"
- android:summary="@string/backup_data_summary"
- android:persistent="false" />
+ android:persistent="false"
+ android:fragment="com.android.settings.backup.ToggleBackupSettingFragment"/>
<PreferenceScreen
android:key="configure_account"
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index dbbf6ba..1ef1dd9 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -190,7 +190,7 @@
private static String DEFAULT_LOG_RING_BUFFER_SIZE_IN_BYTES = "262144"; // 256K
- private static final int[] MOCK_LOCATOIN_APP_OPS = new int[] {AppOpsManager.OP_MOCK_LOCATION};
+ private static final int[] MOCK_LOCATION_APP_OPS = new int[] {AppOpsManager.OP_MOCK_LOCATION};
private static final String MULTI_WINDOW_SYSTEM_PROPERTY = "persist.sys.debug.multi_window";
private IWindowManager mWindowManager;
@@ -698,7 +698,7 @@
AppOpsManager appOpsManager = (AppOpsManager) getSystemService(Context.APP_OPS_SERVICE);
// Disable the app op of the previous mock location app if such.
- List<PackageOps> packageOps = appOpsManager.getPackagesForOps(MOCK_LOCATOIN_APP_OPS);
+ List<PackageOps> packageOps = appOpsManager.getPackagesForOps(MOCK_LOCATION_APP_OPS);
if (packageOps != null) {
// Should be one but in case we are in a bad state due to use of command line tools.
for (PackageOps packageOp : packageOps) {
@@ -764,7 +764,7 @@
private void updateMockLocation() {
AppOpsManager appOpsManager = (AppOpsManager) getSystemService(Context.APP_OPS_SERVICE);
- List<PackageOps> packageOps = appOpsManager.getPackagesForOps(MOCK_LOCATOIN_APP_OPS);
+ List<PackageOps> packageOps = appOpsManager.getPackagesForOps(MOCK_LOCATION_APP_OPS);
if (packageOps != null) {
for (PackageOps packageOp : packageOps) {
if (packageOp.getOps().get(0).getMode() == AppOpsManager.MODE_ALLOWED) {
diff --git a/src/com/android/settings/PrivacySettings.java b/src/com/android/settings/PrivacySettings.java
index 6eb22fb..7c911cb 100644
--- a/src/com/android/settings/PrivacySettings.java
+++ b/src/com/android/settings/PrivacySettings.java
@@ -16,12 +16,9 @@
package com.android.settings;
-import android.app.AlertDialog;
-import android.app.Dialog;
import android.app.backup.IBackupManager;
import android.content.ContentResolver;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Process;
@@ -49,8 +46,7 @@
/**
* Gesture lock pattern settings.
*/
-public class PrivacySettings extends SettingsPreferenceFragment implements
- DialogInterface.OnClickListener, Indexable {
+public class PrivacySettings extends SettingsPreferenceFragment implements Indexable {
// Vendor specific
private static final String GSETTINGS_PROVIDER = "com.google.settings";
@@ -61,15 +57,11 @@
private static final String FACTORY_RESET = "factory_reset";
private static final String TAG = "PrivacySettings";
private IBackupManager mBackupManager;
- private SwitchPreference mBackup;
+ private PreferenceScreen mBackup;
private SwitchPreference mAutoRestore;
- private Dialog mConfirmDialog;
private PreferenceScreen mConfigure;
private boolean mEnabled;
- private static final int DIALOG_ERASE_BACKUP = 2;
- private int mDialogType;
-
@Override
protected int getMetricsCategory() {
return MetricsLogger.PRIVACY;
@@ -89,8 +81,7 @@
mBackupManager = IBackupManager.Stub.asInterface(
ServiceManager.getService(Context.BACKUP_SERVICE));
- mBackup = (SwitchPreference) screen.findPreference(BACKUP_DATA);
- mBackup.setOnPreferenceChangeListener(preferenceChangeListener);
+ mBackup = (PreferenceScreen) screen.findPreference(BACKUP_DATA);
mAutoRestore = (SwitchPreference) screen.findPreference(AUTO_RESTORE);
mAutoRestore.setOnPreferenceChangeListener(preferenceChangeListener);
@@ -120,16 +111,6 @@
}
}
- @Override
- public void onStop() {
- if (mConfirmDialog != null && mConfirmDialog.isShowing()) {
- mConfirmDialog.dismiss();
- }
- mConfirmDialog = null;
- mDialogType = 0;
- super.onStop();
- }
-
private OnPreferenceChangeListener preferenceChangeListener = new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
@@ -138,16 +119,7 @@
}
boolean nextValue = (Boolean) newValue;
boolean result = false;
- if (preference == mBackup) {
- if (nextValue == false) {
- // Don't change Switch status until user makes choice in dialog
- // so return false here.
- showEraseBackupDialog();
- } else {
- setBackupEnabled(true);
- result = true;
- }
- } else if (preference == mAutoRestore) {
+ if (preference == mAutoRestore) {
try {
mBackupManager.setAutoRestore(nextValue);
result = true;
@@ -159,19 +131,9 @@
}
};
- private void showEraseBackupDialog() {
- mDialogType = DIALOG_ERASE_BACKUP;
- CharSequence msg = getResources().getText(R.string.backup_erase_dialog_message);
- // TODO: DialogFragment?
- mConfirmDialog = new AlertDialog.Builder(getActivity()).setMessage(msg)
- .setTitle(R.string.backup_erase_dialog_title)
- .setPositiveButton(android.R.string.ok, this)
- .setNegativeButton(android.R.string.cancel, this)
- .show();
- }
/*
- * Creates toggles for each available location provider
+ * Creates toggles for each backup/reset preference.
*/
private void updateToggles() {
ContentResolver res = getContentResolver();
@@ -184,11 +146,14 @@
String transport = mBackupManager.getCurrentTransport();
configIntent = mBackupManager.getConfigurationIntent(transport);
configSummary = mBackupManager.getDestinationString(transport);
+
+ mBackup.setSummary(backupEnabled
+ ? R.string.accessibility_feature_state_on
+ : R.string.accessibility_feature_state_off);
} catch (RemoteException e) {
// leave it 'false' and disable the UI; there's no backup manager
mBackup.setEnabled(false);
}
- mBackup.setChecked(backupEnabled);
mAutoRestore.setChecked(Settings.Secure.getInt(res,
Settings.Secure.BACKUP_AUTO_RESTORE, 1) == 1);
@@ -208,54 +173,6 @@
}
}
- private void updateConfigureSummary() {
- try {
- String transport = mBackupManager.getCurrentTransport();
- String summary = mBackupManager.getDestinationString(transport);
- setConfigureSummary(summary);
- } catch (RemoteException e) {
- // Not much we can do here
- }
- }
-
- @Override
- public void onClick(DialogInterface dialog, int which) {
- // Dialog is triggered before Switch status change, that means marking the Switch to
- // true in showEraseBackupDialog() method will be override by following status change.
- // So we do manual switching here due to users' response.
- if (mDialogType == DIALOG_ERASE_BACKUP) {
- // Accept turning off backup
- if (which == DialogInterface.BUTTON_POSITIVE) {
- setBackupEnabled(false);
- } else if (which == DialogInterface.BUTTON_NEGATIVE) {
- // Reject turning off backup
- setBackupEnabled(true);
- }
- updateConfigureSummary();
- }
- mDialogType = 0;
- }
-
- /**
- * Informs the BackupManager of a change in backup state - if backup is disabled,
- * the data on the server will be erased.
- * @param enable whether to enable backup
- */
- private void setBackupEnabled(boolean enable) {
- if (mBackupManager != null) {
- try {
- mBackupManager.setBackupEnabled(enable);
- } catch (RemoteException e) {
- mBackup.setChecked(!enable);
- mAutoRestore.setEnabled(!enable);
- return;
- }
- }
- mBackup.setChecked(enable);
- mAutoRestore.setEnabled(enable);
- mConfigure.setEnabled(enable);
- }
-
@Override
protected int getHelpResource() {
return R.string.help_url_backup_reset;
diff --git a/src/com/android/settings/applications/AdvancedAppSettings.java b/src/com/android/settings/applications/AdvancedAppSettings.java
index 268bc5b..0d2f206 100644
--- a/src/com/android/settings/applications/AdvancedAppSettings.java
+++ b/src/com/android/settings/applications/AdvancedAppSettings.java
@@ -15,11 +15,10 @@
*/
package com.android.settings.applications;
-import android.app.Activity;
+import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.os.Bundle;
import android.preference.Preference;
-import android.util.Log;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
@@ -27,36 +26,34 @@
import com.android.settings.applications.ApplicationsState.AppEntry;
import com.android.settings.applications.ApplicationsState.Session;
import com.android.settings.fuelgauge.PowerWhitelistBackend;
-import com.android.settingslib.applications.PermissionsInfo;
import java.util.ArrayList;
public class AdvancedAppSettings extends SettingsPreferenceFragment implements
- ApplicationsState.Callbacks, PermissionsInfo.Callback {
+ ApplicationsState.Callbacks {
static final String TAG = "AdvancedAppSettings";
- static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
private static final String KEY_APP_PERM = "manage_perms";
private static final String KEY_APP_DOMAIN_URLS = "domain_urls";
private static final String KEY_HIGH_POWER_APPS = "high_power_apps";
- private ApplicationsState mApplicationsState;
private Session mSession;
- private Preference mAppPermsPreference;
private Preference mAppDomainURLsPreference;
private Preference mHighPowerPreference;
- private PermissionsInfo mPermissionsInfo;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.advanced_apps);
- mApplicationsState = ApplicationsState.getInstance(getActivity().getApplication());
- mSession = mApplicationsState.newSession(this);
+ Preference permissions = getPreferenceScreen().findPreference(KEY_APP_PERM);
+ permissions.setIntent(new Intent(Intent.ACTION_MANAGE_PERMISSIONS));
- mAppPermsPreference = findPreference(KEY_APP_PERM);
+ ApplicationsState applicationsState = ApplicationsState.getInstance(
+ getActivity().getApplication());
+ mSession = applicationsState.newSession(this);
+
mAppDomainURLsPreference = findPreference(KEY_APP_DOMAIN_URLS);
mHighPowerPreference = findPreference(KEY_HIGH_POWER_APPS);
updateUI();
@@ -86,12 +83,6 @@
}
@Override
- public void onResume() {
- super.onResume();
- mPermissionsInfo = new PermissionsInfo(getActivity(), this);
- }
-
- @Override
public void onRunningStateChanged(boolean running) {
// No-op.
}
@@ -130,13 +121,4 @@
public void onLoadEntriesCompleted() {
// No-op.
}
-
- @Override
- public void onPermissionLoadComplete() {
- Activity activity = getActivity();
- if (activity == null) return;
-// mAppPermsPreference.setSummary(activity.getString(R.string.app_permissions_summary,
-// mPermissionsInfo.getRuntimePermAppsGrantedCount(),
-// mPermissionsInfo.getRuntimePermAppsCount()));
- }
}
diff --git a/src/com/android/settings/applications/AppInfoBase.java b/src/com/android/settings/applications/AppInfoBase.java
index 442b1d8..ef90fd9 100644
--- a/src/com/android/settings/applications/AppInfoBase.java
+++ b/src/com/android/settings/applications/AppInfoBase.java
@@ -69,9 +69,12 @@
// Dialog identifiers used in showDialog
protected static final int DLG_BASE = 0;
+ protected boolean mFinishing;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ mFinishing = false;
mState = ApplicationsState.getInstance(getActivity().getApplication());
mSession = mState.newSession(this);
@@ -147,6 +150,7 @@
intent.putExtra(ManageApplications.APP_CHG, appChanged);
SettingsActivity sa = (SettingsActivity)getActivity();
sa.finishPreferencePanel(this, Activity.RESULT_OK, intent);
+ mFinishing = true;
}
protected void showDialogInner(int id, int moveErrorCode) {
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index 5b510eb..4eb86a9 100755
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -244,14 +244,15 @@
@Override
public void onResume() {
super.onResume();
+ if (mFinishing) {
+ return;
+ }
AppItem app = new AppItem(mAppEntry.info.uid);
app.addUid(mAppEntry.info.uid);
getLoaderManager().restartLoader(LOADER_CHART_DATA,
ChartDataLoader.buildArgs(getTemplate(getContext()), app),
mDataCallbacks);
- if (mPackageInfo != null) {
- new BatteryUpdater().execute();
- }
+ new BatteryUpdater().execute();
}
@Override
@@ -269,6 +270,9 @@
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
+ if (mFinishing) {
+ return;
+ }
handleHeader();
mNotificationPreference = findPreference(KEY_NOTIFICATION);
@@ -284,12 +288,15 @@
mBatteryPreference.setOnPreferenceClickListener(this);
mLaunchPreference = findPreference(KEY_LAUNCH);
- if ((mAppEntry.info.flags&ApplicationInfo.FLAG_INSTALLED) == 0) {
- mLaunchPreference.setEnabled(false);
- } else if (!mAppEntry.info.enabled) {
- mLaunchPreference.setEnabled(false);
+ if (mAppEntry.info != null) {
+ if ((mAppEntry.info.flags&ApplicationInfo.FLAG_INSTALLED) == 0 ||
+ !mAppEntry.info.enabled) {
+ mLaunchPreference.setEnabled(false);
+ } else {
+ mLaunchPreference.setOnPreferenceClickListener(this);
+ }
} else {
- mLaunchPreference.setOnPreferenceClickListener(this);
+ mLaunchPreference.setEnabled(false);
}
}
diff --git a/src/com/android/settings/applications/ManageAssist.java b/src/com/android/settings/applications/ManageAssist.java
new file mode 100644
index 0000000..e222e1c
--- /dev/null
+++ b/src/com/android/settings/applications/ManageAssist.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2015 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.applications;
+
+import android.annotation.Nullable;
+import android.os.Bundle;
+import android.preference.Preference;
+import android.preference.SwitchPreference;
+import android.provider.Settings;
+import android.text.method.LinkMovementMethod;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.TextView;
+
+import com.android.internal.logging.MetricsLogger;
+import com.android.settings.InstrumentedFragment;
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
+
+/**
+ * Settings screen to manage everything about assist.
+ */
+public class ManageAssist extends SettingsPreferenceFragment
+ implements Preference.OnPreferenceChangeListener {
+
+ private static final String KEY_CONTEXT = "context";
+
+ private SwitchPreference mContextPref;
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ addPreferencesFromResource(R.xml.manage_assist);
+ mContextPref = (SwitchPreference) findPreference(KEY_CONTEXT);
+ mContextPref.setChecked(Settings.Secure.getInt(getContentResolver(),
+ Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1) != 0);
+ mContextPref.setOnPreferenceChangeListener(this);
+ }
+
+ @Override
+ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ TextView v = (TextView) LayoutInflater.from(view.getContext()).inflate(
+ R.layout.manage_assist_footer, null);
+ getListView().addFooterView(v);
+ }
+
+ @Override
+ protected int getMetricsCategory() {
+ return MetricsLogger.APPLICATIONS_MANAGE_ASSIST;
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ if (preference == mContextPref) {
+ Settings.Secure.putInt(getContentResolver(), Settings.Secure.ASSIST_STRUCTURE_ENABLED,
+ (boolean) newValue ? 1 : 0);
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/src/com/android/settings/applications/ManagePermissions.java b/src/com/android/settings/applications/ManagePermissions.java
deleted file mode 100644
index 35356e5..0000000
--- a/src/com/android/settings/applications/ManagePermissions.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2015 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.applications;
-
-import android.app.Activity;
-import android.app.FragmentTransaction;
-import android.content.ActivityNotFoundException;
-import android.content.Context;
-import android.content.Intent;
-import android.content.res.Resources;
-import android.content.res.Resources.Theme;
-import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceScreen;
-import android.util.Log;
-import android.view.View;
-
-import com.android.internal.logging.MetricsLogger;
-import com.android.settings.AppHeader;
-import com.android.settings.R;
-import com.android.settings.SettingsPreferenceFragment;
-import com.android.settingslib.applications.PermissionsInfo;
-import com.android.settingslib.applications.PermissionsInfo.PermissionGroup;
-
-import java.util.List;
-
-public class ManagePermissions extends SettingsPreferenceFragment
- implements PermissionsInfo.Callback {
-
- private static final String TAG = "ManagePermissions";
-
- private static final String OS_PKG = "android";
-
- private PermissionsInfo mPermissionsInfo;
-
- private PreferenceScreen mExtraScreen;
-
- @Override
- public void onResume() {
- super.onResume();
-
- mPermissionsInfo = new PermissionsInfo(getActivity(), this);
- }
-
- @Override
- public void onActivityCreated(Bundle savedInstanceState) {
- super.onActivityCreated(savedInstanceState);
-
- showLoadingWhenEmpty();
- }
-
- private void refreshUi() {
- Activity activity = getActivity();
- PreferenceScreen screen = getPreferenceScreen();
- if (screen == null) {
- screen = getPreferenceManager().createPreferenceScreen(activity);
- setPreferenceScreen(screen);
- } else {
- screen.removeAll();
- if (mExtraScreen != null) {
- mExtraScreen.removeAll();
- }
- }
- final int count = screen.getPreferenceCount();
- if (count == 0) {
- final Preference extraScreenPreference = new Preference(activity);
- extraScreenPreference.setIcon(R.drawable.ic_toc);
- extraScreenPreference.setTitle(R.string.additional_permissions);
- List<PermissionGroup> groups = mPermissionsInfo.getGroups();
- for (PermissionGroup group : groups) {
- if (group.possibleApps.size() == 0) continue;
- PermissionPreference pref = new PermissionPreference(activity, group);
- pref.refreshUi();
- if (group.packageName.equals(OS_PKG)) {
- screen.addPreference(pref);
- } else {
- if (mExtraScreen == null) {
- mExtraScreen = getPreferenceManager().createPreferenceScreen(activity);
- }
- mExtraScreen.addPreference(pref);
- }
- }
- if (mExtraScreen != null) {
- extraScreenPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference preference) {
- AdditionalPermissionsFragment frag = new AdditionalPermissionsFragment();
- frag.setTargetFragment(ManagePermissions.this, 0);
- FragmentTransaction ft = getFragmentManager().beginTransaction();
- ft.replace(R.id.main_content, frag);
- ft.addToBackStack("AdditionalPerms");
- ft.commit();
- return true;
- }
- });
- extraScreenPreference.setSummary(getString(R.string.additional_permissions_more,
- mExtraScreen.getPreferenceCount()));
- screen.addPreference(extraScreenPreference);
- }
- } else {
- updatePrefs(screen);
- if (mExtraScreen != null) {
- updatePrefs(mExtraScreen);
- }
- }
- }
-
- private void updatePrefs(PreferenceScreen screen) {
- for (int i = 0; i < screen.getPreferenceCount(); i++) {
- Preference pref = screen.getPreference(i);
- if (pref instanceof PermissionPreference) {
- ((PermissionPreference) pref).refreshUi();
- }
- }
- }
-
- @Override
- public void onPermissionLoadComplete() {
- refreshUi();
- }
-
- @Override
- protected int getMetricsCategory() {
- return MetricsLogger.MANAGE_PERMISSIONS;
- }
-
- private class PermissionPreference extends Preference implements OnPreferenceClickListener {
- private final PermissionGroup mGroup;
-
- public PermissionPreference(Context context, PermissionGroup group) {
- super(context);
- setOnPreferenceClickListener(this);
- mGroup = group;
- }
-
- public void refreshUi() {
- setTitle(mGroup.label);
- setIcon(mGroup.icon);
-// setSummary(getContext().getString(R.string.app_permissions_group_summary,
-// mGroup.grantedApps.size(), mGroup.possibleApps.size()));
- }
-
- @Override
- public boolean onPreferenceClick(Preference preference) {
- Intent i = new Intent(Intent.ACTION_MANAGE_PERMISSION_APPS)
- .putExtra(Intent.EXTRA_PERMISSION_NAME, mGroup.name);
- try {
- getActivity().startActivity(i);
- } catch (ActivityNotFoundException e) {
- Log.w(TAG, "No app to handle " + i.getAction());
- }
- return true;
- }
- }
-
- public static class AdditionalPermissionsFragment extends SettingsPreferenceFragment {
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- setPreferenceScreen(((ManagePermissions) getTargetFragment()).mExtraScreen);
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
- Resources resources = getResources();
- Theme theme = getActivity().getTheme();
- AppHeader.createAppHeader(this, resources.getDrawable(R.drawable.ic_toc, theme),
- getString(R.string.additional_permissions), null, android.R.color.white);
- }
-
- @Override
- protected int getMetricsCategory() {
- return MetricsLogger.MANAGE_PERMISSIONS;
- }
- }
-
-}
diff --git a/src/com/android/settings/backup/ToggleBackupSettingFragment.java b/src/com/android/settings/backup/ToggleBackupSettingFragment.java
new file mode 100644
index 0000000..e30266f
--- /dev/null
+++ b/src/com/android/settings/backup/ToggleBackupSettingFragment.java
@@ -0,0 +1,174 @@
+package com.android.settings.backup;
+
+import android.app.AlertDialog;
+import android.app.backup.IBackupManager;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.preference.Preference;
+import android.preference.PreferenceScreen;
+import android.util.Log;
+import android.view.View;
+import android.widget.TextView;
+
+import com.android.internal.logging.MetricsLogger;
+import com.android.settings.R;
+import com.android.settings.SettingsActivity;
+import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.widget.SwitchBar;
+import com.android.settings.widget.ToggleSwitch;
+
+/**
+ * Fragment to display a bunch of text about backup and restore, and allow the user to enable/
+ * disable it.
+ */
+public class ToggleBackupSettingFragment extends SettingsPreferenceFragment
+ implements DialogInterface.OnClickListener {
+ private static final String TAG = "ToggleBackupSettingFragment";
+
+ private static final String BACKUP_TOGGLE = "toggle_backup";
+
+ private IBackupManager mBackupManager;
+
+ protected SwitchBar mSwitchBar;
+ protected ToggleSwitch mToggleSwitch;
+
+ private Preference mSummaryPreference;
+
+ private Dialog mConfirmDialog;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ mBackupManager = IBackupManager.Stub.asInterface(
+ ServiceManager.getService(Context.BACKUP_SERVICE));
+
+ PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(
+ getActivity());
+ setPreferenceScreen(preferenceScreen);
+ mSummaryPreference = new Preference(getActivity()) {
+ @Override
+ protected void onBindView(View view) {
+ super.onBindView(view);
+ final TextView summaryView = (TextView) view.findViewById(android.R.id.summary);
+ summaryView.setText(getSummary());
+ }
+ };
+ mSummaryPreference.setPersistent(false);
+ mSummaryPreference.setLayoutResource(R.layout.text_description_preference);
+ preferenceScreen.addPreference(mSummaryPreference);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ SettingsActivity activity = (SettingsActivity) getActivity();
+ mSwitchBar = activity.getSwitchBar();
+ mToggleSwitch = mSwitchBar.getSwitch();
+
+ // Set up UI.
+ mSummaryPreference.setSummary(R.string.fullbackup_data_summary);
+ try {
+ boolean backupEnabled = mBackupManager == null ?
+ false : mBackupManager.isBackupEnabled();
+ mSwitchBar.setCheckedInternal(backupEnabled);
+ } catch (RemoteException e) {
+ // The world is aflame, turn it off.
+ mSwitchBar.setEnabled(false);
+ }
+ getActivity().setTitle(R.string.backup_data_title);
+ }
+
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
+
+ mToggleSwitch.setOnBeforeCheckedChangeListener(null);
+ mSwitchBar.hide();
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+
+ // Set up toggle listener. We need this b/c we have to intercept the toggle event in order
+ // to pop up the dialogue.
+ mToggleSwitch.setOnBeforeCheckedChangeListener(
+ new ToggleSwitch.OnBeforeCheckedChangeListener() {
+ @Override
+ public boolean onBeforeCheckedChanged(
+ ToggleSwitch toggleSwitch, boolean checked) {
+ if (!checked) {
+ // Don't change Switch status until user makes choice in dialog
+ // so return false here.
+ showEraseBackupDialog();
+ return false;
+ } else {
+ setBackupEnabled(true);
+ mSwitchBar.setCheckedInternal(true);
+ return true;
+ }
+ }
+ });
+ mSwitchBar.show();
+ }
+
+ /** Get rid of the dialog if it's still showing. */
+ @Override
+ public void onStop() {
+ if (mConfirmDialog != null && mConfirmDialog.isShowing()) {
+ mConfirmDialog.dismiss();
+ }
+ mConfirmDialog = null;
+ super.onStop();
+ }
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ // Accept turning off backup
+ if (which == DialogInterface.BUTTON_POSITIVE) {
+ setBackupEnabled(false);
+ mSwitchBar.setCheckedInternal(false);
+ } else if (which == DialogInterface.BUTTON_NEGATIVE) {
+ // Reject turning off backup
+ setBackupEnabled(true);
+ mSwitchBar.setCheckedInternal(true);
+ }
+ }
+
+ private void showEraseBackupDialog() {
+ CharSequence msg = getResources().getText(R.string.fullbackup_erase_dialog_message);
+ // TODO: DialogFragment?
+ mConfirmDialog = new AlertDialog.Builder(getActivity()).setMessage(msg)
+ .setTitle(R.string.backup_erase_dialog_title)
+ .setPositiveButton(android.R.string.ok, this)
+ .setNegativeButton(android.R.string.cancel, this)
+ .show();
+ }
+
+ @Override
+ protected int getMetricsCategory() {
+ return MetricsLogger.PRIVACY;
+ }
+
+ /**
+ * Informs the BackupManager of a change in backup state - if backup is disabled,
+ * the data on the server will be erased.
+ * @param enable whether to enable backup
+ */
+ private void setBackupEnabled(boolean enable) {
+ if (mBackupManager != null) {
+ try {
+ mBackupManager.setBackupEnabled(enable);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error communicating with BackupManager", e);
+ return;
+ }
+ }
+ }
+}
diff --git a/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java b/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
index 9ab714a..e2e6dbe 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
@@ -55,12 +55,23 @@
new PartitionTask().execute();
}
- public class PartitionTask extends AsyncTask<Void, Void, Exception> {
+ public class PartitionTask extends AsyncTask<Void, Integer, Exception> {
@Override
protected Exception doInBackground(Void... params) {
try {
if (mFormatPrivate) {
mStorage.partitionPrivate(mDisk.getId());
+ publishProgress(40);
+
+ final long internalBench = mStorage.benchmark(null);
+ publishProgress(60);
+
+ final VolumeInfo privateVol = findFirstVolume(VolumeInfo.TYPE_PRIVATE);
+ final long privateBench = mStorage.benchmark(privateVol.id);
+
+ // TODO: plumb through to user when below threshold
+ final float pct = (float) internalBench / (float) privateBench;
+ Log.d(TAG, "New volume is " + pct + "x the speed of internal");
} else {
mStorage.partitionPublic(mDisk.getId());
}
@@ -71,6 +82,11 @@
}
@Override
+ protected void onProgressUpdate(Integer... progress) {
+ setCurrentProgress(progress[0]);
+ }
+
+ @Override
protected void onPostExecute(Exception e) {
final Context context = StorageWizardFormatProgress.this;
if (e == null) {
diff --git a/src/com/android/settings/fingerprint/FingerprintSettings.java b/src/com/android/settings/fingerprint/FingerprintSettings.java
index 5a69147..56f3ff6 100644
--- a/src/com/android/settings/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/fingerprint/FingerprintSettings.java
@@ -259,9 +259,9 @@
protected void removeFingerprintPreference(int fingerprintId) {
String name = genKey(fingerprintId);
- Preference prefToRemove = mManageCategory.findPreference(name);
+ Preference prefToRemove = findPreference(name);
if (prefToRemove != null) {
- if (!mManageCategory.removePreference(prefToRemove)) {
+ if (!getPreferenceScreen().removePreference(prefToRemove)) {
Log.w(TAG, "Failed to remove preference with key " + name);
}
} else {
diff --git a/src/com/android/settings/location/LocationSettings.java b/src/com/android/settings/location/LocationSettings.java
index d0dde32..2628c7f 100644
--- a/src/com/android/settings/location/LocationSettings.java
+++ b/src/com/android/settings/location/LocationSettings.java
@@ -33,7 +33,6 @@
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Switch;
-
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
@@ -45,7 +44,29 @@
import java.util.List;
/**
- * Location access settings.
+ * System location settings (Settings > Location). The screen has three parts:
+ * <ul>
+ * <li>Platform location controls</li>
+ * <ul>
+ * <li>In switch bar: location master switch. Used to toggle
+ * {@link android.provider.Settings.Secure#LOCATION_MODE} between
+ * {@link android.provider.Settings.Secure#LOCATION_MODE_OFF} and another location mode.
+ * </li>
+ * <li>Mode preference: only available if the master switch is on, selects between
+ * {@link android.provider.Settings.Secure#LOCATION_MODE} of
+ * {@link android.provider.Settings.Secure#LOCATION_MODE_HIGH_ACCURACY},
+ * {@link android.provider.Settings.Secure#LOCATION_MODE_BATTERY_SAVING}, or
+ * {@link android.provider.Settings.Secure#LOCATION_MODE_SENSORS_ONLY}.</li>
+ * </ul>
+ * <li>Recent location requests: automatically populated by {@link RecentLocationApps}</li>
+ * <li>Location services: multi-app settings provided from outside the Android framework. Each
+ * is injected by a system-partition app via the {@link SettingInjectorService} API.</li>
+ * </ul>
+ * <p>
+ * Note that as of KitKat, the {@link SettingInjectorService} is the preferred method for OEMs to
+ * add their own settings to this page, rather than directly modifying the framework code. Among
+ * other things, this simplifies integration with future changes to the default (AOSP)
+ * implementation.
*/
public class LocationSettings extends LocationSettingsBase
implements SwitchBar.OnSwitchChangeListener {
diff --git a/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java b/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
index 1444ad5..2d200b5 100644
--- a/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
+++ b/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
@@ -147,7 +147,7 @@
mSelectedAccessPoint = mDlgAccessPoint;
// Hide forget button if config editing is locked down
- final boolean hideForgetButton = WifiSettings.isCreatorDeviceOwner(getActivity(),
+ final boolean hideForgetButton = WifiSettings.isEditabilityLockedDown(getActivity(),
mDlgAccessPoint.getConfig());
mDialog = new WifiDialog(getActivity(), this, mDlgAccessPoint,
false /* not editting */, true /* hide the submit button */,
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 0c28db3..97612a9 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -43,6 +43,7 @@
import android.os.Bundle;
import android.os.RemoteException;
import android.os.UserHandle;
+import android.os.UserManager;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import android.text.Spannable;
@@ -439,8 +440,8 @@
}
WifiConfiguration config = mSelectedAccessPoint.getConfig();
- // Device Owner created configs are uneditable
- if (isCreatorDeviceOwner(getActivity(), config)) {
+ // Some configs are ineditable
+ if (isEditabilityLockedDown(getActivity(), config)) {
return;
}
@@ -522,7 +523,7 @@
private void showDialog(AccessPoint accessPoint, boolean edit) {
if (accessPoint != null) {
WifiConfiguration config = accessPoint.getConfig();
- if (isCreatorDeviceOwner(getActivity(), config) && accessPoint.isActive()) {
+ if (isEditabilityLockedDown(getActivity(), config) && accessPoint.isActive()) {
final int userId = UserHandle.getUserId(config.creatorUid);
final PackageManager pm = getActivity().getPackageManager();
final IPackageManager ipm = AppGlobals.getPackageManager();
@@ -575,7 +576,7 @@
}
// If it's null, fine, it's for Add Network
mSelectedAccessPoint = ap;
- final boolean hideForget = (ap == null || isCreatorDeviceOwner(getActivity(),
+ final boolean hideForget = (ap == null || isEditabilityLockedDown(getActivity(),
ap.getConfig()));
mDialog = new WifiDialog(getActivity(), this, ap, mDlgEdit,
/* no hide submit/connect */ false,
@@ -913,11 +914,11 @@
};
/**
- * Returns the true if the app that created this config is the device owner of the device.
+ * Returns true if the config is not editable/removable except by its creating Device Owner.
* @param config The WiFi config.
- * @return creator package name or null if creator package is not device owner.
+ * @return true if the config is not editable/removable except by its creating Device Owner.
*/
- static boolean isCreatorDeviceOwner(Context context, WifiConfiguration config) {
+ static boolean isEditabilityLockedDown(Context context, WifiConfiguration config) {
if (config == null) {
return false;
}
@@ -927,6 +928,10 @@
if (deviceOwnerPackageName == null) {
return false;
}
+ UserManager um = UserManager.get(context);
+ if (um.hasUserRestriction(UserManager.DISALLOW_CONFIG_WIFI)) {
+ return false;
+ }
final PackageManager pm = context.getPackageManager();
try {
final int deviceOwnerUid = pm.getPackageUid(deviceOwnerPackageName,
diff --git a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
index 72dca9e..81815ae 100644
--- a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
+++ b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
@@ -194,6 +194,19 @@
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_POSITIVE) {
if (mWifiP2pManager != null) {
+ String name = mDeviceNameText.getText().toString();
+ if (name != null) {
+ for (int i = 0; i < name.length(); i++) {
+ char cur = name.charAt(i);
+ if(!Character.isDigit(cur) && !Character.isLetter(cur)
+ && cur != '-' && cur != '_' && cur != ' ') {
+ Toast.makeText(getActivity(),
+ R.string.wifi_p2p_failed_rename_message,
+ Toast.LENGTH_LONG).show();
+ return;
+ }
+ }
+ }
mWifiP2pManager.setDeviceName(mChannel,
mDeviceNameText.getText().toString(),
new WifiP2pManager.ActionListener() {