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

Commit 98955a62 authored by Santiago Seifert's avatar Santiago Seifert Committed by Android (Google) Code Review
Browse files

Merge "Address API renaming suggestions" into rvc-dev

parents e3f3fd1e 8e7b066a
Loading
Loading
Loading
Loading
+39 −39
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ import java.util.Map;
 *     @Override
 *     public void onSampleCompleted(
 *         int trackIndex,
 *         long timeUs,
 *         long timeMicros,
 *         int flags,
 *         int size,
 *         int offset,
@@ -163,7 +163,7 @@ import java.util.Map;
 *           /* destPos= */ 0,
 *           /* size= */ offset);
 *       bytesWrittenCount = bytesWrittenCount - offset;
 *       publishSample(sampleData, timeUs, flags);
 *       publishSample(sampleData, timeMicros, flags);
 *     }
 *
 *    private void ensureSpaceInBuffer(int numberOfBytesToRead) {
@@ -187,7 +187,7 @@ public final class MediaParser {
     */
    public static final class SeekMap {

        /** Returned by {@link #getDurationUs()} when the duration is unknown. */
        /** Returned by {@link #getDurationMicros()} when the duration is unknown. */
        public static final int UNKNOWN_DURATION = Integer.MIN_VALUE;

        private final com.google.android.exoplayer2.extractor.SeekMap mExoPlayerSeekMap;
@@ -205,26 +205,26 @@ public final class MediaParser {
         * Returns the duration of the stream in microseconds or {@link #UNKNOWN_DURATION} if the
         * duration is unknown.
         */
        public long getDurationUs() {
        public long getDurationMicros() {
            return mExoPlayerSeekMap.getDurationUs();
        }

        /**
         * Obtains {@link SeekPoint SeekPoints} for the specified seek time in microseconds.
         *
         * <p>{@code getSeekPoints(timeUs).first} contains the latest seek point for samples with
         * timestamp equal to or smaller than {@code timeUs}.
         * <p>{@code getSeekPoints(timeMicros).first} contains the latest seek point for samples
         * with timestamp equal to or smaller than {@code timeMicros}.
         *
         * <p>{@code getSeekPoints(timeUs).second} contains the earliest seek point for samples with
         * timestamp equal to or greater than {@code timeUs}. If a seek point exists for {@code
         * timeUs}, the returned pair will contain the same {@link SeekPoint} twice.
         * <p>{@code getSeekPoints(timeMicros).second} contains the earliest seek point for samples
         * with timestamp equal to or greater than {@code timeMicros}. If a seek point exists for
         * {@code timeMicros}, the returned pair will contain the same {@link SeekPoint} twice.
         *
         * @param timeUs A seek time in microseconds.
         * @param timeMicros A seek time in microseconds.
         * @return The corresponding {@link SeekPoint SeekPoints}.
         */
        @NonNull
        public Pair<SeekPoint, SeekPoint> getSeekPoints(long timeUs) {
            SeekPoints seekPoints = mExoPlayerSeekMap.getSeekPoints(timeUs);
        public Pair<SeekPoint, SeekPoint> getSeekPoints(long timeMicros) {
            SeekPoints seekPoints = mExoPlayerSeekMap.getSeekPoints(timeMicros);
            return new Pair<>(toSeekPoint(seekPoints.first), toSeekPoint(seekPoints.second));
        }
    }
@@ -254,24 +254,24 @@ public final class MediaParser {
        @NonNull public static final SeekPoint START = new SeekPoint(0, 0);

        /** The time of the seek point, in microseconds. */
        public final long timeUs;
        public final long timeMicros;

        /** The byte offset of the seek point. */
        public final long position;

        /**
         * @param timeUs The time of the seek point, in microseconds.
         * @param timeMicros The time of the seek point, in microseconds.
         * @param position The byte offset of the seek point.
         */
        private SeekPoint(long timeUs, long position) {
            this.timeUs = timeUs;
        private SeekPoint(long timeMicros, long position) {
            this.timeMicros = timeMicros;
            this.position = position;
        }

        @Override
        @NonNull
        public String toString() {
            return "[timeUs=" + timeUs + ", position=" + position + "]";
            return "[timeMicros=" + timeMicros + ", position=" + position + "]";
        }

        @Override
@@ -283,12 +283,12 @@ public final class MediaParser {
                return false;
            }
            SeekPoint other = (SeekPoint) obj;
            return timeUs == other.timeUs && position == other.position;
            return timeMicros == other.timeMicros && position == other.position;
        }

        @Override
        public int hashCode() {
            int result = (int) timeUs;
            int result = (int) timeMicros;
            result = 31 * result + (int) position;
            return result;
        }
@@ -345,25 +345,25 @@ public final class MediaParser {
         *
         * @param seekMap The extracted {@link SeekMap}.
         */
        void onSeekMap(@NonNull SeekMap seekMap);
        void onSeekMapFound(@NonNull SeekMap seekMap);

        /**
         * Called when the number of tracks is found.
         *
         * @param numberOfTracks The number of tracks in the stream.
         */
        void onTracksFound(int numberOfTracks);
        void onTrackCountFound(int numberOfTracks);

        /**
         * Called when new {@link TrackData} is extracted from the stream.
         * Called when new {@link TrackData} is found in the stream.
         *
         * @param trackIndex The index of the track for which the {@link TrackData} was extracted.
         * @param trackData The extracted {@link TrackData}.
         */
        void onTrackData(int trackIndex, @NonNull TrackData trackData);
        void onTrackDataFound(int trackIndex, @NonNull TrackData trackData);

        /**
         * Called to write sample data to the output.
         * Called when sample data is found in the stream.
         *
         * <p>If the invocation of this method returns before the entire {@code inputReader} {@link
         * InputReader#getLength() length} is consumed, the method will be called again for the
@@ -374,15 +374,15 @@ public final class MediaParser {
         * @param inputReader The {@link InputReader} from which to read the data.
         * @throws IOException If an exception occurs while reading from {@code inputReader}.
         */
        void onSampleData(int trackIndex, @NonNull InputReader inputReader) throws IOException;
        void onSampleDataFound(int trackIndex, @NonNull InputReader inputReader) throws IOException;

        /**
         * Called once all the data of a sample has been passed to {@link #onSampleData}.
         * Called once all the data of a sample has been passed to {@link #onSampleDataFound}.
         *
         * <p>Also includes sample metadata, like presentation timestamp and flags.
         *
         * @param trackIndex The index of the track to which the sample corresponds.
         * @param timeUs The media timestamp associated with the sample, in microseconds.
         * @param timeMicros The media timestamp associated with the sample, in microseconds.
         * @param flags Flags associated with the sample. See {@link MediaCodec
         *     MediaCodec.BUFFER_FLAG_*}.
         * @param size The size of the sample data, in bytes.
@@ -394,7 +394,7 @@ public final class MediaParser {
         */
        void onSampleCompleted(
                int trackIndex,
                long timeUs,
                long timeMicros,
                int flags,
                int size,
                int offset,
@@ -632,7 +632,7 @@ public final class MediaParser {
    private Extractor mExtractor;
    private ExtractorInput mExtractorInput;
    private long mPendingSeekPosition;
    private long mPendingSeekTimeUs;
    private long mPendingSeekTimeMicros;

    // Public methods.

@@ -760,7 +760,7 @@ public final class MediaParser {
        }

        if (isPendingSeek()) {
            mExtractor.seek(mPendingSeekPosition, mPendingSeekTimeUs);
            mExtractor.seek(mPendingSeekPosition, mPendingSeekTimeMicros);
            removePendingSeek();
        }

@@ -786,7 +786,7 @@ public final class MediaParser {
     * Seeks within the media container being extracted.
     *
     * <p>{@link SeekPoint SeekPoints} can be obtained from the {@link SeekMap} passed to {@link
     * OutputConsumer#onSeekMap(SeekMap)}.
     * OutputConsumer#onSeekMapFound(SeekMap)}.
     *
     * <p>Following a call to this method, the {@link InputReader} passed to the next invocation of
     * {@link #advance} must provide data starting from {@link SeekPoint#position} in the stream.
@@ -796,9 +796,9 @@ public final class MediaParser {
    public void seek(@NonNull SeekPoint seekPoint) {
        if (mExtractor == null) {
            mPendingSeekPosition = seekPoint.position;
            mPendingSeekTimeUs = seekPoint.timeUs;
            mPendingSeekTimeMicros = seekPoint.timeMicros;
        } else {
            mExtractor.seek(seekPoint.position, seekPoint.timeUs);
            mExtractor.seek(seekPoint.position, seekPoint.timeMicros);
        }
    }

@@ -836,7 +836,7 @@ public final class MediaParser {

    private void removePendingSeek() {
        mPendingSeekPosition = -1;
        mPendingSeekTimeUs = -1;
        mPendingSeekTimeMicros = -1;
    }

    // Private classes.
@@ -897,12 +897,12 @@ public final class MediaParser {

        @Override
        public void endTracks() {
            mOutputConsumer.onTracksFound(mTrackOutputAdapters.size());
            mOutputConsumer.onTrackCountFound(mTrackOutputAdapters.size());
        }

        @Override
        public void seekMap(com.google.android.exoplayer2.extractor.SeekMap exoplayerSeekMap) {
            mOutputConsumer.onSeekMap(new SeekMap(exoplayerSeekMap));
            mOutputConsumer.onSeekMapFound(new SeekMap(exoplayerSeekMap));
        }
    }

@@ -916,7 +916,7 @@ public final class MediaParser {

        @Override
        public void format(Format format) {
            mOutputConsumer.onTrackData(
            mOutputConsumer.onTrackDataFound(
                    mTrackIndex,
                    new TrackData(
                            toMediaFormat(format), toFrameworkDrmInitData(format.drmInitData)));
@@ -927,7 +927,7 @@ public final class MediaParser {
                throws IOException {
            mScratchExtractorInputAdapter.setExtractorInput(input, length);
            long positionBeforeReading = mScratchExtractorInputAdapter.getPosition();
            mOutputConsumer.onSampleData(mTrackIndex, mScratchExtractorInputAdapter);
            mOutputConsumer.onSampleDataFound(mTrackIndex, mScratchExtractorInputAdapter);
            return (int) (mScratchExtractorInputAdapter.getPosition() - positionBeforeReading);
        }

@@ -935,7 +935,7 @@ public final class MediaParser {
        public void sampleData(ParsableByteArray data, int length) {
            mScratchParsableByteArrayAdapter.resetWithByteArray(data, length);
            try {
                mOutputConsumer.onSampleData(mTrackIndex, mScratchParsableByteArrayAdapter);
                mOutputConsumer.onSampleDataFound(mTrackIndex, mScratchParsableByteArrayAdapter);
            } catch (IOException e) {
                // Unexpected.
                throw new RuntimeException(e);
+6 −6
Original line number Diff line number Diff line
@@ -26449,14 +26449,14 @@ package android.media {
  public static interface MediaParser.OutputConsumer {
    method public void onSampleCompleted(int, long, int, int, int, @Nullable android.media.MediaCodec.CryptoInfo);
    method public void onSampleData(int, @NonNull android.media.MediaParser.InputReader) throws java.io.IOException;
    method public void onSeekMap(@NonNull android.media.MediaParser.SeekMap);
    method public void onTrackData(int, @NonNull android.media.MediaParser.TrackData);
    method public void onTracksFound(int);
    method public void onSampleDataFound(int, @NonNull android.media.MediaParser.InputReader) throws java.io.IOException;
    method public void onSeekMapFound(@NonNull android.media.MediaParser.SeekMap);
    method public void onTrackCountFound(int);
    method public void onTrackDataFound(int, @NonNull android.media.MediaParser.TrackData);
  }
  public static final class MediaParser.SeekMap {
    method public long getDurationUs();
    method public long getDurationMicros();
    method @NonNull public android.util.Pair<android.media.MediaParser.SeekPoint,android.media.MediaParser.SeekPoint> getSeekPoints(long);
    method public boolean isSeekable();
    field public static final int UNKNOWN_DURATION = -2147483648; // 0x80000000
@@ -26465,7 +26465,7 @@ package android.media {
  public static final class MediaParser.SeekPoint {
    field @NonNull public static final android.media.MediaParser.SeekPoint START;
    field public final long position;
    field public final long timeUs;
    field public final long timeMicros;
  }
  public static interface MediaParser.SeekableInputReader extends android.media.MediaParser.InputReader {
+74 −9
Original line number Diff line number Diff line
@@ -15,6 +15,16 @@ ArrayReturn: android.app.Notification.MessagingStyle.Message#getMessagesFromBund
    
ArrayReturn: android.content.ContentProviderOperation#resolveExtrasBackReferences(android.content.ContentProviderResult[], int) parameter #0:
    
ArrayReturn: android.location.GnssAntennaInfo.SphericalCorrections#SphericalCorrections(double[][], double[][]) parameter #0:
    Method parameter should be Collection<> (or subclass) instead of raw array; was `double[][]`
ArrayReturn: android.location.GnssAntennaInfo.SphericalCorrections#SphericalCorrections(double[][], double[][]) parameter #1:
    Method parameter should be Collection<> (or subclass) instead of raw array; was `double[][]`
ArrayReturn: android.location.GnssAntennaInfo.SphericalCorrections#getCorrectionUncertaintiesArray():
    Method should return Collection<> (or subclass) instead of raw array; was `double[][]`
ArrayReturn: android.location.GnssAntennaInfo.SphericalCorrections#getCorrectionsArray():
    Method should return Collection<> (or subclass) instead of raw array; was `double[][]`
ArrayReturn: android.service.autofill.FillResponse.Builder#setAuthentication(android.view.autofill.AutofillId[], android.content.IntentSender, android.widget.RemoteViews, android.service.autofill.InlinePresentation) parameter #0:
    Method parameter should be Collection<AutofillId> (or subclass) instead of raw array; was `android.view.autofill.AutofillId[]`


BroadcastBehavior: android.app.AlarmManager#ACTION_NEXT_ALARM_CLOCK_CHANGED:
@@ -453,8 +463,12 @@ DeprecationMismatch: javax.microedition.khronos.egl.EGL10#eglCreatePixmapSurface
    


ExecutorRegistration: android.media.MediaRouter2#setOnGetControllerHintsListener(android.media.MediaRouter2.OnGetControllerHintsListener):
    Registration methods should have overload that accepts delivery Executor: `setOnGetControllerHintsListener`


GenericException: android.content.res.loader.ResourcesProvider#finalize():
    Methods must not throw generic exceptions (`java.lang.Throwable`)
    


HiddenSuperclass: android.content.res.ColorStateList:
@@ -499,6 +513,30 @@ HiddenSuperclass: android.util.StatsLog:
    


IntentBuilderName: android.net.VpnManager#provisionVpnProfile(android.net.PlatformVpnProfile):
    Methods creating an Intent should be named `create<Foo>Intent()`, was `provisionVpnProfile`


KotlinOperator: android.media.AudioMetadata.Map#set(android.media.AudioMetadata.Key<T>, T):
    Method can be invoked with an indexing operator from Kotlin: `set` (this is usually desirable; just make sure it makes sense for this type of object)
KotlinOperator: android.media.AudioMetadata.ReadMap#get(android.media.AudioMetadata.Key<T>):
    Method can be invoked with an indexing operator from Kotlin: `get` (this is usually desirable; just make sure it makes sense for this type of object)


MethodNameUnits: android.media.MediaParser.SeekMap#getDurationMicros():
    Returned time values are strongly encouraged to be in milliseconds unless you need the extra precision, was `getDurationMicros`


MinMaxConstant: android.telephony.DataFailCause#MAX_ACCESS_PROBE:
    If min/max could change in future, make them dynamic methods: android.telephony.DataFailCause#MAX_ACCESS_PROBE
MinMaxConstant: android.telephony.DataFailCause#MAX_IPV4_CONNECTIONS:
    If min/max could change in future, make them dynamic methods: android.telephony.DataFailCause#MAX_IPV4_CONNECTIONS
MinMaxConstant: android.telephony.DataFailCause#MAX_IPV6_CONNECTIONS:
    If min/max could change in future, make them dynamic methods: android.telephony.DataFailCause#MAX_IPV6_CONNECTIONS
MinMaxConstant: android.telephony.DataFailCause#MAX_PPP_INACTIVITY_TIMER_EXPIRED:
    If min/max could change in future, make them dynamic methods: android.telephony.DataFailCause#MAX_PPP_INACTIVITY_TIMER_EXPIRED


MissingNullability: android.app.AsyncNotedAppOp#equals(Object) parameter #0:
    
MissingNullability: android.app.AsyncNotedAppOp#writeToParcel(android.os.Parcel, int) parameter #0:
@@ -506,11 +544,11 @@ MissingNullability: android.app.AsyncNotedAppOp#writeToParcel(android.os.Parcel,
MissingNullability: android.app.SyncNotedAppOp#equals(Object) parameter #0:
    
MissingNullability: android.icu.lang.UCharacter.UnicodeBlock#CHORASMIAN:
    Missing nullability on field `CHORASMIAN` in class `class android.icu.lang.UCharacter.UnicodeBlock`
    
MissingNullability: android.icu.lang.UCharacter.UnicodeBlock#CJK_UNIFIED_IDEOGRAPHS_EXTENSION_G:
    Missing nullability on field `CJK_UNIFIED_IDEOGRAPHS_EXTENSION_G` in class `class android.icu.lang.UCharacter.UnicodeBlock`
    
MissingNullability: android.icu.lang.UCharacter.UnicodeBlock#DIVES_AKURU:
    Missing nullability on field `DIVES_AKURU` in class `class android.icu.lang.UCharacter.UnicodeBlock`
    
MissingNullability: android.icu.lang.UCharacter.UnicodeBlock#EGYPTIAN_HIEROGLYPH_FORMAT_CONTROLS:
    
MissingNullability: android.icu.lang.UCharacter.UnicodeBlock#ELYMAIC:
@@ -556,14 +594,39 @@ MissingNullability: android.icu.util.VersionInfo#UNICODE_12_0:
MissingNullability: android.icu.util.VersionInfo#UNICODE_12_1:
    
MissingNullability: android.icu.util.VersionInfo#UNICODE_13_0:
    Missing nullability on field `UNICODE_13_0` in class `class android.icu.util.VersionInfo`
    
MissingNullability: android.media.MediaMetadataRetriever#getFrameAtTime(long, int, android.media.MediaMetadataRetriever.BitmapParams):
    
MissingNullability: android.media.MediaMetadataRetriever#getScaledFrameAtTime(long, int, int, int, android.media.MediaMetadataRetriever.BitmapParams):
    
    
MissingNullability: java.time.chrono.JapaneseEra#REIWA:
    Missing nullability on field `REIWA` in class `class java.time.chrono.JapaneseEra`
    


NotCloseable: android.media.MediaCodec.GraphicBlock:
    Classes that release resources (finalize()) should implement AutoClosable and CloseGuard: class android.media.MediaCodec.GraphicBlock
NotCloseable: android.media.MediaCodec.LinearBlock:
    Classes that release resources (finalize()) should implement AutoClosable and CloseGuard: class android.media.MediaCodec.LinearBlock
NotCloseable: android.media.MediaParser:
    Classes that release resources (release()) should implement AutoClosable and CloseGuard: class android.media.MediaParser
NotCloseable: android.media.MediaRouter2.RoutingController:
    Classes that release resources (release()) should implement AutoClosable and CloseGuard: class android.media.MediaRouter2.RoutingController
NotCloseable: android.util.CloseGuard:
    Classes that release resources (close()) should implement AutoClosable and CloseGuard: class android.util.CloseGuard
NotCloseable: android.view.SurfaceControlViewHost:
    Classes that release resources (release()) should implement AutoClosable and CloseGuard: class android.view.SurfaceControlViewHost


OnNameExpected: android.app.admin.DevicePolicyKeyguardService#dismiss():
    If implemented by developer, should follow the on<Something> style; otherwise consider marking final
OnNameExpected: android.service.controls.ControlsProviderService#createPublisherFor(java.util.List<java.lang.String>):
    Methods implemented by developers should follow the on<Something> style, was `createPublisherFor`
OnNameExpected: android.service.controls.ControlsProviderService#createPublisherForAllAvailable():
    Methods implemented by developers should follow the on<Something> style, was `createPublisherForAllAvailable`
OnNameExpected: android.service.controls.ControlsProviderService#createPublisherForSuggested():
    If implemented by developer, should follow the on<Something> style; otherwise consider marking final
OnNameExpected: android.service.controls.ControlsProviderService#performControlAction(String, android.service.controls.actions.ControlAction, java.util.function.Consumer<java.lang.Integer>):
    Methods implemented by developers should follow the on<Something> style, was `performControlAction`


RequiresPermission: android.accounts.AccountManager#getAccountsByTypeAndFeatures(String, String[], android.accounts.AccountManagerCallback<android.accounts.Account[]>, android.os.Handler):
@@ -1192,8 +1255,10 @@ SamShouldBeLast: android.location.LocationManager#requestLocationUpdates(long, f
    


StreamFiles: android.content.res.loader.DirectoryAssetsProvider#DirectoryAssetsProvider(java.io.File):
    Methods accepting `File` should also accept `FileDescriptor` or streams: constructor android.content.res.loader.DirectoryAssetsProvider(java.io.File)
StreamFiles: android.content.res.loader.DirectoryResourceLoader#DirectoryResourceLoader(java.io.File):
    Methods accepting `File` should also accept `FileDescriptor` or streams: constructor android.content.res.loader.DirectoryResourceLoader(java.io.File)
    


Todo: android.hardware.camera2.params.StreamConfigurationMap: