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

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

Change-Id: I20c50141818d4b32d001ba4fe16c209927eec542
This commit is contained in:
TreeHugger Robot
2021-03-24 01:19:01 +00:00
committed by Automerger Merge Worker
9 changed files with 38 additions and 32 deletions

View File

@@ -26,8 +26,8 @@ import android.hardware.soundtrigger.SoundTrigger;
import android.media.AudioAttributes;
import android.media.AudioRecord;
import android.media.MediaRecorder;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.os.PersistableBundle;
import android.os.RemoteException;
import android.os.SharedMemory;
import android.service.voice.AlwaysOnHotwordDetector;
@@ -77,7 +77,7 @@ final class HotwordDetectionConnection {
boolean mBound;
HotwordDetectionConnection(Object lock, Context context, ComponentName serviceName,
int userId, boolean bindInstantServiceAllowed, @Nullable Bundle options,
int userId, boolean bindInstantServiceAllowed, @Nullable PersistableBundle options,
@Nullable SharedMemory sharedMemory) {
mLock = lock;
mContext = context;
@@ -129,7 +129,7 @@ final class HotwordDetectionConnection {
}
}
void setConfigLocked(Bundle options, SharedMemory sharedMemory) {
void setConfigLocked(PersistableBundle options, SharedMemory sharedMemory) {
mRemoteHotwordDetectionService.run(
service -> service.setConfig(options, sharedMemory));
}

View File

@@ -56,6 +56,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Parcel;
import android.os.PersistableBundle;
import android.os.RemoteCallback;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
@@ -983,7 +984,7 @@ public class VoiceInteractionManagerService extends SystemService {
}
@Override
public void setHotwordDetectionServiceConfig(@Nullable Bundle options,
public void setHotwordDetectionServiceConfig(@Nullable PersistableBundle options,
@Nullable SharedMemory sharedMemory) {
enforceCallingPermission(Manifest.permission.MANAGE_HOTWORD_DETECTION);
synchronized (this) {

View File

@@ -43,6 +43,7 @@ import android.hardware.soundtrigger.IRecognitionStatusCallback;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.PersistableBundle;
import android.os.RemoteCallback;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -401,7 +402,7 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
return mInfo.getSupportsLocalInteraction();
}
public void setHotwordDetectionServiceConfigLocked(@Nullable Bundle options,
public void setHotwordDetectionServiceConfigLocked(@Nullable PersistableBundle options,
@Nullable SharedMemory sharedMemory) {
if (DEBUG) {
Slog.d(TAG, "setHotwordDetectionServiceConfigLocked");
@@ -415,7 +416,6 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
throw new IllegalStateException("Hotword detection service not in isolated process");
}
// TODO : Need to check related permissions for hotword detection service
// TODO : Sanitize for bundle
if (sharedMemory != null && !sharedMemory.setProtect(OsConstants.PROT_READ)) {
Slog.w(TAG, "Can't set sharedMemory to be read-only");