Loading core/java/android/hardware/soundtrigger/KeyphraseEnrollmentInfo.java +7 −7 Original line number Original line Diff line number Diff line Loading @@ -58,8 +58,8 @@ public class KeyphraseEnrollmentInfo { */ */ private static final String VOICE_KEYPHRASE_META_DATA = "android.voice_enrollment"; private static final String VOICE_KEYPHRASE_META_DATA = "android.voice_enrollment"; /** /** * Activity Action: Show activity for managing the keyphrases for hotword detection. * Intent Action: for managing the keyphrases for hotword detection. * This needs to be defined by an activity that supports enrolling users for hotword/keyphrase * This needs to be defined by a service that supports enrolling users for hotword/keyphrase * detection. * detection. */ */ public static final String ACTION_MANAGE_VOICE_KEYPHRASES = public static final String ACTION_MANAGE_VOICE_KEYPHRASES = Loading Loading @@ -101,7 +101,7 @@ public class KeyphraseEnrollmentInfo { // Find the apps that supports enrollment for hotword keyhphrases, // Find the apps that supports enrollment for hotword keyhphrases, // Pick a privileged app and obtain the information about the supported keyphrases // Pick a privileged app and obtain the information about the supported keyphrases // from its metadata. // from its metadata. List<ResolveInfo> ris = pm.queryIntentActivities( List<ResolveInfo> ris = pm.queryIntentServices( new Intent(ACTION_MANAGE_VOICE_KEYPHRASES), PackageManager.MATCH_DEFAULT_ONLY); new Intent(ACTION_MANAGE_VOICE_KEYPHRASES), PackageManager.MATCH_DEFAULT_ONLY); if (ris == null || ris.isEmpty()) { if (ris == null || ris.isEmpty()) { // No application capable of enrolling for voice keyphrases is present. // No application capable of enrolling for voice keyphrases is present. Loading @@ -116,7 +116,7 @@ public class KeyphraseEnrollmentInfo { for (ResolveInfo ri : ris) { for (ResolveInfo ri : ris) { try { try { ApplicationInfo ai = pm.getApplicationInfo( ApplicationInfo ai = pm.getApplicationInfo( ri.activityInfo.packageName, PackageManager.GET_META_DATA); ri.serviceInfo.packageName, PackageManager.GET_META_DATA); if ((ai.privateFlags & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) == 0) { if ((ai.privateFlags & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) == 0) { // The application isn't privileged (/system/priv-app). // The application isn't privileged (/system/priv-app). // The enrollment application needs to be a privileged system app. // The enrollment application needs to be a privileged system app. Loading @@ -137,7 +137,7 @@ public class KeyphraseEnrollmentInfo { } } } catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) { String error = "error parsing voice enrollment meta-data for " String error = "error parsing voice enrollment meta-data for " + ri.activityInfo.packageName; + ri.serviceInfo.packageName; parseErrors.add(error + ": " + e); parseErrors.add(error + ": " + e); Slog.w(TAG, error, e); Slog.w(TAG, error, e); } } Loading Loading @@ -290,7 +290,7 @@ public class KeyphraseEnrollmentInfo { } } /** /** * Returns an intent to launch an activity that manages the given keyphrase * Returns an intent to launch an service that manages the given keyphrase * for the locale. * for the locale. * * * @param action The enrollment related action that this intent is supposed to perform. * @param action The enrollment related action that this intent is supposed to perform. Loading core/java/android/service/voice/AlwaysOnHotwordDetector.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,7 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Nullable; import android.annotation.UnsupportedAppUsage; import android.annotation.UnsupportedAppUsage; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.Intent; import android.hardware.soundtrigger.IRecognitionStatusCallback; import android.hardware.soundtrigger.IRecognitionStatusCallback; import android.hardware.soundtrigger.KeyphraseEnrollmentInfo; import android.hardware.soundtrigger.KeyphraseEnrollmentInfo; Loading Loading @@ -446,7 +446,7 @@ public class AlwaysOnHotwordDetector { /** /** * Creates an intent to start the enrollment for the associated keyphrase. * Creates an intent to start the enrollment for the associated keyphrase. * This intent must be invoked using {@link Activity#startActivityForResult(Intent, int)}. * This intent must be invoked using {@link Context#startForegroundService(Intent)}. * Starting re-enrollment is only valid if the keyphrase is un-enrolled, * Starting re-enrollment is only valid if the keyphrase is un-enrolled, * i.e. {@link #STATE_KEYPHRASE_UNENROLLED}, * i.e. {@link #STATE_KEYPHRASE_UNENROLLED}, * otherwise {@link #createReEnrollIntent()} should be preferred. * otherwise {@link #createReEnrollIntent()} should be preferred. Loading @@ -468,7 +468,7 @@ public class AlwaysOnHotwordDetector { /** /** * Creates an intent to start the un-enrollment for the associated keyphrase. * Creates an intent to start the un-enrollment for the associated keyphrase. * This intent must be invoked using {@link Activity#startActivityForResult(Intent, int)}. * This intent must be invoked using {@link Context#startForegroundService(Intent)}. * Starting re-enrollment is only valid if the keyphrase is already enrolled, * Starting re-enrollment is only valid if the keyphrase is already enrolled, * i.e. {@link #STATE_KEYPHRASE_ENROLLED}, otherwise invoking this may result in an error. * i.e. {@link #STATE_KEYPHRASE_ENROLLED}, otherwise invoking this may result in an error. * * Loading @@ -489,7 +489,7 @@ public class AlwaysOnHotwordDetector { /** /** * Creates an intent to start the re-enrollment for the associated keyphrase. * Creates an intent to start the re-enrollment for the associated keyphrase. * This intent must be invoked using {@link Activity#startActivityForResult(Intent, int)}. * This intent must be invoked using {@link Context#startForegroundService(Intent)}. * Starting re-enrollment is only valid if the keyphrase is already enrolled, * Starting re-enrollment is only valid if the keyphrase is already enrolled, * i.e. {@link #STATE_KEYPHRASE_ENROLLED}, otherwise invoking this may result in an error. * i.e. {@link #STATE_KEYPHRASE_ENROLLED}, otherwise invoking this may result in an error. * * Loading Loading
core/java/android/hardware/soundtrigger/KeyphraseEnrollmentInfo.java +7 −7 Original line number Original line Diff line number Diff line Loading @@ -58,8 +58,8 @@ public class KeyphraseEnrollmentInfo { */ */ private static final String VOICE_KEYPHRASE_META_DATA = "android.voice_enrollment"; private static final String VOICE_KEYPHRASE_META_DATA = "android.voice_enrollment"; /** /** * Activity Action: Show activity for managing the keyphrases for hotword detection. * Intent Action: for managing the keyphrases for hotword detection. * This needs to be defined by an activity that supports enrolling users for hotword/keyphrase * This needs to be defined by a service that supports enrolling users for hotword/keyphrase * detection. * detection. */ */ public static final String ACTION_MANAGE_VOICE_KEYPHRASES = public static final String ACTION_MANAGE_VOICE_KEYPHRASES = Loading Loading @@ -101,7 +101,7 @@ public class KeyphraseEnrollmentInfo { // Find the apps that supports enrollment for hotword keyhphrases, // Find the apps that supports enrollment for hotword keyhphrases, // Pick a privileged app and obtain the information about the supported keyphrases // Pick a privileged app and obtain the information about the supported keyphrases // from its metadata. // from its metadata. List<ResolveInfo> ris = pm.queryIntentActivities( List<ResolveInfo> ris = pm.queryIntentServices( new Intent(ACTION_MANAGE_VOICE_KEYPHRASES), PackageManager.MATCH_DEFAULT_ONLY); new Intent(ACTION_MANAGE_VOICE_KEYPHRASES), PackageManager.MATCH_DEFAULT_ONLY); if (ris == null || ris.isEmpty()) { if (ris == null || ris.isEmpty()) { // No application capable of enrolling for voice keyphrases is present. // No application capable of enrolling for voice keyphrases is present. Loading @@ -116,7 +116,7 @@ public class KeyphraseEnrollmentInfo { for (ResolveInfo ri : ris) { for (ResolveInfo ri : ris) { try { try { ApplicationInfo ai = pm.getApplicationInfo( ApplicationInfo ai = pm.getApplicationInfo( ri.activityInfo.packageName, PackageManager.GET_META_DATA); ri.serviceInfo.packageName, PackageManager.GET_META_DATA); if ((ai.privateFlags & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) == 0) { if ((ai.privateFlags & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) == 0) { // The application isn't privileged (/system/priv-app). // The application isn't privileged (/system/priv-app). // The enrollment application needs to be a privileged system app. // The enrollment application needs to be a privileged system app. Loading @@ -137,7 +137,7 @@ public class KeyphraseEnrollmentInfo { } } } catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) { String error = "error parsing voice enrollment meta-data for " String error = "error parsing voice enrollment meta-data for " + ri.activityInfo.packageName; + ri.serviceInfo.packageName; parseErrors.add(error + ": " + e); parseErrors.add(error + ": " + e); Slog.w(TAG, error, e); Slog.w(TAG, error, e); } } Loading Loading @@ -290,7 +290,7 @@ public class KeyphraseEnrollmentInfo { } } /** /** * Returns an intent to launch an activity that manages the given keyphrase * Returns an intent to launch an service that manages the given keyphrase * for the locale. * for the locale. * * * @param action The enrollment related action that this intent is supposed to perform. * @param action The enrollment related action that this intent is supposed to perform. Loading
core/java/android/service/voice/AlwaysOnHotwordDetector.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,7 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Nullable; import android.annotation.UnsupportedAppUsage; import android.annotation.UnsupportedAppUsage; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.Intent; import android.hardware.soundtrigger.IRecognitionStatusCallback; import android.hardware.soundtrigger.IRecognitionStatusCallback; import android.hardware.soundtrigger.KeyphraseEnrollmentInfo; import android.hardware.soundtrigger.KeyphraseEnrollmentInfo; Loading Loading @@ -446,7 +446,7 @@ public class AlwaysOnHotwordDetector { /** /** * Creates an intent to start the enrollment for the associated keyphrase. * Creates an intent to start the enrollment for the associated keyphrase. * This intent must be invoked using {@link Activity#startActivityForResult(Intent, int)}. * This intent must be invoked using {@link Context#startForegroundService(Intent)}. * Starting re-enrollment is only valid if the keyphrase is un-enrolled, * Starting re-enrollment is only valid if the keyphrase is un-enrolled, * i.e. {@link #STATE_KEYPHRASE_UNENROLLED}, * i.e. {@link #STATE_KEYPHRASE_UNENROLLED}, * otherwise {@link #createReEnrollIntent()} should be preferred. * otherwise {@link #createReEnrollIntent()} should be preferred. Loading @@ -468,7 +468,7 @@ public class AlwaysOnHotwordDetector { /** /** * Creates an intent to start the un-enrollment for the associated keyphrase. * Creates an intent to start the un-enrollment for the associated keyphrase. * This intent must be invoked using {@link Activity#startActivityForResult(Intent, int)}. * This intent must be invoked using {@link Context#startForegroundService(Intent)}. * Starting re-enrollment is only valid if the keyphrase is already enrolled, * Starting re-enrollment is only valid if the keyphrase is already enrolled, * i.e. {@link #STATE_KEYPHRASE_ENROLLED}, otherwise invoking this may result in an error. * i.e. {@link #STATE_KEYPHRASE_ENROLLED}, otherwise invoking this may result in an error. * * Loading @@ -489,7 +489,7 @@ public class AlwaysOnHotwordDetector { /** /** * Creates an intent to start the re-enrollment for the associated keyphrase. * Creates an intent to start the re-enrollment for the associated keyphrase. * This intent must be invoked using {@link Activity#startActivityForResult(Intent, int)}. * This intent must be invoked using {@link Context#startForegroundService(Intent)}. * Starting re-enrollment is only valid if the keyphrase is already enrolled, * Starting re-enrollment is only valid if the keyphrase is already enrolled, * i.e. {@link #STATE_KEYPHRASE_ENROLLED}, otherwise invoking this may result in an error. * i.e. {@link #STATE_KEYPHRASE_ENROLLED}, otherwise invoking this may result in an error. * * Loading