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

Commit ecd46961 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Use the PersistableBundle instead of the Bundle" into sc-dev am: 20e5c931

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13917726

Change-Id: I20c50141818d4b32d001ba4fe16c209927eec542
parents 6201189f 20e5c931
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -10408,7 +10408,7 @@ package android.service.voice {
    ctor public HotwordDetectionService();
    ctor public HotwordDetectionService();
    method @Nullable public final android.os.IBinder onBind(@NonNull android.content.Intent);
    method @Nullable public final android.os.IBinder onBind(@NonNull android.content.Intent);
    method public void onDetectFromDspSource(@NonNull android.os.ParcelFileDescriptor, @NonNull android.media.AudioFormat, long, @NonNull android.service.voice.HotwordDetectionService.DspHotwordDetectionCallback);
    method public void onDetectFromDspSource(@NonNull android.os.ParcelFileDescriptor, @NonNull android.media.AudioFormat, long, @NonNull android.service.voice.HotwordDetectionService.DspHotwordDetectionCallback);
    method public void onUpdateState(@Nullable android.os.Bundle, @Nullable android.os.SharedMemory);
    method public void onUpdateState(@Nullable android.os.PersistableBundle, @Nullable android.os.SharedMemory);
    field public static final String SERVICE_INTERFACE = "android.service.voice.HotwordDetectionService";
    field public static final String SERVICE_INTERFACE = "android.service.voice.HotwordDetectionService";
  }
  }
@@ -10433,7 +10433,7 @@ package android.service.voice {
  public class VoiceInteractionService extends android.app.Service {
  public class VoiceInteractionService extends android.app.Service {
    method @NonNull public final android.service.voice.AlwaysOnHotwordDetector createAlwaysOnHotwordDetector(String, java.util.Locale, android.service.voice.AlwaysOnHotwordDetector.Callback);
    method @NonNull public final android.service.voice.AlwaysOnHotwordDetector createAlwaysOnHotwordDetector(String, java.util.Locale, android.service.voice.AlwaysOnHotwordDetector.Callback);
    method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_HOTWORD_DETECTION) public final android.service.voice.AlwaysOnHotwordDetector createAlwaysOnHotwordDetector(String, java.util.Locale, @Nullable android.os.Bundle, @Nullable android.os.SharedMemory, android.service.voice.AlwaysOnHotwordDetector.Callback);
    method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_HOTWORD_DETECTION) public final android.service.voice.AlwaysOnHotwordDetector createAlwaysOnHotwordDetector(String, java.util.Locale, @Nullable android.os.PersistableBundle, @Nullable android.os.SharedMemory, android.service.voice.AlwaysOnHotwordDetector.Callback);
    method @NonNull @RequiresPermission("android.permission.MANAGE_VOICE_KEYPHRASES") public final android.media.voice.KeyphraseModelManager createKeyphraseModelManager();
    method @NonNull @RequiresPermission("android.permission.MANAGE_VOICE_KEYPHRASES") public final android.media.voice.KeyphraseModelManager createKeyphraseModelManager();
  }
  }
+7 −7
Original line number Original line Diff line number Diff line
@@ -41,10 +41,10 @@ import android.media.permission.Identity;
import android.os.AsyncTask;
import android.os.AsyncTask;
import android.os.Binder;
import android.os.Binder;
import android.os.Build;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Handler;
import android.os.IBinder;
import android.os.IBinder;
import android.os.Message;
import android.os.Message;
import android.os.PersistableBundle;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.SharedMemory;
import android.os.SharedMemory;
import android.util.Slog;
import android.util.Slog;
@@ -494,8 +494,8 @@ public class AlwaysOnHotwordDetector {
     * @param supportHotwordDetectionService {@code true} if hotword detection service should be
     * @param supportHotwordDetectionService {@code true} if hotword detection service should be
     * triggered, otherwise {@code false}.
     * triggered, otherwise {@code false}.
     * @param options Application configuration data provided by the
     * @param options Application configuration data provided by the
     * {@link VoiceInteractionService}. The system strips out any remotable objects or other
     * {@link VoiceInteractionService}. PersistableBundle does not allow any remotable objects or
     * contents that can be used to communicate with other processes.
     * other contents that can be used to communicate with other processes.
     * @param sharedMemory The unrestricted data blob provided by the
     * @param sharedMemory The unrestricted data blob provided by the
     * {@link VoiceInteractionService}. Use this to provide the hotword models data or other
     * {@link VoiceInteractionService}. Use this to provide the hotword models data or other
     * such data to the trusted process.
     * such data to the trusted process.
@@ -505,7 +505,7 @@ public class AlwaysOnHotwordDetector {
    public AlwaysOnHotwordDetector(String text, Locale locale, Callback callback,
    public AlwaysOnHotwordDetector(String text, Locale locale, Callback callback,
            KeyphraseEnrollmentInfo keyphraseEnrollmentInfo,
            KeyphraseEnrollmentInfo keyphraseEnrollmentInfo,
            IVoiceInteractionManagerService modelManagementService, int targetSdkVersion,
            IVoiceInteractionManagerService modelManagementService, int targetSdkVersion,
            boolean supportHotwordDetectionService, @Nullable Bundle options,
            boolean supportHotwordDetectionService, @Nullable PersistableBundle options,
            @Nullable SharedMemory sharedMemory) {
            @Nullable SharedMemory sharedMemory) {
        mText = text;
        mText = text;
        mLocale = locale;
        mLocale = locale;
@@ -534,8 +534,8 @@ public class AlwaysOnHotwordDetector {
     * Set configuration and pass read-only data to hotword detection service.
     * Set configuration and pass read-only data to hotword detection service.
     *
     *
     * @param options Application configuration data provided by the
     * @param options Application configuration data provided by the
     * {@link VoiceInteractionService}. The system strips out any remotable objects or other
     * {@link VoiceInteractionService}. PersistableBundle does not allow any remotable objects or
     * contents that can be used to communicate with other processes.
     * other contents that can be used to communicate with other processes.
     * @param sharedMemory The unrestricted data blob provided by the
     * @param sharedMemory The unrestricted data blob provided by the
     * {@link VoiceInteractionService}. Use this to provide the hotword models data or other
     * {@link VoiceInteractionService}. Use this to provide the hotword models data or other
     * such data to the trusted process.
     * such data to the trusted process.
@@ -544,7 +544,7 @@ public class AlwaysOnHotwordDetector {
     *
     *
     * @hide
     * @hide
     */
     */
    public final void setHotwordDetectionServiceConfig(@Nullable Bundle options,
    public final void setHotwordDetectionServiceConfig(@Nullable PersistableBundle options,
            @Nullable SharedMemory sharedMemory) {
            @Nullable SharedMemory sharedMemory) {
        if (DBG) {
        if (DBG) {
            Slog.d(TAG, "setHotwordDetectionServiceConfig()");
            Slog.d(TAG, "setHotwordDetectionServiceConfig()");
+10 −8
Original line number Original line Diff line number Diff line
@@ -27,11 +27,11 @@ import android.annotation.SystemApi;
import android.app.Service;
import android.app.Service;
import android.content.Intent;
import android.content.Intent;
import android.media.AudioFormat;
import android.media.AudioFormat;
import android.os.Bundle;
import android.os.Handler;
import android.os.Handler;
import android.os.IBinder;
import android.os.IBinder;
import android.os.Looper;
import android.os.Looper;
import android.os.ParcelFileDescriptor;
import android.os.ParcelFileDescriptor;
import android.os.PersistableBundle;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.SharedMemory;
import android.os.SharedMemory;
import android.util.Log;
import android.util.Log;
@@ -82,7 +82,8 @@ public abstract class HotwordDetectionService extends Service {
        }
        }


        @Override
        @Override
        public void setConfig(Bundle options, SharedMemory sharedMemory) throws RemoteException {
        public void setConfig(PersistableBundle options, SharedMemory sharedMemory)
                throws RemoteException {
            if (DBG) {
            if (DBG) {
                Log.d(TAG, "#setConfig");
                Log.d(TAG, "#setConfig");
            }
            }
@@ -137,13 +138,13 @@ public abstract class HotwordDetectionService extends Service {


    /**
    /**
     * Called when the {@link VoiceInteractionService#createAlwaysOnHotwordDetector(String, Locale,
     * Called when the {@link VoiceInteractionService#createAlwaysOnHotwordDetector(String, Locale,
     * Bundle, SharedMemory, AlwaysOnHotwordDetector.Callback)} or {@link AlwaysOnHotwordDetector#
     * PersistableBundle, SharedMemory, AlwaysOnHotwordDetector.Callback)} or
     * setHotwordDetectionServiceConfig(Bundle, SharedMemory)} requests an update of the hotword
     * {@link AlwaysOnHotwordDetector#setHotwordDetectionServiceConfig(PersistableBundle,
     * detection parameters.
     * SharedMemory)} requests an update of the hotword detection parameters.
     *
     *
     * @param options Application configuration data provided by the
     * @param options Application configuration data provided by the
     * {@link VoiceInteractionService}. The system strips out any remotable objects or other
     * {@link VoiceInteractionService}. PersistableBundle does not allow any remotable objects or
     * contents that can be used to communicate with other processes.
     * other contents that can be used to communicate with other processes.
     * @param sharedMemory The unrestricted data blob provided by the
     * @param sharedMemory The unrestricted data blob provided by the
     * {@link VoiceInteractionService}. Use this to provide the hotword models data or other
     * {@link VoiceInteractionService}. Use this to provide the hotword models data or other
     * such data to the trusted process.
     * such data to the trusted process.
@@ -151,7 +152,8 @@ public abstract class HotwordDetectionService extends Service {
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    public void onUpdateState(@Nullable Bundle options, @Nullable SharedMemory sharedMemory) {
    public void onUpdateState(@Nullable PersistableBundle options,
            @Nullable SharedMemory sharedMemory) {
    }
    }


    /**
    /**
+2 −2
Original line number Original line Diff line number Diff line
@@ -17,8 +17,8 @@
package android.service.voice;
package android.service.voice;


import android.media.AudioFormat;
import android.media.AudioFormat;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.os.ParcelFileDescriptor;
import android.os.PersistableBundle;
import android.os.SharedMemory;
import android.os.SharedMemory;
import android.service.voice.IDspHotwordDetectionCallback;
import android.service.voice.IDspHotwordDetectionCallback;


@@ -34,5 +34,5 @@ oneway interface IHotwordDetectionService {
    long timeoutMillis,
    long timeoutMillis,
    in IDspHotwordDetectionCallback callback);
    in IDspHotwordDetectionCallback callback);


    void setConfig(in Bundle options, in SharedMemory sharedMemory);
    void setConfig(in PersistableBundle options, in SharedMemory sharedMemory);
}
}
+5 −4
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@ import android.media.voice.KeyphraseModelManager;
import android.os.Bundle;
import android.os.Bundle;
import android.os.Handler;
import android.os.Handler;
import android.os.IBinder;
import android.os.IBinder;
import android.os.PersistableBundle;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
import android.os.SharedMemory;
import android.os.SharedMemory;
@@ -342,8 +343,8 @@ public class VoiceInteractionService extends Service {
     * @param keyphrase The keyphrase that's being used, for example "Hello Android".
     * @param keyphrase The keyphrase that's being used, for example "Hello Android".
     * @param locale The locale for which the enrollment needs to be performed.
     * @param locale The locale for which the enrollment needs to be performed.
     * @param options Application configuration data provided by the
     * @param options Application configuration data provided by the
     * {@link VoiceInteractionService}. The system strips out any remotable objects or other
     * {@link VoiceInteractionService}. PersistableBundle does not allow any remotable objects or
     * contents that can be used to communicate with other processes.
     * other contents that can be used to communicate with other processes.
     * @param sharedMemory The unrestricted data blob provided by the
     * @param sharedMemory The unrestricted data blob provided by the
     * {@link VoiceInteractionService}. Use this to provide the hotword models data or other
     * {@link VoiceInteractionService}. Use this to provide the hotword models data or other
     * such data to the trusted process.
     * such data to the trusted process.
@@ -358,7 +359,7 @@ public class VoiceInteractionService extends Service {
    public final AlwaysOnHotwordDetector createAlwaysOnHotwordDetector(
    public final AlwaysOnHotwordDetector createAlwaysOnHotwordDetector(
            @SuppressLint("MissingNullability") String keyphrase,  // TODO: nullability properly
            @SuppressLint("MissingNullability") String keyphrase,  // TODO: nullability properly
            @SuppressLint({"MissingNullability", "UseIcu"}) Locale locale,
            @SuppressLint({"MissingNullability", "UseIcu"}) Locale locale,
            @Nullable Bundle options,
            @Nullable PersistableBundle options,
            @Nullable SharedMemory sharedMemory,
            @Nullable SharedMemory sharedMemory,
            @SuppressLint("MissingNullability") AlwaysOnHotwordDetector.Callback callback) {
            @SuppressLint("MissingNullability") AlwaysOnHotwordDetector.Callback callback) {
        return createAlwaysOnHotwordDetectorInternal(keyphrase, locale,
        return createAlwaysOnHotwordDetectorInternal(keyphrase, locale,
@@ -370,7 +371,7 @@ public class VoiceInteractionService extends Service {
            @SuppressLint("MissingNullability") String keyphrase,  // TODO: nullability properly
            @SuppressLint("MissingNullability") String keyphrase,  // TODO: nullability properly
            @SuppressLint({"MissingNullability", "UseIcu"}) Locale locale,
            @SuppressLint({"MissingNullability", "UseIcu"}) Locale locale,
            boolean supportHotwordDetectionService,
            boolean supportHotwordDetectionService,
            @Nullable Bundle options,
            @Nullable PersistableBundle options,
            @Nullable SharedMemory sharedMemory,
            @Nullable SharedMemory sharedMemory,
            @SuppressLint("MissingNullability") AlwaysOnHotwordDetector.Callback callback) {
            @SuppressLint("MissingNullability") AlwaysOnHotwordDetector.Callback callback) {
        if (mSystemService == null) {
        if (mSystemService == null) {
Loading