summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vaibhav Devmurari <vdevmurari@google.com> 2025-01-23 15:55:23 +0000
committer Vaibhav Devmurari <vdevmurari@google.com> 2025-02-01 02:45:38 -0800
commit0bf314209a7dcf0063d480d95295e097296302de (patch)
tree56795c6a8796c5911bb173fa33feb57f34a12abe
parent81f32c32d30b95db5e62da10b83c9a4bf7bc305a (diff)
Flag cleanup: keyboard_layout_preview_flag
Test: atest KeyboardLayoutPreviewScreenhotTests Test: atest KeyboardLayoutPreviewTests Bug: 293579375 Flag: EXEMPT cleanup Change-Id: I21c3b62fe5491c71324dde617b4932e810ac1507
-rw-r--r--core/java/android/hardware/input/InputManager.java4
-rw-r--r--core/java/android/hardware/input/input_framework.aconfig8
-rw-r--r--core/tests/coretests/src/android/hardware/input/InputFlagsTest.java51
-rw-r--r--core/tests/coretests/src/android/hardware/input/OWNERS2
-rw-r--r--tests/Input/src/android/hardware/input/KeyboardLayoutPreviewTests.kt16
-rw-r--r--tests/InputScreenshotTest/src/android/input/screenshot/KeyboardLayoutPreviewAnsiScreenshotTest.kt10
-rw-r--r--tests/InputScreenshotTest/src/android/input/screenshot/KeyboardLayoutPreviewIsoScreenshotTest.kt13
-rw-r--r--tests/InputScreenshotTest/src/android/input/screenshot/KeyboardLayoutPreviewJisScreenshotTest.kt10
8 files changed, 3 insertions, 111 deletions
diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java
index cf41e138047a..ae027eec16e2 100644
--- a/core/java/android/hardware/input/InputManager.java
+++ b/core/java/android/hardware/input/InputManager.java
@@ -19,7 +19,6 @@ package android.hardware.input;
import static com.android.input.flags.Flags.FLAG_INPUT_DEVICE_VIEW_BEHAVIOR_API;
import static com.android.input.flags.Flags.FLAG_DEVICE_ASSOCIATIONS;
import static com.android.hardware.input.Flags.enableCustomizableInputGestures;
-import static com.android.hardware.input.Flags.keyboardLayoutPreviewFlag;
import static com.android.hardware.input.Flags.keyboardGlyphMap;
import android.Manifest;
@@ -966,9 +965,6 @@ public final class InputManager {
@Nullable
public Drawable getKeyboardLayoutPreview(@Nullable KeyboardLayout keyboardLayout, int width,
int height) {
- if (!keyboardLayoutPreviewFlag()) {
- return null;
- }
PhysicalKeyLayout keyLayout = new PhysicalKeyLayout(
mGlobal.getKeyCharacterMap(keyboardLayout), keyboardLayout);
return new KeyboardLayoutPreviewDrawable(mContext, keyLayout, width, height);
diff --git a/core/java/android/hardware/input/input_framework.aconfig b/core/java/android/hardware/input/input_framework.aconfig
index 23722ed5bb0d..09608ed602db 100644
--- a/core/java/android/hardware/input/input_framework.aconfig
+++ b/core/java/android/hardware/input/input_framework.aconfig
@@ -8,14 +8,6 @@ container: "system"
flag {
namespace: "input_native"
- name: "keyboard_layout_preview_flag"
- description: "Controls whether a preview will be shown in Settings when selecting a physical keyboard layout"
- bug: "293579375"
-}
-
-
-flag {
- namespace: "input_native"
name: "keyboard_a11y_sticky_keys_flag"
description: "Controls if the sticky keys accessibility feature for physical keyboard is available to the user"
bug: "294546335"
diff --git a/core/tests/coretests/src/android/hardware/input/InputFlagsTest.java b/core/tests/coretests/src/android/hardware/input/InputFlagsTest.java
deleted file mode 100644
index b4f1deebd796..000000000000
--- a/core/tests/coretests/src/android/hardware/input/InputFlagsTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2023 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 android.hardware.input;
-
-import static com.android.hardware.input.Flags.keyboardA11yStickyKeysFlag;
-import static com.android.hardware.input.Flags.keyboardLayoutPreviewFlag;
-
-import android.platform.test.annotations.Presubmit;
-
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-import androidx.test.filters.SmallTest;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * Tests for {@link com.android.hardware.input.Flags}
- *
- * Build/Install/Run:
- * atest FrameworksCoreTests:InputFlagsTest
- */
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-@Presubmit
-public class InputFlagsTest {
-
- /**
- * Test that the flags work
- */
- @Test
- public void testFlags() {
- // No crash when accessing the flag.
- keyboardLayoutPreviewFlag();
- keyboardA11yStickyKeysFlag();
- }
-}
-
diff --git a/core/tests/coretests/src/android/hardware/input/OWNERS b/core/tests/coretests/src/android/hardware/input/OWNERS
deleted file mode 100644
index 3f8a6022e9eb..000000000000
--- a/core/tests/coretests/src/android/hardware/input/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-include /core/java/android/hardware/input/OWNERS
-
diff --git a/tests/Input/src/android/hardware/input/KeyboardLayoutPreviewTests.kt b/tests/Input/src/android/hardware/input/KeyboardLayoutPreviewTests.kt
index ae32bdaf80d7..bcff2fcfca93 100644
--- a/tests/Input/src/android/hardware/input/KeyboardLayoutPreviewTests.kt
+++ b/tests/Input/src/android/hardware/input/KeyboardLayoutPreviewTests.kt
@@ -16,17 +16,11 @@
package android.hardware.input
-import android.platform.test.annotations.DisableFlags
-import android.platform.test.annotations.EnableFlags
import android.content.ContextWrapper
import android.graphics.drawable.Drawable
import android.platform.test.annotations.Presubmit
-import android.platform.test.flag.junit.SetFlagsRule
import androidx.test.platform.app.InstrumentationRegistry
-import com.android.hardware.input.Flags
import org.junit.Assert.assertEquals
-import org.junit.Assert.assertNull
-import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.junit.MockitoJUnitRunner
@@ -46,9 +40,6 @@ class KeyboardLayoutPreviewTests {
const val HEIGHT = 100
}
- @get:Rule
- val setFlagsRule = SetFlagsRule()
-
private fun createDrawable(): Drawable? {
val context = ContextWrapper(InstrumentationRegistry.getInstrumentation().getContext())
val inputManager = context.getSystemService(InputManager::class.java)!!
@@ -56,16 +47,9 @@ class KeyboardLayoutPreviewTests {
}
@Test
- @EnableFlags(Flags.FLAG_KEYBOARD_LAYOUT_PREVIEW_FLAG)
fun testKeyboardLayoutDrawable_hasCorrectDimensions() {
val drawable = createDrawable()!!
assertEquals(WIDTH, drawable.intrinsicWidth)
assertEquals(HEIGHT, drawable.intrinsicHeight)
}
-
- @Test
- @DisableFlags(Flags.FLAG_KEYBOARD_LAYOUT_PREVIEW_FLAG)
- fun testKeyboardLayoutDrawable_isNull_ifFlagOff() {
- assertNull(createDrawable())
- }
} \ No newline at end of file
diff --git a/tests/InputScreenshotTest/src/android/input/screenshot/KeyboardLayoutPreviewAnsiScreenshotTest.kt b/tests/InputScreenshotTest/src/android/input/screenshot/KeyboardLayoutPreviewAnsiScreenshotTest.kt
index e85578663764..e1294b1f034e 100644
--- a/tests/InputScreenshotTest/src/android/input/screenshot/KeyboardLayoutPreviewAnsiScreenshotTest.kt
+++ b/tests/InputScreenshotTest/src/android/input/screenshot/KeyboardLayoutPreviewAnsiScreenshotTest.kt
@@ -19,12 +19,9 @@ package com.android.input.screenshot
import android.content.Context
import android.hardware.input.KeyboardLayout
import android.os.LocaleList
-import android.platform.test.flag.junit.SetFlagsRule
-import com.android.hardware.input.Flags
import java.util.Locale
import org.junit.Rule
import org.junit.Test
-import org.junit.rules.RuleChain
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import platform.test.screenshot.DeviceEmulationSpec
@@ -38,18 +35,14 @@ class KeyboardLayoutPreviewAnsiScreenshotTest(emulationSpec: DeviceEmulationSpec
fun getTestSpecs() = DeviceEmulationSpec.PhoneMinimal
}
- val setFlagsRule = SetFlagsRule()
+ @get:Rule
val screenshotRule = InputScreenshotTestRule(
emulationSpec,
"frameworks/base/tests/InputScreenshotTest/assets"
)
- @get:Rule
- val ruleChain = RuleChain.outerRule(screenshotRule).around(setFlagsRule)
-
@Test
fun test() {
- setFlagsRule.enableFlags(Flags.FLAG_KEYBOARD_LAYOUT_PREVIEW_FLAG)
screenshotRule.screenshotTest("layout-preview-ansi") {
context: Context -> LayoutPreview.createLayoutPreview(
context,
@@ -66,5 +59,4 @@ class KeyboardLayoutPreviewAnsiScreenshotTest(emulationSpec: DeviceEmulationSpec
)
}
}
-
} \ No newline at end of file
diff --git a/tests/InputScreenshotTest/src/android/input/screenshot/KeyboardLayoutPreviewIsoScreenshotTest.kt b/tests/InputScreenshotTest/src/android/input/screenshot/KeyboardLayoutPreviewIsoScreenshotTest.kt
index ab7bb4eda899..ddad6dea5e32 100644
--- a/tests/InputScreenshotTest/src/android/input/screenshot/KeyboardLayoutPreviewIsoScreenshotTest.kt
+++ b/tests/InputScreenshotTest/src/android/input/screenshot/KeyboardLayoutPreviewIsoScreenshotTest.kt
@@ -17,14 +17,8 @@
package com.android.input.screenshot
import android.content.Context
-import android.hardware.input.KeyboardLayout
-import android.os.LocaleList
-import android.platform.test.flag.junit.SetFlagsRule
-import com.android.hardware.input.Flags
-import java.util.Locale
import org.junit.Rule
import org.junit.Test
-import org.junit.rules.RuleChain
import org.junit.runner.RunWith
import platform.test.runner.parameterized.ParameterizedAndroidJunit4
import platform.test.runner.parameterized.Parameters
@@ -39,21 +33,16 @@ class KeyboardLayoutPreviewIsoScreenshotTest(emulationSpec: DeviceEmulationSpec)
fun getTestSpecs() = DeviceEmulationSpec.PhoneAndTabletMinimal
}
- val setFlagsRule = SetFlagsRule()
+ @get:Rule
val screenshotRule = InputScreenshotTestRule(
emulationSpec,
"frameworks/base/tests/InputScreenshotTest/assets"
)
- @get:Rule
- val ruleChain = RuleChain.outerRule(screenshotRule).around(setFlagsRule)
-
@Test
fun test() {
- setFlagsRule.enableFlags(Flags.FLAG_KEYBOARD_LAYOUT_PREVIEW_FLAG)
screenshotRule.screenshotTest("layout-preview") {
context: Context -> LayoutPreview.createLayoutPreview(context, null)
}
}
-
}
diff --git a/tests/InputScreenshotTest/src/android/input/screenshot/KeyboardLayoutPreviewJisScreenshotTest.kt b/tests/InputScreenshotTest/src/android/input/screenshot/KeyboardLayoutPreviewJisScreenshotTest.kt
index 5231c14bfc9a..8a8e4f058d8a 100644
--- a/tests/InputScreenshotTest/src/android/input/screenshot/KeyboardLayoutPreviewJisScreenshotTest.kt
+++ b/tests/InputScreenshotTest/src/android/input/screenshot/KeyboardLayoutPreviewJisScreenshotTest.kt
@@ -19,12 +19,9 @@ package com.android.input.screenshot
import android.content.Context
import android.hardware.input.KeyboardLayout
import android.os.LocaleList
-import android.platform.test.flag.junit.SetFlagsRule
-import com.android.hardware.input.Flags
import java.util.Locale
import org.junit.Rule
import org.junit.Test
-import org.junit.rules.RuleChain
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import platform.test.screenshot.DeviceEmulationSpec
@@ -38,18 +35,14 @@ class KeyboardLayoutPreviewJisScreenshotTest(emulationSpec: DeviceEmulationSpec)
fun getTestSpecs() = DeviceEmulationSpec.PhoneMinimal
}
- val setFlagsRule = SetFlagsRule()
+ @get:Rule
val screenshotRule = InputScreenshotTestRule(
emulationSpec,
"frameworks/base/tests/InputScreenshotTest/assets"
)
- @get:Rule
- val ruleChain = RuleChain.outerRule(screenshotRule).around(setFlagsRule)
-
@Test
fun test() {
- setFlagsRule.enableFlags(Flags.FLAG_KEYBOARD_LAYOUT_PREVIEW_FLAG)
screenshotRule.screenshotTest("layout-preview-jis") {
context: Context -> LayoutPreview.createLayoutPreview(
context,
@@ -66,5 +59,4 @@ class KeyboardLayoutPreviewJisScreenshotTest(emulationSpec: DeviceEmulationSpec)
)
}
}
-
} \ No newline at end of file