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

Commit bccff980 authored by Ivan Chiang's avatar Ivan Chiang
Browse files

[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
parent 6ec1f430
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+3 −3
Original line number Diff line number Diff line
@@ -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) {
+5 −5
Original line number Diff line number Diff line
@@ -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) {