Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0bf31420 authored by Vaibhav Devmurari's avatar Vaibhav Devmurari
Browse files

Flag cleanup: keyboard_layout_preview_flag

Test: atest KeyboardLayoutPreviewScreenhotTests
Test: atest KeyboardLayoutPreviewTests
Bug: 293579375
Flag: EXEMPT cleanup
Change-Id: I21c3b62fe5491c71324dde617b4932e810ac1507
parent 81f32c32
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -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);
+0 −8
Original line number Diff line number Diff line
@@ -6,14 +6,6 @@ container: "system"
# NOTE: the input_native namespace is deprecated. New flags should be added to the input namespace
# instead.

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"
+0 −51
Original line number Diff line number Diff line
/*
 * 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();
    }
}
+0 −2
Original line number Diff line number Diff line
include /core/java/android/hardware/input/OWNERS
+0 −16
Original line number Diff line number Diff line
@@ -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
Loading