Merge "Plumb remove functionality through"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6aacb0a..188ba6e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -798,6 +798,17 @@
<string name="lockdown_settings_title">Show lockdown option</string>
<!-- Text shown for the description of the lockdown option -->
<string name="lockdown_settings_summary">Display power button option that turns off Smart Lock, fingerprint unlocking, and notifications on the lock screen</string>
+
+ <!-- Text shown for the title of the extend unlock mode option for trust agents [CHAR LIMIT=40] -->
+ <string name="trust_agents_extend_unlock_title">SmartLock only extends unlock</string>
+ <!-- Text shown for the description of the extend unlock mode option [CHAR LIMIT=NONE] -->
+ <string name="trust_agents_extend_unlock_summary">If enabled, SmartLock will keep your device unlocked for longer, but can no longer unlock a locked device.</string>
+
+ <!-- Text shown for the title of the lock when trust lost option [CHAR LIMIT=40] -->
+ <string name="trust_lost_locks_screen_title">Lock screen when trust is lost</string>
+ <!-- Text shown for the description of the lock when trust lost option [CHAR LIMIT=NONE -->
+ <string name="trust_lost_locks_screen_summary">If enabled, the device will lock when the last trust agent loses trust</string>
+
<!-- Text shown for summary of owner info setting (if none set) [CHAR LIMIT=40]-->
<string name="owner_info_settings_summary">None</string>
<!-- Description of how many characters are used in owner info [CHAR LIMIT=40]-->
diff --git a/res/xml/screen_lock_settings.xml b/res/xml/screen_lock_settings.xml
index 43f96e9..29c8de9 100644
--- a/res/xml/screen_lock_settings.xml
+++ b/res/xml/screen_lock_settings.xml
@@ -40,4 +40,17 @@
android:key="power_button_instantly_locks"
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks" />
-</PreferenceScreen>
\ No newline at end of file
+ <!-- Temporarily available to evaluate extend unlock mode for SmartLock -->
+ <SwitchPreference
+ android:key="security_setting_trust_agents_extend_unlock"
+ android:title="@string/trust_agents_extend_unlock_title"
+ android:summary="@string/trust_agents_extend_unlock_summary"
+ settings:controller="com.android.settings.security.trustagent.TrustAgentsExtendUnlockPreferenceController" />
+
+ <SwitchPreference
+ android:key="security_setting_trust_lost_locks_screen"
+ android:title="@string/trust_lost_locks_screen_title"
+ android:summary="@string/trust_lost_locks_screen_summary"
+ settings:controller="com.android.settings.security.trustagent.TrustLostLocksScreenPreferenceController" />
+
+</PreferenceScreen>
diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java
index c2db019..5669b4c 100644
--- a/src/com/android/settings/applications/manageapplications/ManageApplications.java
+++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java
@@ -817,13 +817,12 @@
mManageApplications.onItemSelected(null, null, 0, 0);
}
if (mFilterOptions.size() > 1) {
- if (filterType == mManageApplications.mFilterType) {
- int index = mFilterOptions.indexOf(filter);
- if (index != -1) {
- mManageApplications.mFilterSpinner.setSelection(index);
- mManageApplications.onItemSelected(null, null, index, 0);
- mManageApplications.mFilterType = AppFilterRegistry.FILTER_APPS_ALL;
- }
+ final AppFilterItem previousFilter = AppFilterRegistry.getInstance().get(
+ mManageApplications.mFilterType);
+ final int index = mFilterOptions.indexOf(previousFilter);
+ if (index != -1) {
+ mManageApplications.mFilterSpinner.setSelection(index);
+ mManageApplications.onItemSelected(null, null, index, 0);
}
}
}
diff --git a/src/com/android/settings/location/ScanningSettings.java b/src/com/android/settings/location/ScanningSettings.java
index b2ce5fb..86402c0 100644
--- a/src/com/android/settings/location/ScanningSettings.java
+++ b/src/com/android/settings/location/ScanningSettings.java
@@ -34,7 +34,7 @@
/**
* A page that configures the background scanning settings for Wi-Fi and Bluetooth.
*/
-@SearchIndexable
+@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class ScanningSettings extends DashboardFragment {
private static final String TAG = "ScanningSettings";
diff --git a/src/com/android/settings/security/trustagent/TrustAgentsExtendUnlockPreferenceController.java b/src/com/android/settings/security/trustagent/TrustAgentsExtendUnlockPreferenceController.java
new file mode 100644
index 0000000..bfbebaf
--- /dev/null
+++ b/src/com/android/settings/security/trustagent/TrustAgentsExtendUnlockPreferenceController.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2018 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.security.trustagent;
+
+import android.content.Context;
+import android.os.UserHandle;
+import android.provider.Settings;
+
+import com.android.settings.core.TogglePreferenceController;
+
+public class TrustAgentsExtendUnlockPreferenceController extends TogglePreferenceController {
+
+ public TrustAgentsExtendUnlockPreferenceController(Context context, String key) {
+ super(context, key);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return AVAILABLE;
+ }
+
+ @Override
+ public boolean isChecked() {
+ return Settings.Secure.getInt(mContext.getContentResolver(),
+ Settings.Secure.TRUST_AGENTS_EXTEND_UNLOCK, 1) == 1;
+ }
+
+ @Override
+ public boolean setChecked(boolean isChecked) {
+ Settings.Secure.putInt(mContext.getContentResolver(),
+ Settings.Secure.TRUST_AGENTS_EXTEND_UNLOCK, isChecked ? 1 : 0);
+ return true;
+ }
+}
diff --git a/src/com/android/settings/security/trustagent/TrustLostLocksScreenPreferenceController.java b/src/com/android/settings/security/trustagent/TrustLostLocksScreenPreferenceController.java
new file mode 100644
index 0000000..b5e0dd7
--- /dev/null
+++ b/src/com/android/settings/security/trustagent/TrustLostLocksScreenPreferenceController.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2018 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.security.trustagent;
+
+import android.content.Context;
+import android.os.UserHandle;
+import android.provider.Settings;
+
+import com.android.settings.core.TogglePreferenceController;
+
+public class TrustLostLocksScreenPreferenceController extends TogglePreferenceController {
+
+ public TrustLostLocksScreenPreferenceController(Context context, String key) {
+ super(context, key);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return AVAILABLE;
+ }
+
+ @Override
+ public boolean isChecked() {
+ return Settings.Secure.getInt(mContext.getContentResolver(),
+ Settings.Secure.LOCK_SCREEN_WHEN_TRUST_LOST, 1) == 1;
+ }
+
+ @Override
+ public boolean setChecked(boolean isChecked) {
+ Settings.Secure.putInt(mContext.getContentResolver(),
+ Settings.Secure.LOCK_SCREEN_WHEN_TRUST_LOST, isChecked ? 1 : 0);
+ return true;
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/SetupWizardUtilsTest.java b/tests/robotests/src/com/android/settings/SetupWizardUtilsTest.java
index 5136973..6007791 100644
--- a/tests/robotests/src/com/android/settings/SetupWizardUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/SetupWizardUtilsTest.java
@@ -21,8 +21,6 @@
import android.content.Intent;
import android.os.SystemProperties;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
-
import com.google.android.setupcompat.util.WizardManagerHelper;
import com.google.android.setupdesign.util.ThemeHelper;
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/RolesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/RolesPreferenceControllerTest.java
index 0946f37..5bf2b7e 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/RolesPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/RolesPreferenceControllerTest.java
@@ -32,7 +32,6 @@
import androidx.preference.Preference;
import com.android.settings.core.BasePreferenceController;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Before;
import org.junit.Test;
@@ -40,8 +39,9 @@
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
-@RunWith(SettingsRobolectricTestRunner.class)
+@RunWith(RobolectricTestRunner.class)
public class RolesPreferenceControllerTest {
private static final String PREFERENCE_KEY = "roles";
diff --git a/tests/robotests/src/com/android/settings/testutils/SettingsRobolectricTestRunner.java b/tests/robotests/src/com/android/settings/testutils/SettingsRobolectricTestRunner.java
deleted file mode 100644
index 0828cc7..0000000
--- a/tests/robotests/src/com/android/settings/testutils/SettingsRobolectricTestRunner.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2018 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.testutils;
-
-import org.junit.runners.model.InitializationError;
-import org.robolectric.RobolectricTestRunner;
-
-public class SettingsRobolectricTestRunner extends RobolectricTestRunner {
-
- public SettingsRobolectricTestRunner(Class<?> testClass) throws InitializationError {
- super(testClass);
- }
-}
diff --git a/tests/robotests/src/com/android/settings/wifi/ButtonPreferenceTest.java b/tests/robotests/src/com/android/settings/wifi/ButtonPreferenceTest.java
index 3dc109f..7f0598d 100644
--- a/tests/robotests/src/com/android/settings/wifi/ButtonPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/ButtonPreferenceTest.java
@@ -22,18 +22,18 @@
import android.view.View;
import android.widget.ImageButton;
-import com.android.settings.R;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
-
import androidx.preference.PreferenceViewHolder;
+import com.android.settings.R;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
-@RunWith(SettingsRobolectricTestRunner.class)
+@RunWith(RobolectricTestRunner.class)
public class ButtonPreferenceTest {
private Context mContext;