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

Commit 5fa2cfa9 authored by Joanne's avatar Joanne
Browse files

Add nullability annotation for VISS#onShow()

The VISS#onShow Bundle argument is provided by showSession. The
VIS#showSession() doesn’t do null check, so it is possible the Bundle
parameter in VISS#onShow will be null. The argument has been
@Nullable for a few releases, but we never marked nullability. We add
nullability for the Bundle parameter to avoid the developer skipping
to do null check that may break the application. In Android 14, the
389401c7 add an id into Bundle, the
Bundle will not be null starting from Android 14 but the argument
was still Nullable in older platforms. We also update the javadoc
to mention this case.

Bug: 178775773
Test: build pass
Change-Id: I175db4e61a2cf5b49b122f94f72c57bb5a154d85
parent 37ea02ca
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -40580,7 +40580,7 @@ package android.service.voice {
    method public void onRequestCompleteVoice(android.service.voice.VoiceInteractionSession.CompleteVoiceRequest);
    method public void onRequestCompleteVoice(android.service.voice.VoiceInteractionSession.CompleteVoiceRequest);
    method public void onRequestConfirmation(android.service.voice.VoiceInteractionSession.ConfirmationRequest);
    method public void onRequestConfirmation(android.service.voice.VoiceInteractionSession.ConfirmationRequest);
    method public void onRequestPickOption(android.service.voice.VoiceInteractionSession.PickOptionRequest);
    method public void onRequestPickOption(android.service.voice.VoiceInteractionSession.PickOptionRequest);
    method public void onShow(android.os.Bundle, int);
    method public void onShow(@Nullable android.os.Bundle, int);
    method public void onTaskFinished(android.content.Intent, int);
    method public void onTaskFinished(android.content.Intent, int);
    method public void onTaskStarted(android.content.Intent, int);
    method public void onTaskStarted(android.content.Intent, int);
    method public void onTrimMemory(int);
    method public void onTrimMemory(int);
+4 −2
Original line number Original line Diff line number Diff line
@@ -1767,11 +1767,13 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
     * Intent.EXTRA_TIME ("android.intent.extra.TIME") indicating timing
     * Intent.EXTRA_TIME ("android.intent.extra.TIME") indicating timing
     * in milliseconds of the KeyEvent that triggered Assistant and
     * in milliseconds of the KeyEvent that triggered Assistant and
     * Intent.EXTRA_ASSIST_INPUT_DEVICE_ID (android.intent.extra.ASSIST_INPUT_DEVICE_ID)
     * Intent.EXTRA_ASSIST_INPUT_DEVICE_ID (android.intent.extra.ASSIST_INPUT_DEVICE_ID)
     *  referring to the device that sent the request.
     *  referring to the device that sent the request. Starting from Android 14, the system will
     * add {@link VoiceInteractionService#KEY_SHOW_SESSION_ID}, the Bundle is not null. But the
     * application should handle null case before Android 14.
     * @param showFlags The show flags originally provided to
     * @param showFlags The show flags originally provided to
     * {@link VoiceInteractionService#showSession VoiceInteractionService.showSession}.
     * {@link VoiceInteractionService#showSession VoiceInteractionService.showSession}.
     */
     */
    public void onShow(Bundle args, int showFlags) {
    public void onShow(@Nullable Bundle args, int showFlags) {
    }
    }


    /**
    /**