Add enabled keyboard preferences
Bug: 110432001
Test: Robolectric
Change-Id: I55bbf9acfe409063b0fecc6c1c7c2b7d1d3bf128
(cherry picked from commit b23f2787b6ec04e2e5311761689cb63b1c38273a)
diff --git a/tests/robotests/src/com/android/car/settings/testutils/ShadowDevicePolicyManager.java b/tests/robotests/src/com/android/car/settings/testutils/ShadowDevicePolicyManager.java
new file mode 100644
index 0000000..85248af
--- /dev/null
+++ b/tests/robotests/src/com/android/car/settings/testutils/ShadowDevicePolicyManager.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2019 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.car.settings.testutils;
+
+import android.annotation.Nullable;
+import android.app.admin.DevicePolicyManager;
+
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+import org.robolectric.annotation.Resetter;
+
+import java.util.List;
+
+@Implements(value = DevicePolicyManager.class)
+public class ShadowDevicePolicyManager extends org.robolectric.shadows.ShadowDevicePolicyManager {
+ @Nullable
+ private static List<String> sPermittedInputMethods;
+
+ @Implementation
+ @Nullable
+ protected List<String> getPermittedInputMethodsForCurrentUser() {
+ return sPermittedInputMethods;
+ }
+
+ public static void setPermittedInputMethodsForCurrentUser(@Nullable List<String> inputMethods) {
+ sPermittedInputMethods = inputMethods;
+ }
+
+ @Resetter
+ public static void reset() {
+ sPermittedInputMethods = null;
+ }
+}