Merge "Removes summary text from Instant Apps details" into oc-dev
diff --git a/res/drawable/ic_instant_apps_badge.xml b/res/drawable/ic_instant_apps_badge.xml
new file mode 100644
index 0000000..115aa83
--- /dev/null
+++ b/res/drawable/ic_instant_apps_badge.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2017 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
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="48dp"
+ android:height="48dp"
+ android:viewportWidth="48"
+ android:viewportHeight="48">
+ <path
+ android:fillColor="#FFFFFF"
+ android:fillType="evenOdd"
+ android:pathData="M 24.5 2.7 C 35.5456949966 2.7 44.5 11.6543050034 44.5 22.7 C 44.5 33.7456949966 35.5456949966 42.7 24.5 42.7 C 13.4543050034 42.7 4.5 33.7456949966 4.5 22.7 C 4.5 11.6543050034 13.4543050034 2.7 24.5 2.7 Z" />
+ <path
+ android:fillColor="#757575"
+ android:fillType="evenOdd"
+ android:pathData="M 33.3 19.1 L 26.4 19.1 L 26.4 5.8 L 16.6 26.4 L 23.5 26.3 L 23.5 39.6 Z" />
+ <path
+ android:fillType="evenOdd"
+ android:pathData="M 0.5 0 H 48.5 V 48 H 0.5 V 0 Z" />
+</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_instant_apps_badge_bg.xml b/res/drawable/ic_instant_apps_badge_bg.xml
new file mode 100644
index 0000000..bf8d3ea
--- /dev/null
+++ b/res/drawable/ic_instant_apps_badge_bg.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2017 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
+ -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+ <gradient android:type="radial"
+ android:startColor="#4d000000"
+ android:endColor="#00000000"
+ android:gradientRadius="12dp"/>
+</shape>
\ No newline at end of file
diff --git a/res/layout/app_details.xml b/res/layout/app_details.xml
index 00d4cca..4aa1496 100644
--- a/res/layout/app_details.xml
+++ b/res/layout/app_details.xml
@@ -34,13 +34,26 @@
android:layout_height="wrap_content"
android:paddingStart="8dp">
- <ImageView
- android:id="@+id/app_detail_icon"
- android:layout_width="80dp"
- android:layout_height="80dp"
- android:scaleType="fitXY"
- android:layout_gravity="center_horizontal"
- android:antialias="true"/>
+ <FrameLayout android:id="@+id/app_icon_frame"
+ android:layout_width="80dp"
+ android:layout_height="80dp">
+ <ImageView
+ android:id="@+id/app_detail_icon"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="fitXY"
+ android:layout_gravity="center_horizontal"
+ android:antialias="true"/>
+ <ImageView android:id="@+id/app_icon_instant_apps_badge"
+ android:layout_width="22dp"
+ android:layout_height="22dp"
+ android:layout_gravity="end|bottom"
+ android:layout_margin="8dp"
+ android:visibility="gone"
+ android:elevation="20dp"
+ android:background="@drawable/ic_instant_apps_badge_bg"
+ android:src="@drawable/ic_instant_apps_badge" />
+ </FrameLayout>
<LinearLayout
android:id="@+id/app_detail_links"
@@ -71,7 +84,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_toEndOf="@id/app_detail_icon"
+ android:layout_toEndOf="@id/app_icon_frame"
android:layout_toStartOf="@id/app_detail_links"
android:paddingStart="24dp"
android:paddingEnd="24dp"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6578374..3173e85 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5656,6 +5656,8 @@
<string name="vpn_always_on_summary">Stay connected to VPN at all times</string>
<!-- Preference summary for app not supporting always-on VPN [CHAR LIMIT=40] -->
<string name="vpn_always_on_summary_not_supported">Not supported by this app</string>
+ <!-- Preference summary for a VPN app that is set to be always-on. [CHAR LIMIT=40] -->
+ <string name="vpn_always_on_summary_active">Always-on active</string>
<!-- Preference title for the toggle that controls whether to force all network connections to
go through VPN. [CHAR LIMIT=40] -->
<string name="vpn_require_connection">Block connections without VPN</string>
@@ -7434,7 +7436,7 @@
<!-- Title of one of the choices in a dialog (with title defined in usb_use) that lets the user
select what the USB connection for this device should be used for. This choice
is for charging only. -->
- <string name="usb_use_charging_only">Charging this device</string>
+ <string name="usb_use_charging_only">Charge this device</string>
<!-- Decription of one of the choices in a dialog (with title defined in usb_use) that lets the
user select what the USB connection for this device should be used for. This choice
is for charging only. -->
@@ -7442,15 +7444,15 @@
<!-- Title of one of the choices in a dialog (with title defined in usb_use) that lets the user
select what the USB connection for this device should be used for. This choice
is for powering the other device only. -->
- <string name="usb_use_power_only">Supplying power</string>
+ <string name="usb_use_power_only">Supply power</string>
<!-- Decription of one of the choices in a dialog (with title defined in usb_use) that lets the
user select what the USB connection for this device should be used for. This choice
is for powering the other device. -->
- <string name="usb_use_power_only_desc">Supply power to the other connected device</string>
+ <string name="usb_use_power_only_desc">Charge the connected device. Works only with devices that support USB charging.</string>
<!-- Title of one of the choices in a dialog (with title defined in usb_use) that lets the user
select what the USB connection for this device should be used for. This choice
is for transferring files via MTP. -->
- <string name="usb_use_file_transfers">Transferring files</string>
+ <string name="usb_use_file_transfers">Transfer files</string>
<!-- Description of one of the choices in a dialog (with title defined in usb_use) that lets the user
select what the USB connection for this device should be used for. This choice
is for transferring files via MTP. -->
@@ -7458,7 +7460,7 @@
<!-- Title of one of the choices in a dialog (with title defined in usb_use) that lets the user
select what the USB connection for this device should be used for. This choice
is for transferring photos via PTP. -->
- <string name="usb_use_photo_transfers">Transferring photos (PTP)</string>
+ <string name="usb_use_photo_transfers">Transfer photos (PTP)</string>
<!-- Description of one of the choices in a dialog (with title defined in usb_use) that lets the user
select what the USB connection for this device should be used for. This choice
is for transferring photos via PTP. -->
@@ -7466,7 +7468,7 @@
<!-- Title of one of the choices in a dialog (with title defined in usb_use) that lets the user
select what the USB connection for this device should be used for. This choice
is for entering MIDI mode. -->
- <string name="usb_use_MIDI">Using device as MIDI</string>
+ <string name="usb_use_MIDI">Use device as MIDI</string>
<!-- Description of one of the choices in a dialog (with title defined in usb_use) that lets the user
select what the USB connection for this device should be used for. This choice
is for entering MIDI mode. -->
@@ -7479,6 +7481,17 @@
<!-- Settings item title for USB preference [CHAR LIMIT=35] -->
<string name="usb_pref">USB</string>
+ <!-- Settings item summary for USB preference when set to charging only [CHAR LIMIT=NONE] -->
+ <string name="usb_summary_charging_only">Charging this device</string>
+ <!-- Settings item summary for USB preference when set to powering the other device only [CHAR LIMIT=NONE] -->
+ <string name="usb_summary_power_only">Supplying power</string>
+ <!-- Settings item summary for USB preference when set to transferring files via MTP [CHAR LIMIT=NONE] -->
+ <string name="usb_summary_file_transfers">Transferring files</string>
+ <!-- Settings item summary for USB preference when set to transferring photos via PTP [CHAR LIMIT=NONE] -->
+ <string name="usb_summary_photo_transfers">Transferring photos (PTP)</string>
+ <!-- Settings item summary for USB preference when set to entering MIDI mode [CHAR LIMIT=NONE] -->
+ <string name="usb_summary_MIDI">Using device as MIDI</string>
+
<!-- Settings item title for background check prefs [CHAR LIMIT=35] -->
<string name="background_check_pref">Background check</string>
diff --git a/res/xml/enterprise_privacy_settings.xml b/res/xml/enterprise_privacy_settings.xml
index 15e4e22..3ea0860 100644
--- a/res/xml/enterprise_privacy_settings.xml
+++ b/res/xml/enterprise_privacy_settings.xml
@@ -100,7 +100,7 @@
android:title="@string/enterprise_privacy_wipe_device"
settings:multiLine="true"/>
<com.android.settings.DividerPreference
- android:key="failed_password_wipe_primary_user"
+ android:key="failed_password_wipe_current_user"
android:title="@string/enterprise_privacy_failed_password_wipe_device"
settings:multiLine="true"/>
<com.android.settings.DividerPreference
diff --git a/res/xml/external_sources_details.xml b/res/xml/external_sources_details.xml
index fb443f4..6bc7390 100644
--- a/res/xml/external_sources_details.xml
+++ b/res/xml/external_sources_details.xml
@@ -14,13 +14,17 @@
limitations under the License.
-->
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+ android:title="@string/install_other_apps">
- <SwitchPreference
- android:key="external_sources_settings_switch" />
+ <com.android.settingslib.RestrictedSwitchPreference
+ android:key="external_sources_settings_switch"
+ android:title="@string/external_source_switch_title" />
<Preference
android:key="external_sources_settings_description"
+ android:summary="@string/install_all_warning"
android:selectable="false" />
</PreferenceScreen>
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 8f645f8..589421f 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -16,7 +16,10 @@
package com.android.settings;
+import android.os.Bundle;
+
import com.android.settings.applications.AppOpsSummary;
+import com.android.settings.enterprise.EnterprisePrivacySettings;
import com.android.settings.fingerprint.FingerprintEnrollIntroduction;
import com.android.settings.fingerprint.FingerprintSettings;
@@ -154,7 +157,15 @@
public static class TestingSettingsActivity extends SettingsActivity { /* empty */ }
public static class WifiAPITestActivity extends SettingsActivity { /* empty */ }
public static class WifiInfoActivity extends SettingsActivity { /* empty */ }
- public static class EnterprisePrivacySettingsActivity extends SettingsActivity { /* empty */ }
+ public static class EnterprisePrivacySettingsActivity extends SettingsActivity {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (!EnterprisePrivacySettings.isPageEnabled(this)) {
+ finish();
+ }
+ }
+ }
public static class WebViewAppPickerActivity extends SettingsActivity { /* empty */ }
// Top level categories for new IA
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 09380e5..015af17 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -60,7 +60,6 @@
import com.android.settings.dashboard.DashboardFeatureProvider;
import com.android.settings.dashboard.DashboardSummary;
import com.android.settings.development.DevelopmentSettings;
-import com.android.settings.enterprise.EnterprisePrivacySettings;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.DynamicIndexableContentMonitor;
import com.android.settings.search2.SearchFeatureProvider;
@@ -827,10 +826,6 @@
isAdmin || Utils.isCarrierDemoUser(this));
setTileEnabled(new ComponentName(packageName,
- Settings.EnterprisePrivacySettingsActivity.class.getName()),
- EnterprisePrivacySettings.isPageEnabled(this), isAdmin);
-
- setTileEnabled(new ComponentName(packageName,
Settings.WifiDisplaySettingsActivity.class.getName()),
WifiDisplaySettings.isAvailable(this), isAdmin);
diff --git a/src/com/android/settings/applications/AppCounter.java b/src/com/android/settings/applications/AppCounter.java
index 09a10e2..8758b14 100644
--- a/src/com/android/settings/applications/AppCounter.java
+++ b/src/com/android/settings/applications/AppCounter.java
@@ -20,6 +20,7 @@
import android.content.pm.PackageManager;
import android.content.pm.UserInfo;
import android.os.AsyncTask;
+import android.os.UserHandle;
import android.os.UserManager;
import java.util.List;
@@ -37,7 +38,7 @@
@Override
protected Integer doInBackground(Void... params) {
int count = 0;
- for (UserInfo user : getUsersToCount()) {
+ for (UserInfo user : mUm.getProfiles(UserHandle.myUserId())) {
final List<ApplicationInfo> list =
mPm.getInstalledApplicationsAsUser(PackageManager.GET_DISABLED_COMPONENTS
| PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS
@@ -62,6 +63,5 @@
}
protected abstract void onCountComplete(int num);
- protected abstract List<UserInfo> getUsersToCount();
protected abstract boolean includeInCount(ApplicationInfo info);
}
diff --git a/src/com/android/settings/applications/AppHeaderController.java b/src/com/android/settings/applications/AppHeaderController.java
index fb4b122..b138ede 100644
--- a/src/com/android/settings/applications/AppHeaderController.java
+++ b/src/com/android/settings/applications/AppHeaderController.java
@@ -212,6 +212,10 @@
ImageView iconView = (ImageView) mAppHeader.findViewById(R.id.app_detail_icon);
if (iconView != null) {
iconView.setImageDrawable(mIcon);
+ ImageView badgeView = mAppHeader.findViewById(R.id.app_icon_instant_apps_badge);
+ if (badgeView != null) {
+ badgeView.setVisibility(mIsInstantApp ? View.VISIBLE : View.GONE);
+ }
}
setText(R.id.app_detail_title, mLabel);
setText(R.id.app_detail_summary, mSummary);
diff --git a/src/com/android/settings/applications/ApplicationFeatureProvider.java b/src/com/android/settings/applications/ApplicationFeatureProvider.java
index 1816793..ef8cb23 100644
--- a/src/com/android/settings/applications/ApplicationFeatureProvider.java
+++ b/src/com/android/settings/applications/ApplicationFeatureProvider.java
@@ -40,8 +40,8 @@
View view);
/**
- * Calculates the total number of apps installed on the device via policy across all users
- * and managed profiles.
+ * Calculates the total number of apps installed on the device via policy in the current user
+ * and all its managed profiles.
*
* @param async Whether to count asynchronously in a background thread
* @param callback The callback to invoke with the result
@@ -49,9 +49,8 @@
void calculateNumberOfPolicyInstalledApps(boolean async, NumberOfAppsCallback callback);
/**
- * Asynchronously calculates the total number of apps installed on the device, across all users
- * and managed profiles, that have been granted one or more of the given permissions by the
- * admin.
+ * Asynchronously calculates the total number of apps installed in the current user and all its
+ * managed profiles that have been granted one or more of the given permissions by the admin.
*
* @param permissions Only consider apps that have been granted one or more of these permissions
* by the admin, either at run-time or install-time
diff --git a/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java b/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java
index 7cc899b..124a8de 100644
--- a/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java
+++ b/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java
@@ -22,7 +22,6 @@
import android.content.pm.ComponentInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
-import android.content.pm.UserInfo;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
@@ -65,8 +64,8 @@
@Override
public void calculateNumberOfPolicyInstalledApps(boolean async, NumberOfAppsCallback callback) {
- final AllUserPolicyInstalledAppCounter counter =
- new AllUserPolicyInstalledAppCounter(mContext, mPm, callback);
+ final CurrentUserAndManagedProfilePolicyInstalledAppCounter counter =
+ new CurrentUserAndManagedProfilePolicyInstalledAppCounter(mContext, mPm, callback);
if (async) {
counter.execute();
} else {
@@ -77,9 +76,9 @@
@Override
public void calculateNumberOfAppsWithAdminGrantedPermissions(String[] permissions,
boolean async, NumberOfAppsCallback callback) {
- final AllUserAppWithAdminGrantedPermissionsCounter counter =
- new AllUserAppWithAdminGrantedPermissionsCounter(mContext, permissions, mPm, mPms,
- mDpm, callback);
+ final CurrentUserAndManagedProfileAppWithAdminGrantedPermissionsCounter counter =
+ new CurrentUserAndManagedProfileAppWithAdminGrantedPermissionsCounter(mContext,
+ permissions, mPm, mPms, mDpm, callback);
if (async) {
counter.execute();
} else {
@@ -120,11 +119,12 @@
return activities;
}
- private static class AllUserPolicyInstalledAppCounter extends InstalledAppCounter {
+ private static class CurrentUserAndManagedProfilePolicyInstalledAppCounter
+ extends InstalledAppCounter {
private NumberOfAppsCallback mCallback;
- AllUserPolicyInstalledAppCounter(Context context, PackageManagerWrapper packageManager,
- NumberOfAppsCallback callback) {
+ CurrentUserAndManagedProfilePolicyInstalledAppCounter(Context context,
+ PackageManagerWrapper packageManager, NumberOfAppsCallback callback) {
super(context, PackageManager.INSTALL_REASON_POLICY, packageManager);
mCallback = callback;
}
@@ -133,19 +133,15 @@
protected void onCountComplete(int num) {
mCallback.onNumberOfAppsResult(num);
}
-
- @Override
- protected List<UserInfo> getUsersToCount() {
- return mUm.getUsers(true /* excludeDying */);
- }
}
- private static class AllUserAppWithAdminGrantedPermissionsCounter extends
- AppWithAdminGrantedPermissionsCounter {
+ private static class CurrentUserAndManagedProfileAppWithAdminGrantedPermissionsCounter
+ extends AppWithAdminGrantedPermissionsCounter {
private NumberOfAppsCallback mCallback;
- AllUserAppWithAdminGrantedPermissionsCounter(Context context, String[] permissions,
- PackageManagerWrapper packageManager, IPackageManagerWrapper packageManagerService,
+ CurrentUserAndManagedProfileAppWithAdminGrantedPermissionsCounter(Context context,
+ String[] permissions, PackageManagerWrapper packageManager,
+ IPackageManagerWrapper packageManagerService,
DevicePolicyManagerWrapper devicePolicyManager, NumberOfAppsCallback callback) {
super(context, permissions, packageManager, packageManagerService, devicePolicyManager);
mCallback = callback;
@@ -155,10 +151,5 @@
protected void onCountComplete(int num) {
mCallback.onNumberOfAppsResult(num);
}
-
- @Override
- protected List<UserInfo> getUsersToCount() {
- return mUm.getUsers(true /* excludeDying */);
- }
}
}
diff --git a/src/com/android/settings/applications/ExternalSourcesDetails.java b/src/com/android/settings/applications/ExternalSourcesDetails.java
index 6441437..fe51a87 100644
--- a/src/com/android/settings/applications/ExternalSourcesDetails.java
+++ b/src/com/android/settings/applications/ExternalSourcesDetails.java
@@ -24,27 +24,26 @@
import android.app.AppOpsManager;
import android.content.Context;
import android.os.Bundle;
-import android.support.v14.preference.SwitchPreference;
+import android.os.UserHandle;
+import android.os.UserManager;
import android.support.v7.preference.Preference;
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
import com.android.settings.R;
import com.android.settings.Settings;
import com.android.settings.applications.AppStateInstallAppsBridge.InstallAppsState;
+import com.android.settingslib.RestrictedSwitchPreference;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
public class ExternalSourcesDetails extends AppInfoWithHeader
implements OnPreferenceChangeListener {
- private static final String KEY_EXTERNAL_SOURCES_SETTINGS_SWITCH =
- "external_sources_settings_switch";
- private static final String KEY_EXTERNAL_SOURCES_SETTINGS_DESC =
- "external_sources_settings_description";
+ private static final String KEY_EXTERNAL_SOURCE_SWITCH = "external_sources_settings_switch";
private AppStateInstallAppsBridge mAppBridge;
private AppOpsManager mAppOpsManager;
- private SwitchPreference mSwitchPref;
- private Preference mExternalSourcesSettingsDesc;
+ private UserManager mUserManager;
+ private RestrictedSwitchPreference mSwitchPref;
private InstallAppsState mInstallAppsState;
@Override
@@ -54,15 +53,10 @@
final Context context = getActivity();
mAppBridge = new AppStateInstallAppsBridge(context, mState, null);
mAppOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
+ mUserManager = UserManager.get(context);
addPreferencesFromResource(R.xml.external_sources_details);
- mSwitchPref = (SwitchPreference) findPreference(KEY_EXTERNAL_SOURCES_SETTINGS_SWITCH);
- mExternalSourcesSettingsDesc = findPreference(KEY_EXTERNAL_SOURCES_SETTINGS_DESC);
-
- getPreferenceScreen().setTitle(R.string.install_other_apps);
- mSwitchPref.setTitle(R.string.external_source_switch_title);
- mExternalSourcesSettingsDesc.setSummary(R.string.install_all_warning);
-
+ mSwitchPref = (RestrictedSwitchPreference) findPreference(KEY_EXTERNAL_SOURCE_SWITCH);
mSwitchPref.setOnPreferenceChangeListener(this);
}
@@ -84,6 +78,18 @@
}
static CharSequence getPreferenceSummary(Context context, AppEntry entry) {
+ final UserManager um = UserManager.get(context);
+ final int userRestrictionSource = um.getUserRestrictionSource(
+ UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES,
+ UserHandle.getUserHandleForUid(entry.info.uid));
+ switch (userRestrictionSource) {
+ case UserManager.RESTRICTION_SOURCE_DEVICE_OWNER:
+ case UserManager.RESTRICTION_SOURCE_PROFILE_OWNER:
+ return context.getString(R.string.disabled_by_admin);
+ case UserManager.RESTRICTION_SOURCE_SYSTEM:
+ return context.getString(R.string.disabled);
+ }
+
final InstallAppsState appsState;
if (entry.extraInfo instanceof InstallAppsState) {
appsState = (InstallAppsState) entry.extraInfo;
@@ -103,6 +109,17 @@
@Override
protected boolean refreshUi() {
+ if (mUserManager.hasBaseUserRestriction(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES,
+ UserHandle.of(UserHandle.myUserId()))) {
+ mSwitchPref.setChecked(false);
+ mSwitchPref.setSummary(R.string.disabled);
+ mSwitchPref.setEnabled(false);
+ return true;
+ }
+ mSwitchPref.checkRestrictionAndSetDisabled(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES);
+ if (mSwitchPref.isDisabledByAdmin()) {
+ return true;
+ }
mInstallAppsState = mAppBridge.createInstallAppsStateFor(mPackageName,
mPackageInfo.applicationInfo.uid);
if (!mInstallAppsState.isPotentialAppSource()) {
@@ -110,8 +127,7 @@
mSwitchPref.setEnabled(false);
return true;
}
- final boolean canInstallApps = mInstallAppsState.canInstallApps();
- mSwitchPref.setChecked(canInstallApps);
+ mSwitchPref.setChecked(mInstallAppsState.canInstallApps());
return true;
}
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java
index f83dfeb..fde145f 100644
--- a/src/com/android/settings/applications/ManageApplications.java
+++ b/src/com/android/settings/applications/ManageApplications.java
@@ -23,7 +23,6 @@
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageItemInfo;
import android.content.pm.PackageManager;
-import android.content.pm.UserInfo;
import android.icu.text.AlphabeticIndex;
import android.os.Bundle;
import android.os.Environment;
@@ -1404,11 +1403,6 @@
mLoader.setSummary(SummaryProvider.this,
mContext.getString(R.string.apps_summary, num));
}
-
- @Override
- protected List<UserInfo> getUsersToCount() {
- return mUm.getProfiles(UserHandle.myUserId());
- }
}.execute();
}
}
diff --git a/src/com/android/settings/applications/NotificationApps.java b/src/com/android/settings/applications/NotificationApps.java
index 7aaa36e..c54363a 100644
--- a/src/com/android/settings/applications/NotificationApps.java
+++ b/src/com/android/settings/applications/NotificationApps.java
@@ -18,16 +18,11 @@
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
-import android.content.pm.UserInfo;
-import android.os.UserHandle;
-import android.os.UserManager;
import com.android.settings.R;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.notification.NotificationBackend;
-import java.util.List;
-
/**
* Extension of ManageApplications with no changes other than having its own
* SummaryProvider.
@@ -57,11 +52,6 @@
}
@Override
- protected List<UserInfo> getUsersToCount() {
- return mUm.getProfiles(UserHandle.myUserId());
- }
-
- @Override
protected boolean includeInCount(ApplicationInfo info) {
return mNotificationBackend.getNotificationsBanned(info.packageName,
info.uid);
diff --git a/src/com/android/settings/enterprise/AlwaysOnVpnPrimaryUserPreferenceController.java b/src/com/android/settings/enterprise/AlwaysOnVpnCurrentUserPreferenceController.java
similarity index 90%
rename from src/com/android/settings/enterprise/AlwaysOnVpnPrimaryUserPreferenceController.java
rename to src/com/android/settings/enterprise/AlwaysOnVpnCurrentUserPreferenceController.java
index e5823fe..e98ece8 100644
--- a/src/com/android/settings/enterprise/AlwaysOnVpnPrimaryUserPreferenceController.java
+++ b/src/com/android/settings/enterprise/AlwaysOnVpnCurrentUserPreferenceController.java
@@ -21,13 +21,13 @@
import com.android.settings.core.lifecycle.Lifecycle;
import com.android.settings.overlay.FeatureFactory;
-public class AlwaysOnVpnPrimaryUserPreferenceController
+public class AlwaysOnVpnCurrentUserPreferenceController
extends DynamicAvailabilityPreferenceController {
private static final String KEY_ALWAYS_ON_VPN_PRIMARY_USER = "always_on_vpn_primary_user";
private final EnterprisePrivacyFeatureProvider mFeatureProvider;
- public AlwaysOnVpnPrimaryUserPreferenceController(Context context, Lifecycle lifecycle) {
+ public AlwaysOnVpnCurrentUserPreferenceController(Context context, Lifecycle lifecycle) {
super(context, lifecycle);
mFeatureProvider = FeatureFactory.getFactory(context)
.getEnterprisePrivacyFeatureProvider(context);
@@ -42,7 +42,7 @@
@Override
public boolean isAvailable() {
- return mFeatureProvider.isAlwaysOnVpnSetInPrimaryUser();
+ return mFeatureProvider.isAlwaysOnVpnSetInCurrentUser();
}
@Override
diff --git a/src/com/android/settings/enterprise/DevicePolicyManagerWrapper.java b/src/com/android/settings/enterprise/DevicePolicyManagerWrapper.java
index a154a2f..babf90e 100644
--- a/src/com/android/settings/enterprise/DevicePolicyManagerWrapper.java
+++ b/src/com/android/settings/enterprise/DevicePolicyManagerWrapper.java
@@ -52,13 +52,6 @@
ComponentName getDeviceOwnerComponentOnAnyUser();
/**
- * Calls {@code DevicePolicyManager.getDeviceOwnerUserId()}.
- *
- * @see android.app.admin.DevicePolicyManager#getDeviceOwnerUserId
- */
- int getDeviceOwnerUserId();
-
- /**
* Calls {@code DevicePolicyManager.getProfileOwnerAsUser()}.
*
* @see android.app.admin.DevicePolicyManager#getProfileOwnerAsUser
diff --git a/src/com/android/settings/enterprise/DevicePolicyManagerWrapperImpl.java b/src/com/android/settings/enterprise/DevicePolicyManagerWrapperImpl.java
index 95a154b..7906310 100644
--- a/src/com/android/settings/enterprise/DevicePolicyManagerWrapperImpl.java
+++ b/src/com/android/settings/enterprise/DevicePolicyManagerWrapperImpl.java
@@ -47,11 +47,6 @@
}
@Override
- public int getDeviceOwnerUserId() {
- return mDpm.getDeviceOwnerUserId();
- }
-
- @Override
public @Nullable ComponentName getProfileOwnerAsUser(final int userId) {
return mDpm.getProfileOwnerAsUser(userId);
}
diff --git a/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProvider.java b/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProvider.java
index 4ad0f2e..391db83 100644
--- a/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProvider.java
+++ b/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProvider.java
@@ -32,9 +32,9 @@
boolean isInCompMode();
/**
- * Returns the name of the organization managing the device via a Device Owner app. If the device
- * is not managed by a Device Owner app or the name of the managing organization was not set,
- * returns {@code null}.
+ * Returns the name of the organization managing the device via a Device Owner app. If the
+ * device is not managed by a Device Owner app or the name of the managing organization was not
+ * set, returns {@code null}.
*/
String getDeviceOwnerOrganizationName();
@@ -74,12 +74,13 @@
boolean isNetworkLoggingEnabled();
/**
- * Returns whether the Device Owner in the primary user set an always-on VPN.
+ * Returns whether the Device Owner or Profile Owner in the current user set an always-on VPN.
*/
- boolean isAlwaysOnVpnSetInPrimaryUser();
+ boolean isAlwaysOnVpnSetInCurrentUser();
/**
- * Returns whether the Profile Owner in the managed profile (if any) set an always-on VPN.
+ * Returns whether the Profile Owner in the current user's managed profile (if any) set an
+ * always-on VPN.
*/
boolean isAlwaysOnVpnSetInManagedProfile();
@@ -89,10 +90,10 @@
boolean isGlobalHttpProxySet();
/**
- * Returns the number of failed login attempts that the Device Owner allows before the entire
- * device is wiped, or zero if no such limit is set.
+ * Returns the number of failed login attempts that the Device Owner or Profile Owner allows
+ * before the current user is wiped, or zero if no such limit is set.
*/
- int getMaximumFailedPasswordsBeforeWipeInPrimaryUser();
+ int getMaximumFailedPasswordsBeforeWipeInCurrentUser();
/**
* Returns the number of failed login attempts that the Profile Owner allows before the current
diff --git a/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java b/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java
index 6d038dc..5817cf2 100644
--- a/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java
+++ b/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java
@@ -142,7 +142,7 @@
}
@Override
- public boolean isAlwaysOnVpnSetInPrimaryUser() {
+ public boolean isAlwaysOnVpnSetInCurrentUser() {
return VpnUtils.isAlwaysOnVpnSet(mCm, MY_USER_ID);
}
@@ -159,12 +159,12 @@
}
@Override
- public int getMaximumFailedPasswordsBeforeWipeInPrimaryUser() {
- final ComponentName deviceOwner = mDpm.getDeviceOwnerComponentOnAnyUser();
- if (deviceOwner == null) {
+ public int getMaximumFailedPasswordsBeforeWipeInCurrentUser() {
+ final ComponentName profileOwner = mDpm.getProfileOwnerAsUser(MY_USER_ID);
+ if (profileOwner == null) {
return 0;
}
- return mDpm.getMaximumFailedPasswordsForWipe(deviceOwner, mDpm.getDeviceOwnerUserId());
+ return mDpm.getMaximumFailedPasswordsForWipe(profileOwner, MY_USER_ID);
}
@Override
diff --git a/src/com/android/settings/enterprise/EnterprisePrivacySettings.java b/src/com/android/settings/enterprise/EnterprisePrivacySettings.java
index 9649d84..a80dec0 100644
--- a/src/com/android/settings/enterprise/EnterprisePrivacySettings.java
+++ b/src/com/android/settings/enterprise/EnterprisePrivacySettings.java
@@ -70,11 +70,11 @@
controllers.add(new AdminGrantedCameraPermissionPreferenceController(context, lifecycle,
async));
controllers.add(new EnterpriseSetDefaultAppsPreferenceController(context, lifecycle));
- controllers.add(new AlwaysOnVpnPrimaryUserPreferenceController(context, lifecycle));
+ controllers.add(new AlwaysOnVpnCurrentUserPreferenceController(context, lifecycle));
controllers.add(new AlwaysOnVpnManagedProfilePreferenceController(context, lifecycle));
controllers.add(new GlobalHttpProxyPreferenceController(context, lifecycle));
controllers.add(new CaCertsPreferenceController(context, lifecycle));
- controllers.add(new FailedPasswordWipePrimaryUserPreferenceController(context, lifecycle));
+ controllers.add(new FailedPasswordWipeCurrentUserPreferenceController(context, lifecycle));
controllers.add(new FailedPasswordWipeManagedProfilePreferenceController(context,
lifecycle));
controllers.add(new ImePreferenceController(context, lifecycle));
diff --git a/src/com/android/settings/enterprise/FailedPasswordWipePrimaryUserPreferenceController.java b/src/com/android/settings/enterprise/FailedPasswordWipeCurrentUserPreferenceController.java
similarity index 77%
rename from src/com/android/settings/enterprise/FailedPasswordWipePrimaryUserPreferenceController.java
rename to src/com/android/settings/enterprise/FailedPasswordWipeCurrentUserPreferenceController.java
index 2e18f89..d3f9a98 100644
--- a/src/com/android/settings/enterprise/FailedPasswordWipePrimaryUserPreferenceController.java
+++ b/src/com/android/settings/enterprise/FailedPasswordWipeCurrentUserPreferenceController.java
@@ -17,23 +17,23 @@
import com.android.settings.core.lifecycle.Lifecycle;
-public class FailedPasswordWipePrimaryUserPreferenceController
+public class FailedPasswordWipeCurrentUserPreferenceController
extends FailedPasswordWipePreferenceControllerBase {
- private static final String KEY_FAILED_PASSWORD_WIPE_PRIMARY_USER
- = "failed_password_wipe_primary_user";
+ private static final String KEY_FAILED_PASSWORD_WIPE_CURRENT_USER
+ = "failed_password_wipe_current_user";
- public FailedPasswordWipePrimaryUserPreferenceController(Context context, Lifecycle lifecycle) {
+ public FailedPasswordWipeCurrentUserPreferenceController(Context context, Lifecycle lifecycle) {
super(context, lifecycle);
}
@Override
protected int getMaximumFailedPasswordsBeforeWipe() {
- return mFeatureProvider.getMaximumFailedPasswordsBeforeWipeInPrimaryUser();
+ return mFeatureProvider.getMaximumFailedPasswordsBeforeWipeInCurrentUser();
}
@Override
public String getPreferenceKey() {
- return KEY_FAILED_PASSWORD_WIPE_PRIMARY_USER;
+ return KEY_FAILED_PASSWORD_WIPE_CURRENT_USER;
}
}
diff --git a/src/com/android/settings/vpn2/ManageablePreference.java b/src/com/android/settings/vpn2/ManageablePreference.java
index b45ae45..11da758 100644
--- a/src/com/android/settings/vpn2/ManageablePreference.java
+++ b/src/com/android/settings/vpn2/ManageablePreference.java
@@ -87,7 +87,7 @@
final String[] states = res.getStringArray(R.array.vpn_states);
String summary = (mState == STATE_NONE ? "" : states[mState]);
if (mIsAlwaysOn) {
- final String alwaysOnString = res.getString(R.string.vpn_always_on_active);
+ final String alwaysOnString = res.getString(R.string.vpn_always_on_summary_active);
summary = TextUtils.isEmpty(summary) ? alwaysOnString : res.getString(
R.string.join_two_unrelated_items, summary, alwaysOnString);
}
diff --git a/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java b/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
index b9ffcaf..07495ee 100644
--- a/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
+++ b/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
@@ -20,7 +20,9 @@
import android.content.Context;
import android.content.res.Resources;
import android.icu.text.Collator;
+import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
+import android.net.wifi.hotspot2.PasspointConfiguration;
import android.os.Bundle;
import android.provider.SearchIndexableResource;
import android.support.v7.preference.Preference;
@@ -110,8 +112,7 @@
PreferenceScreen preferenceScreen = getPreferenceScreen();
final Context context = getPrefContext();
- final List<AccessPoint> accessPoints = WifiTracker.getCurrentAccessPoints(context, true,
- false, true);
+ final List<AccessPoint> accessPoints = getSavedConfigs(context, mWifiManager);
Collections.sort(accessPoints, SAVED_NETWORK_COMPARATOR);
preferenceScreen.removeAll();
@@ -129,6 +130,39 @@
}
}
+ /**
+ * Retrieved the list of saved network configurations from {@link WifiManager}.
+ * Each configuration is represented by {@link AccessPoint}.
+ *
+ * @param context The application context
+ * @param wifiManager An instance of {@link WifiManager}
+ * @return List of {@link AccessPoint}
+ */
+ private static List<AccessPoint> getSavedConfigs(Context context, WifiManager wifiManager) {
+ List<AccessPoint> savedConfigs = new ArrayList<>();
+ List<WifiConfiguration> savedNetworks = wifiManager.getConfiguredNetworks();
+ for (WifiConfiguration network : savedNetworks) {
+ // Configuration for Passpoint network is configured temporary by WifiService for
+ // connection attempt only. The underlying configuration is saved as Passpoint
+ // configuration, which will be retrieved with WifiManager#getPasspointConfiguration
+ // call below.
+ if (network.isPasspoint()) {
+ continue;
+ }
+ savedConfigs.add(new AccessPoint(context, network));
+ }
+ try {
+ List<PasspointConfiguration> savedPasspointConfigs =
+ wifiManager.getPasspointConfigurations();
+ for (PasspointConfiguration config : savedPasspointConfigs) {
+ savedConfigs.add(new AccessPoint(context, config));
+ }
+ } catch (UnsupportedOperationException e) {
+ // Passpoint not supported.
+ }
+ return savedConfigs;
+ }
+
private void showDialog(LongPressAccessPointPreference accessPoint, boolean edit) {
if (mDialog != null) {
removeDialog(WifiSettings.WIFI_DIALOG_ID);
@@ -187,7 +221,17 @@
@Override
public void onForget(WifiDialog dialog) {
if (mSelectedAccessPoint != null) {
- mWifiManager.forget(mSelectedAccessPoint.getConfig().networkId, null);
+ if (mSelectedAccessPoint.isPasspointConfig()) {
+ try {
+ mWifiManager.removePasspointConfiguration(
+ mSelectedAccessPoint.getPasspointFqdn());
+ } catch (RuntimeException e) {
+ Log.e(TAG, "Failed to remove Passpoint configuration for "
+ + mSelectedAccessPoint.getConfigName());
+ }
+ } else {
+ mWifiManager.forget(mSelectedAccessPoint.getConfig().networkId, null);
+ }
mSelectedAccessPoint = null;
initPreferences();
}
@@ -235,8 +279,8 @@
result.add(data);
// Add available Wi-Fi access points
- final List<AccessPoint> accessPoints = WifiTracker.getCurrentAccessPoints(context,
- true, false, true);
+ final List<AccessPoint> accessPoints =
+ getSavedConfigs(context, context.getSystemService(WifiManager.class));
final int accessPointsSize = accessPoints.size();
for (int i = 0; i < accessPointsSize; ++i){
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 460d210..4380cbe 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -217,7 +217,11 @@
mConfigUi.setSubmitButton(res.getString(R.string.wifi_save));
} else {
- mConfigUi.setTitle(mAccessPoint.getSsid());
+ if (!mAccessPoint.isPasspointConfig()) {
+ mConfigUi.setTitle(mAccessPoint.getSsid());
+ } else {
+ mConfigUi.setTitle(mAccessPoint.getConfigName());
+ }
ViewGroup group = (ViewGroup) mView.findViewById(R.id.info);
@@ -258,7 +262,8 @@
}
}
- if ((!mAccessPoint.isSaved() && !mAccessPoint.isActive())
+ if ((!mAccessPoint.isSaved() && !mAccessPoint.isActive()
+ && !mAccessPoint.isPasspointConfig())
|| mMode != WifiConfigUiBase.MODE_VIEW) {
showSecurityFields();
showIpConfigFields();
@@ -326,7 +331,8 @@
addRow(group, R.string.wifi_security, mAccessPoint.getSecurityString(false));
mView.findViewById(R.id.ip_fields).setVisibility(View.GONE);
}
- if (mAccessPoint.isSaved() || mAccessPoint.isActive()) {
+ if (mAccessPoint.isSaved() || mAccessPoint.isActive()
+ || mAccessPoint.isPasspointConfig()) {
mConfigUi.setForgetButton(res.getString(R.string.wifi_forget));
}
}
diff --git a/src/com/android/settings/wifi/WifiEnabler.java b/src/com/android/settings/wifi/WifiEnabler.java
index e0e6a1a..abab154 100644
--- a/src/com/android/settings/wifi/WifiEnabler.java
+++ b/src/com/android/settings/wifi/WifiEnabler.java
@@ -57,8 +57,7 @@
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (WifiManager.WIFI_STATE_CHANGED_ACTION.equals(action)) {
- handleWifiStateChanged(intent.getIntExtra(
- WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_UNKNOWN));
+ handleWifiStateChanged(mWifiManager.getWifiState());
} else if (WifiManager.SUPPLICANT_STATE_CHANGED_ACTION.equals(action)) {
if (!mConnected.get()) {
handleStateChanged(WifiInfo.getDetailedStateOf((SupplicantState)
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 20f723c..8784d09 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -196,7 +196,6 @@
mConnectedAccessPointPreferenceCategory =
(PreferenceCategory) findPreference(PREF_KEY_CONNECTED_ACCESS_POINTS);
-
mAccessPointsPreferenceCategory =
(PreferenceCategory) findPreference(PREF_KEY_ACCESS_POINTS);
mAdditionalSettingsPreferenceCategory =
@@ -204,10 +203,6 @@
mConfigureWifiSettingsPreference = findPreference(PREF_KEY_CONFIGURE_WIFI_SETTINGS);
mSavedNetworksPreference = findPreference(PREF_KEY_SAVED_NETWORKS);
- if (isUiRestricted()) {
- getPreferenceScreen().removePreference(mAdditionalSettingsPreferenceCategory);
- }
-
Context prefContext = getPrefContext();
mAddPreference = new Preference(prefContext);
mAddPreference.setIcon(R.drawable.ic_menu_add_inset);
@@ -216,6 +211,11 @@
mUserBadgeCache = new AccessPointPreference.UserBadgeCache(getPackageManager());
+ if (isUiRestricted()) {
+ getPreferenceScreen().removePreference(mAdditionalSettingsPreferenceCategory);
+ addMessagePreference(R.string.wifi_empty_list_user_restricted);
+ }
+
mBgThread = new HandlerThread(TAG, Process.THREAD_PRIORITY_BACKGROUND);
mBgThread.start();
}
@@ -314,7 +314,7 @@
if (intent.hasExtra(EXTRA_START_CONNECT_SSID)) {
mOpenSsid = intent.getStringExtra(EXTRA_START_CONNECT_SSID);
- onAccessPointsChanged();
+ updateAccessPointsDelayed();
}
}
@@ -614,53 +614,75 @@
}
/**
- * Shows the latest access points available with supplemental information like
- * the strength of network and the security for it.
+ * Called to indicate the list of AccessPoints has been updated and
+ * getAccessPoints should be called to get the latest information.
*/
@Override
public void onAccessPointsChanged() {
+ updateAccessPointsDelayed();
+ }
+
+ /**
+ * Updates access points from {@link WifiManager#getScanResults()}. Adds a delay to have
+ * progress bar displayed before starting to modify APs.
+ */
+ private void updateAccessPointsDelayed() {
// Safeguard from some delayed event handling
- if (getActivity() == null) return;
- final int wifiState = mWifiManager.getWifiState();
+ if (getActivity() != null && !isUiRestricted() && mWifiManager.isWifiEnabled()) {
+ setProgressBarVisible(true);
+ getView().postDelayed(mUpdateAccessPointsRunnable, 300 /* delay milliseconds */);
+ }
+ }
+
+ /** Called when the state of Wifi has changed. */
+ @Override
+ public void onWifiStateChanged(int state) {
if (isUiRestricted()) {
- removeConnectedAccessPointPreference();
- mAccessPointsPreferenceCategory.removeAll();
- if (!isUiRestrictedByOnlyAdmin()) {
- if (wifiState == WifiManager.WIFI_AP_STATE_DISABLED) {
- setOffMessage();
- } else {
- addMessagePreference(R.string.wifi_empty_list_user_restricted);
- }
- }
return;
}
+ final int wifiState = mWifiManager.getWifiState();
switch (wifiState) {
case WifiManager.WIFI_STATE_ENABLED:
- setProgressBarVisible(true);
- // Have the progress bar displayed before starting to modify APs
- getView().postDelayed(mUpdateAccessPointsRunnable, 300 /* delay milliseconds */);
+ updateAccessPointsDelayed();
break;
case WifiManager.WIFI_STATE_ENABLING:
removeConnectedAccessPointPreference();
mAccessPointsPreferenceCategory.removeAll();
+ addMessagePreference(R.string.wifi_starting);
setProgressBarVisible(true);
break;
case WifiManager.WIFI_STATE_DISABLING:
+ removeConnectedAccessPointPreference();
+ mAccessPointsPreferenceCategory.removeAll();
addMessagePreference(R.string.wifi_stopping);
break;
case WifiManager.WIFI_STATE_DISABLED:
setOffMessage();
- setConfigureWifiSettingsVisibility();
setProgressBarVisible(false);
break;
}
}
+ /**
+ * Called when the connection state of wifi has changed and isConnected
+ * should be called to get the updated state.
+ */
+ @Override
+ public void onConnectedChanged() {
+ updateAccessPointsDelayed();
+ changeNextButtonState(mWifiTracker.isConnected());
+ }
+
+
private void updateAccessPointPreferences() {
+ // in case state has changed
+ if (!mWifiManager.isWifiEnabled()) {
+ return;
+ }
// AccessPoints are sorted by the WifiTracker
final List<AccessPoint> accessPoints = mWifiTracker.getAccessPoints();
@@ -796,10 +818,6 @@
}
private void setConfigureWifiSettingsVisibility() {
- if (isUiRestricted()) {
- mAdditionalSettingsPreferenceCategory.removeAll();
- return;
- }
mAdditionalSettingsPreferenceCategory.addPreference(mConfigureWifiSettingsPreference);
boolean wifiWakeupEnabled = Settings.Global.getInt(
getContentResolver(), Settings.Global.WIFI_WAKEUP_ENABLED, 0) == 1;
@@ -824,7 +842,7 @@
// read the system settings directly. Because when the device is in Airplane mode, even if
// Wi-Fi scanning mode is on, WifiManager.isScanAlwaysAvailable() still returns "off".
final ContentResolver resolver = getActivity().getContentResolver();
- final boolean wifiScanningMode = !isUiRestricted() && Settings.Global.getInt(
+ final boolean wifiScanningMode = Settings.Global.getInt(
resolver, Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0) == 1;
if (!wifiScanningMode) {
@@ -858,32 +876,10 @@
protected void setProgressBarVisible(boolean visible) {
if (mProgressHeader != null) {
- mProgressHeader.setVisibility(
- visible && !isUiRestricted() ? View.VISIBLE : View.INVISIBLE);
+ mProgressHeader.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
}
}
- @Override
- public void onWifiStateChanged(int state) {
- switch (state) {
- case WifiManager.WIFI_STATE_ENABLING:
- addMessagePreference(R.string.wifi_starting);
- setProgressBarVisible(true);
- break;
-
- case WifiManager.WIFI_STATE_DISABLED:
- setOffMessage();
- setProgressBarVisible(false);
- break;
- }
- }
-
- @Override
- public void onConnectedChanged() {
- onAccessPointsChanged();
- changeNextButtonState(mWifiTracker.isConnected());
- }
-
/**
* Renames/replaces "Next" button when appropriate. "Next" button usually exists in
* Wifi setup screens, not in usual wifi settings screen.
diff --git a/tests/robotests/src/com/android/settings/applications/AppHeaderControllerTest.java b/tests/robotests/src/com/android/settings/applications/AppHeaderControllerTest.java
index a8c7c65..0d878ed 100644
--- a/tests/robotests/src/com/android/settings/applications/AppHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppHeaderControllerTest.java
@@ -28,6 +28,7 @@
import android.support.v7.preference.Preference;
import android.view.LayoutInflater;
import android.view.View;
+import android.widget.ImageView;
import android.widget.TextView;
import com.android.settings.R;
@@ -276,6 +277,17 @@
.isEqualTo(View.GONE);
}
+ // Ensure that the instant app label does not show up when we haven't told the controller the
+ // app is instant.
+ @Test
+ public void instantApps_normalAppsDontGetInstantAppsBadge() {
+ final View appHeader = mLayoutInflater.inflate(R.layout.app_details, null /* root */);
+ mController = new AppHeaderController(mContext, mFragment, appHeader);
+ mController.done();
+ assertThat(appHeader.findViewById(R.id.app_icon_instant_apps_badge).getVisibility())
+ .isEqualTo(View.GONE);
+ }
+
// Test that the "instant apps" label is present in the header when we have an instant app.
@Test
public void instantApps_expectedHeaderItem() {
@@ -284,6 +296,8 @@
mController.setIsInstantApp(true);
mController.done();
TextView label = (TextView)appHeader.findViewById(R.id.install_type);
+ ImageView badgeView = appHeader.findViewById(R.id.app_icon_instant_apps_badge);
+ assertThat(badgeView.getVisibility()).isEqualTo(View.VISIBLE);
assertThat(label.getVisibility()).isEqualTo(View.VISIBLE);
assertThat(label.getText()).isEqualTo(
appHeader.getResources().getString(R.string.install_type_instant));
diff --git a/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java b/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java
index dfef3b8..aeb3826 100644
--- a/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java
@@ -22,6 +22,7 @@
import android.content.pm.UserInfo;
import android.os.Build;
import android.os.UserHandle;
+import android.os.UserManager;
import com.android.settings.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
@@ -35,7 +36,6 @@
import org.robolectric.shadows.ShadowApplication;
import java.util.Arrays;
-import java.util.List;
import static com.android.settings.testutils.ApplicationTestUtils.buildInfo;
import static com.google.common.truth.Truth.assertThat;
@@ -76,24 +76,25 @@
private final String PERMISSION_2 = "some.permission.2";
private final String[] PERMISSIONS = {PERMISSION_1, PERMISSION_2};
+ @Mock private UserManager mUserManager;
@Mock private Context mContext;
@Mock private PackageManagerWrapper mPackageManager;
@Mock private IPackageManagerWrapper mPackageManagerService;
@Mock private DevicePolicyManagerWrapper mDevicePolicyManager;
- private List<UserInfo> mUsersToCount;
private int mAppCount = -1;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
+ when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
}
- private void verifyCountInstalledAppsAcrossAllUsers(boolean async) throws Exception {
+ private void verifyCountInstalledApps(boolean async) throws Exception {
// There are two users.
- mUsersToCount = Arrays.asList(
+ when(mUserManager.getProfiles(UserHandle.myUserId())).thenReturn(Arrays.asList(
new UserInfo(MAIN_USER_ID, "main", UserInfo.FLAG_ADMIN),
- new UserInfo(MANAGED_PROFILE_ID, "managed profile", 0));
+ new UserInfo(MANAGED_PROFILE_ID, "managed profile", 0)));
// The first user has five apps installed:
// * app1 uses run-time permissions. It has been granted one of the permissions by the
@@ -190,8 +191,8 @@
}
assertThat(mAppCount).isEqualTo(3);
- // Verify that installed packages were retrieved for the users returned by
- // InstalledAppCounterTestable.getUsersToCount() only.
+ // Verify that installed packages were retrieved the current user and the user's managed
+ // profile only.
verify(mPackageManager).getInstalledApplicationsAsUser(anyInt(), eq(MAIN_USER_ID));
verify(mPackageManager).getInstalledApplicationsAsUser(anyInt(),
eq(MANAGED_PROFILE_ID));
@@ -200,13 +201,13 @@
}
@Test
- public void testCountInstalledAppsAcrossAllUsersSync() throws Exception {
- verifyCountInstalledAppsAcrossAllUsers(false /* async */);
+ public void testCountInstalledAppsSync() throws Exception {
+ verifyCountInstalledApps(false /* async */);
}
@Test
- public void testCountInstalledAppsAcrossAllUsersAync() throws Exception {
- verifyCountInstalledAppsAcrossAllUsers(true /* async */);
+ public void testCountInstalledAppsAync() throws Exception {
+ verifyCountInstalledApps(true /* async */);
}
private class AppWithAdminGrantedPermissionsCounterTestable extends
@@ -220,10 +221,5 @@
protected void onCountComplete(int num) {
mAppCount = num;
}
-
- @Override
- protected List<UserInfo> getUsersToCount() {
- return mUsersToCount;
- }
}
}
diff --git a/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
index f946780..f46bb90 100644
--- a/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
@@ -190,7 +190,7 @@
}
private void setUpUsersAndInstalledApps() {
- when(mUserManager.getUsers(true)).thenReturn(Arrays.asList(
+ when(mUserManager.getProfiles(UserHandle.myUserId())).thenReturn(Arrays.asList(
new UserInfo(MAIN_USER_ID, "main", UserInfo.FLAG_ADMIN),
new UserInfo(MANAGED_PROFILE_ID, "managed profile", 0)));
diff --git a/tests/robotests/src/com/android/settings/applications/ExternalSourcesDetailsTest.java b/tests/robotests/src/com/android/settings/applications/ExternalSourcesDetailsTest.java
deleted file mode 100644
index 5b2f8e0..0000000
--- a/tests/robotests/src/com/android/settings/applications/ExternalSourcesDetailsTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2017 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 static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-
-import com.android.settings.R;
-import com.android.settings.SettingsRobolectricTestRunner;
-import com.android.settings.TestConfig;
-import com.android.settingslib.applications.ApplicationsState;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.annotation.Config;
-
-@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
-public class ExternalSourcesDetailsTest {
-
- @Mock
- private Context mContext;
- @Mock
- private AppStateInstallAppsBridge.InstallAppsState mInstallAppsStateAllowed;
- @Mock
- private AppStateInstallAppsBridge.InstallAppsState mInstallAppsStateBlocked;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- when(mInstallAppsStateAllowed.canInstallApps()).thenReturn(true);
- when(mInstallAppsStateBlocked.canInstallApps()).thenReturn(false);
- }
-
- @Test
- public void testGetPreferenceSummary() {
- ApplicationsState.AppEntry appEntry = mock(ApplicationsState.AppEntry.class);
- appEntry.extraInfo = mInstallAppsStateBlocked;
- ExternalSourcesDetails.getPreferenceSummary(mContext, appEntry);
- verify(mContext).getString(R.string.external_source_untrusted);
- appEntry.extraInfo = mInstallAppsStateAllowed;
- ExternalSourcesDetails.getPreferenceSummary(mContext, appEntry);
- verify(mContext).getString(R.string.external_source_trusted);
- }
-}
diff --git a/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java b/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java
index 1134ec5..46a3359 100644
--- a/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java
+++ b/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java
@@ -78,7 +78,6 @@
@Mock private UserManager mUserManager;
@Mock private Context mContext;
@Mock private PackageManagerWrapper mPackageManager;
- private List<UserInfo> mUsersToCount;
private int mInstalledAppCount = -1;
@@ -99,9 +98,9 @@
private void testCountInstalledAppsAcrossAllUsers(boolean async) {
// There are two users.
- mUsersToCount = Arrays.asList(
+ when(mUserManager.getProfiles(UserHandle.myUserId())).thenReturn(Arrays.asList(
new UserInfo(MAIN_USER_ID, "main", UserInfo.FLAG_ADMIN),
- new UserInfo(MANAGED_PROFILE_ID, "managed profile", 0));
+ new UserInfo(MANAGED_PROFILE_ID, "managed profile", 0)));
// The first user has four apps installed:
// * app1 is an updated system app. It should be counted.
@@ -159,8 +158,8 @@
count(InstalledAppCounter.IGNORE_INSTALL_REASON, async);
assertThat(mInstalledAppCount).isEqualTo(5);
- // Verify that installed packages were retrieved for the users returned by
- // InstalledAppCounterTestable.getUsersToCount() only.
+ // Verify that installed packages were retrieved the current user and the user's managed
+ // profile only.
verify(mPackageManager).getInstalledApplicationsAsUser(anyInt(), eq(MAIN_USER_ID));
verify(mPackageManager).getInstalledApplicationsAsUser(anyInt(),
eq(MANAGED_PROFILE_ID));
@@ -205,11 +204,6 @@
protected void onCountComplete(int num) {
mInstalledAppCount = num;
}
-
- @Override
- protected List<UserInfo> getUsersToCount() {
- return mUsersToCount;
- }
}
private static class IsLaunchIntentFor extends ArgumentMatcher<Intent> {
diff --git a/tests/robotests/src/com/android/settings/enterprise/AlwaysOnVpnPrimaryUserPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/AlwaysOnVpnCurrentUserPreferenceControllerTest.java
similarity index 90%
rename from tests/robotests/src/com/android/settings/enterprise/AlwaysOnVpnPrimaryUserPreferenceControllerTest.java
rename to tests/robotests/src/com/android/settings/enterprise/AlwaysOnVpnCurrentUserPreferenceControllerTest.java
index 12fdb4f..9d1bd58 100644
--- a/tests/robotests/src/com/android/settings/enterprise/AlwaysOnVpnPrimaryUserPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/AlwaysOnVpnCurrentUserPreferenceControllerTest.java
@@ -36,11 +36,11 @@
import static org.mockito.Mockito.when;
/**
- * Tests for {@link AlwaysOnVpnPrimaryUserPreferenceController}.
+ * Tests for {@link AlwaysOnVpnCurrentUserPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
-public final class AlwaysOnVpnPrimaryUserPreferenceControllerTest {
+public final class AlwaysOnVpnCurrentUserPreferenceControllerTest {
private final String VPN_SET_DEVICE = "VPN set";
private final String VPN_SET_PERSONAL = "VPN set in personal profile";
@@ -49,14 +49,14 @@
private Context mContext;
private FakeFeatureFactory mFeatureFactory;
- private AlwaysOnVpnPrimaryUserPreferenceController mController;
+ private AlwaysOnVpnCurrentUserPreferenceController mController;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
FakeFeatureFactory.setupForTest(mContext);
mFeatureFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mContext);
- mController = new AlwaysOnVpnPrimaryUserPreferenceController(mContext,
+ mController = new AlwaysOnVpnCurrentUserPreferenceController(mContext,
null /* lifecycle */);
when(mContext.getString(R.string.enterprise_privacy_always_on_vpn_device))
.thenReturn(VPN_SET_DEVICE);
@@ -68,7 +68,7 @@
public void testUpdateState() {
final Preference preference = new Preference(mContext, null, 0, 0);
- when(mFeatureFactory.enterprisePrivacyFeatureProvider.isAlwaysOnVpnSetInPrimaryUser())
+ when(mFeatureFactory.enterprisePrivacyFeatureProvider.isAlwaysOnVpnSetInCurrentUser())
.thenReturn(true);
when(mFeatureFactory.enterprisePrivacyFeatureProvider.isInCompMode()).thenReturn(false);
@@ -82,11 +82,11 @@
@Test
public void testIsAvailable() {
- when(mFeatureFactory.enterprisePrivacyFeatureProvider.isAlwaysOnVpnSetInPrimaryUser())
+ when(mFeatureFactory.enterprisePrivacyFeatureProvider.isAlwaysOnVpnSetInCurrentUser())
.thenReturn(false);
assertThat(mController.isAvailable()).isFalse();
- when(mFeatureFactory.enterprisePrivacyFeatureProvider.isAlwaysOnVpnSetInPrimaryUser())
+ when(mFeatureFactory.enterprisePrivacyFeatureProvider.isAlwaysOnVpnSetInCurrentUser())
.thenReturn(true);
assertThat(mController.isAvailable()).isTrue();
}
diff --git a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java
index 8d78ef7..5e46216 100644
--- a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java
@@ -195,13 +195,13 @@
}
@Test
- public void testIsAlwaysOnVpnSetInPrimaryUser() {
+ public void testIsAlwaysOnVpnSetInCurrentUser() {
when(mConnectivityManger.getAlwaysOnVpnPackageForUser(MY_USER_ID)).thenReturn(null);
- assertThat(mProvider.isAlwaysOnVpnSetInPrimaryUser()).isFalse();
+ assertThat(mProvider.isAlwaysOnVpnSetInCurrentUser()).isFalse();
when(mConnectivityManger.getAlwaysOnVpnPackageForUser(MY_USER_ID))
.thenReturn(VPN_PACKAGE_ID);
- assertThat(mProvider.isAlwaysOnVpnSetInPrimaryUser()).isTrue();
+ assertThat(mProvider.isAlwaysOnVpnSetInCurrentUser()).isTrue();
}
@Test
@@ -230,16 +230,14 @@
}
@Test
- public void testGetMaximumFailedPasswordsForWipeInPrimaryUser() {
- when(mDevicePolicyManager.getDeviceOwnerComponentOnAnyUser()).thenReturn(null);
- when(mDevicePolicyManager.getDeviceOwnerUserId()).thenReturn(UserHandle.USER_NULL);
- assertThat(mProvider.getMaximumFailedPasswordsBeforeWipeInPrimaryUser()).isEqualTo(0);
-
- when(mDevicePolicyManager.getDeviceOwnerComponentOnAnyUser()).thenReturn(OWNER);
- when(mDevicePolicyManager.getDeviceOwnerUserId()).thenReturn(UserHandle.USER_SYSTEM);
- when(mDevicePolicyManager.getMaximumFailedPasswordsForWipe(OWNER, UserHandle.USER_SYSTEM))
+ public void testGetMaximumFailedPasswordsForWipeInCurrentUser() {
+ when(mDevicePolicyManager.getProfileOwnerAsUser(MY_USER_ID)).thenReturn(null);
+ when(mDevicePolicyManager.getMaximumFailedPasswordsForWipe(OWNER, MY_USER_ID))
.thenReturn(10);
- assertThat(mProvider.getMaximumFailedPasswordsBeforeWipeInPrimaryUser()).isEqualTo(10);
+ assertThat(mProvider.getMaximumFailedPasswordsBeforeWipeInCurrentUser()).isEqualTo(0);
+
+ when(mDevicePolicyManager.getProfileOwnerAsUser(MY_USER_ID)).thenReturn(OWNER);
+ assertThat(mProvider.getMaximumFailedPasswordsBeforeWipeInCurrentUser()).isEqualTo(10);
}
@Test
@@ -247,7 +245,6 @@
when(mDevicePolicyManager.getProfileOwnerAsUser(MANAGED_PROFILE_USER_ID)).thenReturn(OWNER);
when(mDevicePolicyManager.getMaximumFailedPasswordsForWipe(OWNER, MANAGED_PROFILE_USER_ID))
.thenReturn(10);
-
assertThat(mProvider.getMaximumFailedPasswordsBeforeWipeInManagedProfile()).isEqualTo(0);
mProfiles.add(new UserInfo(MANAGED_PROFILE_USER_ID, "", "", UserInfo.FLAG_MANAGED_PROFILE));
diff --git a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java
index 2225687..d41be75 100644
--- a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java
@@ -134,7 +134,7 @@
assertThat(controllers.get(position++)).isInstanceOf(
EnterpriseSetDefaultAppsPreferenceController.class);
assertThat(controllers.get(position++)).isInstanceOf(
- AlwaysOnVpnPrimaryUserPreferenceController.class);
+ AlwaysOnVpnCurrentUserPreferenceController.class);
assertThat(controllers.get(position++)).isInstanceOf(
AlwaysOnVpnManagedProfilePreferenceController.class);
assertThat(controllers.get(position++)).isInstanceOf(
@@ -142,7 +142,7 @@
assertThat(controllers.get(position++)).isInstanceOf(
CaCertsPreferenceController.class);
assertThat(controllers.get(position++)).isInstanceOf(
- FailedPasswordWipePrimaryUserPreferenceController.class);
+ FailedPasswordWipeCurrentUserPreferenceController.class);
assertThat(controllers.get(position++)).isInstanceOf(
FailedPasswordWipeManagedProfilePreferenceController.class);
assertThat(controllers.get(position++)).isInstanceOf(ImePreferenceController.class);
diff --git a/tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipePrimaryUserPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipeCurrentUserPreferenceControllerTest.java
similarity index 80%
rename from tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipePrimaryUserPreferenceControllerTest.java
rename to tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipeCurrentUserPreferenceControllerTest.java
index d74b9b8..b2f4fa7 100644
--- a/tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipePrimaryUserPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipeCurrentUserPreferenceControllerTest.java
@@ -27,29 +27,29 @@
import static org.mockito.Mockito.when;
/**
- * Tests for {@link FailedPasswordWipePrimaryUserPreferenceController}.
+ * Tests for {@link FailedPasswordWipeCurrentUserPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
-public final class FailedPasswordWipePrimaryUserPreferenceControllerTest extends
+public final class FailedPasswordWipeCurrentUserPreferenceControllerTest extends
FailedPasswordWipePreferenceControllerTestBase {
private int mMaximumFailedPasswordsBeforeWipe = 0;
- public FailedPasswordWipePrimaryUserPreferenceControllerTest() {
- super("failed_password_wipe_primary_user");
+ public FailedPasswordWipeCurrentUserPreferenceControllerTest() {
+ super("failed_password_wipe_current_user");
}
@Override
public void setUp() {
super.setUp();
- mController = new FailedPasswordWipePrimaryUserPreferenceController(mContext,
+ mController = new FailedPasswordWipeCurrentUserPreferenceController(mContext,
null /* lifecycle */);
}
@Override
public void setMaximumFailedPasswordsBeforeWipe(int maximum) {
when(mFeatureFactory.enterprisePrivacyFeatureProvider
- .getMaximumFailedPasswordsBeforeWipeInPrimaryUser()).thenReturn(maximum);
+ .getMaximumFailedPasswordsBeforeWipeInCurrentUser()).thenReturn(maximum);
}
}