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

Commit 1e7a00ed authored by MingWei Liao's avatar MingWei Liao Committed by Android (Google) Code Review
Browse files

Merge "Add multilang extra in ReocognizerIntent" into main

parents e27e4e3a df840514
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ aconfig_srcjars = [
    ":android.webkit.flags-aconfig-java{.generated_srcjars}",
    ":android.provider.flags-aconfig-java{.generated_srcjars}",
    ":android.chre.flags-aconfig-java{.generated_srcjars}",
    ":android.speech.flags-aconfig-java{.generated_srcjars}",
]

filegroup {
@@ -913,3 +914,16 @@ java_aconfig_library {
    aconfig_declarations: "chre_flags",
    defaults: ["framework-minus-apex-aconfig-java-defaults"],
}

// Speech
aconfig_declarations {
    name: "android.speech.flags-aconfig",
    package: "android.speech.flags",
    srcs: ["core/java/android/speech/flags/*.aconfig"],
}

java_aconfig_library {
    name: "android.speech.flags-aconfig-java",
    aconfig_declarations: "android.speech.flags-aconfig",
    defaults: ["framework-minus-apex-aconfig-java-defaults"],
}
+2 −0
Original line number Diff line number Diff line
@@ -41552,6 +41552,8 @@ package android.speech {
    field public static final String EXTRA_LANGUAGE_MODEL = "android.speech.extra.LANGUAGE_MODEL";
    field public static final String EXTRA_LANGUAGE_PREFERENCE = "android.speech.extra.LANGUAGE_PREFERENCE";
    field public static final String EXTRA_LANGUAGE_SWITCH_ALLOWED_LANGUAGES = "android.speech.extra.LANGUAGE_SWITCH_ALLOWED_LANGUAGES";
    field @FlaggedApi("android.speech.flags.multilang_extra_launch") public static final String EXTRA_LANGUAGE_SWITCH_INITIAL_ACTIVE_DURATION_TIME_MILLIS = "android.speech.extra.LANGUAGE_SWITCH_INITIAL_ACTIVE_DURATION_TIME_MILLIS";
    field @FlaggedApi("android.speech.flags.multilang_extra_launch") public static final String EXTRA_LANGUAGE_SWITCH_MAX_SWITCHES = "android.speech.extra.LANGUAGE_SWITCH_MAX_SWITCHES";
    field public static final String EXTRA_MASK_OFFENSIVE_WORDS = "android.speech.extra.MASK_OFFENSIVE_WORDS";
    field public static final String EXTRA_MAX_RESULTS = "android.speech.extra.MAX_RESULTS";
    field public static final String EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE = "android.speech.extra.ONLY_RETURN_LANGUAGE_PREFERENCE";
+29 −0
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package android.speech;

import static android.speech.flags.Flags.FLAG_MULTILANG_EXTRA_LAUNCH;

import android.annotation.FlaggedApi;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
@@ -653,4 +656,30 @@ public class RecognizerIntent {
     */
    public static final String EXTRA_LANGUAGE_SWITCH_ALLOWED_LANGUAGES =
            "android.speech.extra.LANGUAGE_SWITCH_ALLOWED_LANGUAGES";

    /**
     * Optional integer to use for {@link #EXTRA_ENABLE_LANGUAGE_SWITCH}. If set, the language
     * switch will be deactivated when LANGUAGE_SWITCH_MAX_SWITCHES reached.
     *
     * <p> Depending on the recognizer implementation, this flag may have no effect.
     *
     * @see #EXTRA_ENABLE_LANGUAGE_SWITCH
     */
    @FlaggedApi(FLAG_MULTILANG_EXTRA_LAUNCH)
    public static final String EXTRA_LANGUAGE_SWITCH_MAX_SWITCHES =
            "android.speech.extra.LANGUAGE_SWITCH_MAX_SWITCHES";

    /**
     * Optional integer to use for {@link #EXTRA_ENABLE_LANGUAGE_SWITCH}. If set, the language
     * switch will only be activated for this value of ms of audio since the START_OF_SPEECH. This
     * could provide a more stable recognition result when the language switch is only required in
     * the beginning of the session.
     *
     * <p> Depending on the recognizer implementation, this flag may have no effect.
     *
     * @see #EXTRA_ENABLE_LANGUAGE_SWITCH
     */
    @FlaggedApi(FLAG_MULTILANG_EXTRA_LAUNCH)
    public static final String EXTRA_LANGUAGE_SWITCH_INITIAL_ACTIVE_DURATION_TIME_MILLIS =
            "android.speech.extra.LANGUAGE_SWITCH_INITIAL_ACTIVE_DURATION_TIME_MILLIS";
}
+8 −0
Original line number Diff line number Diff line
package: "android.speech.flags"

flag {
    name: "multilang_extra_launch"
    namespace: "machine_learning"
    description: "Feature flag for adding new extra for multi-lang feature"
    bug: "312489931"
}