Merge "Hide Camera background running time in the battery usage screen" into sc-dev
diff --git a/src/com/android/settings/biometrics/combination/BiometricSettingsAppPreferenceController.java b/src/com/android/settings/biometrics/combination/BiometricSettingsAppPreferenceController.java
index 861ff27..2da8164 100644
--- a/src/com/android/settings/biometrics/combination/BiometricSettingsAppPreferenceController.java
+++ b/src/com/android/settings/biometrics/combination/BiometricSettingsAppPreferenceController.java
@@ -86,4 +86,9 @@
             return AVAILABLE_UNSEARCHABLE;
         }
     }
+
+    @Override
+    public final boolean isSliceable() {
+        return false;
+    }
 }
diff --git a/src/com/android/settings/biometrics/combination/BiometricSettingsKeyguardPreferenceController.java b/src/com/android/settings/biometrics/combination/BiometricSettingsKeyguardPreferenceController.java
index 6fe651f..f6f2d5f 100644
--- a/src/com/android/settings/biometrics/combination/BiometricSettingsKeyguardPreferenceController.java
+++ b/src/com/android/settings/biometrics/combination/BiometricSettingsKeyguardPreferenceController.java
@@ -68,4 +68,9 @@
         }
         return getRestrictingAdmin() != null ? DISABLED_FOR_USER : AVAILABLE;
     }
+
+    @Override
+    public final boolean isSliceable() {
+        return false;
+    }
 }
diff --git a/src/com/android/settings/biometrics/face/FaceSettings.java b/src/com/android/settings/biometrics/face/FaceSettings.java
index 140a3fc..62347ac 100644
--- a/src/com/android/settings/biometrics/face/FaceSettings.java
+++ b/src/com/android/settings/biometrics/face/FaceSettings.java
@@ -44,7 +44,6 @@
 import com.android.settings.password.ChooseLockSettingsHelper;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settingslib.core.AbstractPreferenceController;
-import com.android.settingslib.core.lifecycle.Lifecycle;
 import com.android.settingslib.search.SearchIndexable;
 
 import java.util.ArrayList;
@@ -290,7 +289,7 @@
         if (!isFaceHardwareDetected(context)) {
             return null;
         }
-        mControllers = buildPreferenceControllers(context, getSettingsLifecycle());
+        mControllers = buildPreferenceControllers(context);
         // There's no great way of doing this right now :/
         for (AbstractPreferenceController controller : mControllers) {
             if (controller instanceof FaceSettingsAttentionPreferenceController) {
@@ -309,8 +308,7 @@
         return mControllers;
     }
 
-    private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
-            Lifecycle lifecycle) {
+    private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
         final List<AbstractPreferenceController> controllers = new ArrayList<>();
         controllers.add(new FaceSettingsKeyguardPreferenceController(context));
         controllers.add(new FaceSettingsAppPreferenceController(context));
@@ -328,7 +326,7 @@
                 public List<AbstractPreferenceController> createPreferenceControllers(
                         Context context) {
                     if (isFaceHardwareDetected(context)) {
-                        return buildPreferenceControllers(context, null /* lifecycle */);
+                        return buildPreferenceControllers(context);
                     } else {
                         return null;
                     }
diff --git a/src/com/android/settings/biometrics/face/FaceSettingsAttentionPreferenceController.java b/src/com/android/settings/biometrics/face/FaceSettingsAttentionPreferenceController.java
index 0eb823b..82fa00b 100644
--- a/src/com/android/settings/biometrics/face/FaceSettingsAttentionPreferenceController.java
+++ b/src/com/android/settings/biometrics/face/FaceSettingsAttentionPreferenceController.java
@@ -117,11 +117,6 @@
     }
 
     @Override
-    public boolean isSliceable() {
-        return false;
-    }
-
-    @Override
     public int getAvailabilityStatus() {
         return AVAILABLE;
     }
diff --git a/src/com/android/settings/biometrics/face/FaceSettingsPreferenceController.java b/src/com/android/settings/biometrics/face/FaceSettingsPreferenceController.java
index 3149c35..36984a2 100644
--- a/src/com/android/settings/biometrics/face/FaceSettingsPreferenceController.java
+++ b/src/com/android/settings/biometrics/face/FaceSettingsPreferenceController.java
@@ -46,4 +46,9 @@
         return RestrictedLockUtilsInternal.checkIfKeyguardFeaturesDisabled(
                 mContext, DevicePolicyManager.KEYGUARD_DISABLE_FACE, mUserId);
     }
+
+    @Override
+    public final boolean isSliceable() {
+        return false;
+    }
 }
diff --git a/tests/unit/src/com/android/settings/biometrics/combination/BiometricSettingsAppPreferenceControllerTest.java b/tests/unit/src/com/android/settings/biometrics/combination/BiometricSettingsAppPreferenceControllerTest.java
new file mode 100644
index 0000000..f66e65f
--- /dev/null
+++ b/tests/unit/src/com/android/settings/biometrics/combination/BiometricSettingsAppPreferenceControllerTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 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.biometrics.combination;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import androidx.test.core.app.ApplicationProvider;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class BiometricSettingsAppPreferenceControllerTest {
+
+    private Context mContext;
+    private BiometricSettingsAppPreferenceController mController;
+
+    @Before
+    public void setUp() {
+        mContext = ApplicationProvider.getApplicationContext();
+        mController = new BiometricSettingsAppPreferenceController(mContext, "key");
+    }
+
+    @Test
+    public void isSliceable_returnFalse() {
+        assertThat(mController.isSliceable()).isFalse();
+    }
+}
diff --git a/tests/unit/src/com/android/settings/biometrics/combination/BiometricSettingsKeyguardPreferenceControllerTest.java b/tests/unit/src/com/android/settings/biometrics/combination/BiometricSettingsKeyguardPreferenceControllerTest.java
new file mode 100644
index 0000000..400b4fe
--- /dev/null
+++ b/tests/unit/src/com/android/settings/biometrics/combination/BiometricSettingsKeyguardPreferenceControllerTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 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.biometrics.combination;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import androidx.test.core.app.ApplicationProvider;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class BiometricSettingsKeyguardPreferenceControllerTest {
+
+    private Context mContext;
+    private BiometricSettingsKeyguardPreferenceController mController;
+
+    @Before
+    public void setUp() {
+        mContext = ApplicationProvider.getApplicationContext();
+        mController = new BiometricSettingsKeyguardPreferenceController(mContext, "key");
+    }
+
+    @Test
+    public void isSliceable_returnFalse() {
+        assertThat(mController.isSliceable()).isFalse();
+    }
+}
diff --git a/tests/unit/src/com/android/settings/biometrics/face/FaceSettingsAppPreferenceControllerTest.java b/tests/unit/src/com/android/settings/biometrics/face/FaceSettingsAppPreferenceControllerTest.java
new file mode 100644
index 0000000..af45a68
--- /dev/null
+++ b/tests/unit/src/com/android/settings/biometrics/face/FaceSettingsAppPreferenceControllerTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 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.biometrics.face;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import androidx.test.core.app.ApplicationProvider;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class FaceSettingsAppPreferenceControllerTest {
+
+    private Context mContext;
+    private FaceSettingsAppPreferenceController mController;
+
+    @Before
+    public void setUp() {
+        mContext = ApplicationProvider.getApplicationContext();
+        mController = new FaceSettingsAppPreferenceController(mContext);
+    }
+
+    @Test
+    public void isSliceable_returnFalse() {
+        assertThat(mController.isSliceable()).isFalse();
+    }
+}
diff --git a/tests/unit/src/com/android/settings/biometrics/face/FaceSettingsConfirmPreferenceControllerTest.java b/tests/unit/src/com/android/settings/biometrics/face/FaceSettingsConfirmPreferenceControllerTest.java
new file mode 100644
index 0000000..6782959
--- /dev/null
+++ b/tests/unit/src/com/android/settings/biometrics/face/FaceSettingsConfirmPreferenceControllerTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 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.biometrics.face;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import androidx.test.core.app.ApplicationProvider;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class FaceSettingsConfirmPreferenceControllerTest {
+
+    private Context mContext;
+    private FaceSettingsConfirmPreferenceController mController;
+
+    @Before
+    public void setUp() {
+        mContext = ApplicationProvider.getApplicationContext();
+        mController = new FaceSettingsConfirmPreferenceController(mContext);
+    }
+
+    @Test
+    public void isSliceable_returnFalse() {
+        assertThat(mController.isSliceable()).isFalse();
+    }
+}
diff --git a/tests/unit/src/com/android/settings/biometrics/face/FaceSettingsKeyguardPreferenceControllerTest.java b/tests/unit/src/com/android/settings/biometrics/face/FaceSettingsKeyguardPreferenceControllerTest.java
new file mode 100644
index 0000000..ee62ed7
--- /dev/null
+++ b/tests/unit/src/com/android/settings/biometrics/face/FaceSettingsKeyguardPreferenceControllerTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2021 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.biometrics.face;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import androidx.test.core.app.ApplicationProvider;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class FaceSettingsKeyguardPreferenceControllerTest {
+    private Context mContext;
+    private FaceSettingsKeyguardPreferenceController mController;
+
+    @Before
+    public void setUp() {
+        mContext = ApplicationProvider.getApplicationContext();
+        mController = new FaceSettingsKeyguardPreferenceController(mContext);
+    }
+
+    @Test
+    public void isSliceable_returnFalse() {
+        assertThat(mController.isSliceable()).isFalse();
+    }
+}