[VoiceInteraction] Update nullability to showSession methods

These parameters are Nullable originally. We updated it to @NonNull with some misunderstandings before. We should update it correctly to avoid that we don't handle the null case in the future.

Test: m
Bug: 265433409
Change-Id: I2c1d5ee0b199a56ad84ee8920b2df64903463f97
This commit is contained in:
Ivan Chiang
2023-01-17 09:05:01 +00:00
parent 6ec1f4309d
commit bccff98004
3 changed files with 9 additions and 9 deletions

View File

@@ -39,7 +39,7 @@ public abstract class VoiceInteractionManagerInternal {
* @param options A Bundle of private arguments to the current voice interaction service
*/
public abstract void startLocalVoiceInteraction(@NonNull IBinder callingActivity,
@Nullable String attributionTag, @NonNull Bundle options);
@Nullable String attributionTag, @Nullable Bundle options);
/**
* Returns whether the currently selected voice interaction service supports local voice

View File

@@ -81,7 +81,7 @@ public class AssistUtils {
* IVoiceInteractionSessionShowCallback, IBinder)} instead
*/
@Deprecated
public boolean showSessionForActiveService(@NonNull Bundle args, int sourceFlags,
public boolean showSessionForActiveService(@Nullable Bundle args, int sourceFlags,
@Nullable IVoiceInteractionSessionShowCallback showCallback,
@Nullable IBinder activityToken) {
return showSessionForActiveServiceInternal(args, sourceFlags, /* attributionTag */ null,
@@ -99,7 +99,7 @@ public class AssistUtils {
* @param showCallback optional callback to be notified when the session was shown
* @param activityToken optional token of activity that needs to be on top
*/
public boolean showSessionForActiveService(@NonNull Bundle args, int sourceFlags,
public boolean showSessionForActiveService(@Nullable Bundle args, int sourceFlags,
@Nullable String attributionTag,
@Nullable IVoiceInteractionSessionShowCallback showCallback,
@Nullable IBinder activityToken) {
@@ -107,7 +107,7 @@ public class AssistUtils {
activityToken);
}
private boolean showSessionForActiveServiceInternal(@NonNull Bundle args, int sourceFlags,
private boolean showSessionForActiveServiceInternal(@Nullable Bundle args, int sourceFlags,
@Nullable String attributionTag,
@Nullable IVoiceInteractionSessionShowCallback showCallback,
@Nullable IBinder activityToken) {

View File

@@ -229,7 +229,7 @@ public class VoiceInteractionManagerService extends SystemService {
class LocalService extends VoiceInteractionManagerInternal {
@Override
public void startLocalVoiceInteraction(@NonNull IBinder callingActivity,
@Nullable String attributionTag, @NonNull Bundle options) {
@Nullable String attributionTag, @Nullable Bundle options) {
if (DEBUG) {
Slog.i(TAG, "startLocalVoiceInteraction " + callingActivity);
}
@@ -425,7 +425,7 @@ public class VoiceInteractionManagerService extends SystemService {
// TODO: VI Make sure the caller is the current user or profile
void startLocalVoiceInteraction(@NonNull final IBinder token,
@Nullable String attributionTag, @NonNull Bundle options) {
@Nullable String attributionTag, @Nullable Bundle options) {
if (mImpl == null) return;
final int callingUid = Binder.getCallingUid();
@@ -944,7 +944,7 @@ public class VoiceInteractionManagerService extends SystemService {
}
@Override
public void showSession(@NonNull Bundle args, int flags, @Nullable String attributionTag) {
public void showSession(@Nullable Bundle args, int flags, @Nullable String attributionTag) {
synchronized (this) {
enforceIsCurrentVoiceInteractionService();
@@ -975,7 +975,7 @@ public class VoiceInteractionManagerService extends SystemService {
}
@Override
public boolean showSessionFromSession(@NonNull IBinder token, @NonNull Bundle sessionArgs,
public boolean showSessionFromSession(@NonNull IBinder token, @Nullable Bundle sessionArgs,
int flags, @Nullable String attributionTag) {
synchronized (this) {
if (mImpl == null) {
@@ -1794,7 +1794,7 @@ public class VoiceInteractionManagerService extends SystemService {
@android.annotation.EnforcePermission(android.Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE)
@Override
public boolean showSessionForActiveService(@NonNull Bundle args, int sourceFlags,
public boolean showSessionForActiveService(@Nullable Bundle args, int sourceFlags,
@Nullable String attributionTag,
@Nullable IVoiceInteractionSessionShowCallback showCallback,
@Nullable IBinder activityToken) {