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

Commit c469f35e authored by Josep del Rio's avatar Josep del Rio
Browse files

Add flags for new features

This CL adds support for 2 new features flag meant for keyboard
features: layout preview and accessibility.

Bug: 294546335
Bug: 293579375
Test: `atest FrameworksCoreTests:InputFlagsTest`
Change-Id: Id716a4d8e9d0d081f093fde67883fc4a4b266aa3
parent dbc0b78e
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ java_defaults {
    srcs: [
        ":com.android.hardware.camera2-aconfig-java{.generated_srcjars}",
        ":com.android.window.flags.window-aconfig-java{.generated_srcjars}",
        ":com.android.hardware.input-aconfig-java{.generated_srcjars}",
        ":com.android.text.flags-aconfig-java{.generated_srcjars}",
    ],
    // Add aconfig-annotations-lib as a dependency for the optimization
@@ -60,6 +61,19 @@ java_aconfig_library {
    defaults: ["framework-minus-apex-aconfig-java-defaults"],
}

// Input
aconfig_declarations {
    name: "com.android.hardware.input.input-aconfig",
    package: "com.android.hardware.input",
    srcs: ["core/java/android/hardware/input/*.aconfig"],
}

java_aconfig_library {
    name: "com.android.hardware.input-aconfig-java",
    aconfig_declarations: "com.android.hardware.input.input-aconfig",
    defaults: ["framework-minus-apex-aconfig-java-defaults"],
}

// Text
aconfig_declarations {
    name: "com.android.text.flags-aconfig",
+19 −0
Original line number Diff line number Diff line
package: "com.android.hardware.input"

# Project link: https://gantry.corp.google.com/projects/android_platform_input_native/changes

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"
}
+51 −0
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.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;

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();
    }
}