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

Commit 94a8045f authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 14003675 from 3dc7bbbc to 25Q4-release

Change-Id: I3e6fccecc1d8f800c922bfdfa2c72c6f527866ce
parents 9cc6aff6 3dc7bbbc
Loading
Loading
Loading
Loading
+102 −52
Original line number Diff line number Diff line
@@ -16,14 +16,15 @@

package android.conscrypt;

import org.conscrypt.ChannelType;
import static org.conscrypt.TestUtils.getCommonProtocolSuites;
import static org.conscrypt.TestUtils.newTextMessage;
import static org.junit.Assert.assertEquals;

import static org.junit.Assert.fail;
import android.conscrypt.ServerEndpoint.MessageProcessor;
import android.perftests.utils.BenchmarkState;
import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;
import java.io.IOException;
import java.io.OutputStream;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -33,20 +34,17 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;

import android.conscrypt.ServerEndpoint.MessageProcessor;

import android.perftests.utils.BenchmarkState;
import android.perftests.utils.PerfStatusReporter;
import androidx.test.filters.LargeTest;

import javax.net.ssl.SSLException;
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;

import org.junit.Rule;
import org.conscrypt.ChannelType;
import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runner.RunWith;
import org.junit.runners.model.Statement;

/**
 * Benchmark for comparing performance of server socket implementations.
@@ -55,7 +53,40 @@ import org.junit.runner.RunWith;
@LargeTest
public final class ServerSocketPerfTest {

    @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
    private static class RetryRule implements TestRule {
        private final int retryCount;

        RetryRule(int retryCount) {
            this.retryCount = retryCount;
        }

        @Override
        public Statement apply(Statement base, Description description) {
            return new Statement() {
                @Override
                public void evaluate() throws Throwable {
                    Throwable caughtThrowable = null;
                    for (int i = 0; i < retryCount; i++) {
                        try {
                            base.evaluate();
                            return;
                        } catch (Throwable t) {
                            caughtThrowable = t;
                        }
                    }
                    if (caughtThrowable != null) {
                        throw caughtThrowable;
                    }
                }
            };
        }
    }

    @Rule
    public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();

    @Rule
    public final TestRule retryRule = new RetryRule(3);

    /**
     * Provider for the benchmark configuration
@@ -98,14 +129,14 @@ public final class ServerSocketPerfTest {
        }
    }

    public Collection getParams() {
    public Collection<Object[]> getParams() {
        final List<Object[]> params = new ArrayList<>();
        for (EndpointFactory endpointFactory : EndpointFactory.values()) {
            for (ChannelType channelType : ChannelType.values()) {
                for (int messageSize : ConscryptParams.messageSizes) {
                    for (String cipher : ConscryptParams.ciphers) {
                        params.add(new Object[] {new Config(endpointFactory,
                            endpointFactory, messageSize, cipher, channelType)});
                        params.add(new Object[] {new Config(endpointFactory, endpointFactory,
                                messageSize, cipher, channelType)});
                    }
                }
            }
@@ -142,38 +173,42 @@ public final class ServerSocketPerfTest {

    private void setup(final Config config) throws Exception {
        recording.set(false);
        stopping = false;

        byte[] message = newTextMessage(config.messageSize());

        final ChannelType channelType = config.channelType();

        socketPair.server = config.serverFactory().newServer(config.messageSize(),
            new String[] {"TLSv1.3", "TLSv1.2"}, ciphers(config));
        socketPair.server = config.serverFactory().newServer(
                config.messageSize(), new String[] {"TLSv1.3", "TLSv1.2"}, ciphers(config));
        socketPair.server.init();
        socketPair.server.setMessageProcessor(new MessageProcessor() {
            @Override
            public void processMessage(byte[] inMessage, int numBytes, OutputStream os) {
                try {
                try {
                    while (!stopping) {
                        os.write(inMessage, 0, numBytes);
                    }
                    } finally {
                        os.flush();
                } catch (SSLException e) {
                    String msg = e.getMessage();
                    if (msg == null || !msg.contains("Connection reset by peer")) {
                        throw new RuntimeException(e);
                    }
                } catch (SocketException e) {
                    // Just ignore.
                } catch (IOException e) {
                    if (!stopping) {
                        throw new RuntimeException(e);
                    }
                } finally {
                    try {
                        os.flush();
                    } catch (IOException e) {
                    }
                }
            }
        });

        Future<?> connectedFuture = socketPair.server.start();

        // Always use the same client for consistency across the benchmarks.
        socketPair.client = config.clientFactory().newClient(
                ChannelType.CHANNEL, socketPair.server.port(),
        socketPair.client =
                config.clientFactory().newClient(ChannelType.CHANNEL, socketPair.server.port(),
                        new String[] {"TLSv1.3", "TLSv1.2"}, ciphers(config));
        socketPair.client.start();

@@ -191,16 +226,22 @@ public final class ServerSocketPerfTest {
                Thread thread = Thread.currentThread();
                byte[] buffer = new byte[config.messageSize()];
                while (!stopping && !thread.isInterrupted()) {
                    try {
                        int numBytes = socketPair.client.readMessage(buffer);
                        if (numBytes < 0) {
                            return;
                        }
                        assertEquals(config.messageSize(), numBytes);

                    // Increment the message counter if we're recording.
                        if (recording.get()) {
                            bytesCounter.addAndGet(numBytes);
                        }
                    } catch (Exception e) {
                        if (!stopping) {
                            fail("Client read failed: " + e.getMessage());
                        }
                        return;
                    }
                }
            }
        });
@@ -208,16 +249,24 @@ public final class ServerSocketPerfTest {

    void close() throws Exception {
        stopping = true;
        // Stop and wait for sending to complete.
        if (socketPair != null) {
            socketPair.close();
        }

        if (executor != null) {
            executor.shutdown();
            executor.awaitTermination(5, TimeUnit.SECONDS);
            if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
                executor.shutdownNow();
            }
        }

        if (receivingFuture != null) {
            try {
                receivingFuture.get(5, TimeUnit.SECONDS);
            } catch (Exception e) {
                // Ignore exceptions here, as the task may have been interrupted.
            }
        }

        if (socketPair != null) {
            socketPair.close();
        }
    }

@@ -230,6 +279,7 @@ public final class ServerSocketPerfTest {
            while (state.keepRunning()) {
                recording.set(true);
                while (bytesCounter.get() < config.messageSize()) {
                    Thread.yield();
                }
                bytesCounter.set(0);
                recording.set(false);
+1 −1
Original line number Diff line number Diff line
@@ -2974,8 +2974,8 @@ public final class JobStatus {
                    TimeUtils.formatDuration(job.getTriggerContentMaxDelay(), pw);
                    pw.println();
                }
                pw.print("Has media backup exemption", mHasMediaBackupExemption).println();
            }
            pw.print("Has media backup exemption", mHasMediaBackupExemption).println();
            if (job.getExtras() != null && !job.getExtras().isDefinitelyEmpty()) {
                pw.print("Extras: ");
                pw.println(job.getExtras().toShortString());
+4 −4
Original line number Diff line number Diff line
@@ -55161,7 +55161,7 @@ package android.view {
    field public static final int DRAG_FLAG_GLOBAL_SAME_APPLICATION = 4096; // 0x1000
    field public static final int DRAG_FLAG_GLOBAL_URI_READ = 1; // 0x1
    field public static final int DRAG_FLAG_GLOBAL_URI_WRITE = 2; // 0x2
    field @FlaggedApi("com.android.window.flags.supports_drag_assistant_to_multiwindow") public static final int DRAG_FLAG_HIDE_CALLING_TASK_ON_DRAG_START = 16384; // 0x4000
    field public static final int DRAG_FLAG_HIDE_CALLING_TASK_ON_DRAG_START = 16384; // 0x4000
    field public static final int DRAG_FLAG_OPAQUE = 512; // 0x200
    field public static final int DRAG_FLAG_START_INTENT_SENDER_ON_UNHANDLED_DRAG = 8192; // 0x2000
    field @Deprecated public static final int DRAWING_CACHE_QUALITY_AUTO = 0; // 0x0
@@ -63587,9 +63587,9 @@ package android.window {
    method public void markSyncReady();
  }
  @FlaggedApi("com.android.window.flags.predictive_back_system_override_callback") public final class SystemOnBackInvokedCallbacks {
    method @FlaggedApi("com.android.window.flags.predictive_back_system_override_callback") @NonNull public static android.window.OnBackInvokedCallback finishAndRemoveTaskCallback(@NonNull android.app.Activity);
    method @FlaggedApi("com.android.window.flags.predictive_back_system_override_callback") @NonNull public static android.window.OnBackInvokedCallback moveTaskToBackCallback(@NonNull android.app.Activity);
  public final class SystemOnBackInvokedCallbacks {
    method @NonNull public static android.window.OnBackInvokedCallback finishAndRemoveTaskCallback(@NonNull android.app.Activity);
    method @NonNull public static android.window.OnBackInvokedCallback moveTaskToBackCallback(@NonNull android.app.Activity);
  }
  public final class TrustedPresentationThresholds implements android.os.Parcelable {
+1 −0
Original line number Diff line number Diff line
@@ -2505,6 +2505,7 @@ public class ActivityOptions extends ComponentOptions {
        mSpecsFuture = otherOptions.mSpecsFuture;
        mRemoteAnimationAdapter = otherOptions.mRemoteAnimationAdapter;
        mLaunchIntoPipParams = otherOptions.mLaunchIntoPipParams;
        mLaunchDisplayId = otherOptions.mLaunchDisplayId;
        mIsEligibleForLegacyPermissionPrompt = otherOptions.mIsEligibleForLegacyPermissionPrompt;

        sendResultIgnoreErrors(mAnimationAbortListener, null);
+4 −2
Original line number Diff line number Diff line
@@ -11854,7 +11854,10 @@ public class Notification implements Parcelable
                        contentView.setViewVisibility(metricView.chronometerId(), View.VISIBLE);
                        contentView.setChronometerCountDown(
                                metricView.chronometerId(), timeDifference.isTimer());
                        contentView.setBoolean(metricView.chronometerId(),
                                "setUseAdaptiveFormat",
                                timeDifference.getFormat()
                                        == Metric.TimeDifference.FORMAT_ADAPTIVE);
                        if (timeDifference.getZeroTime() != null) {
                            contentView.setChronometer(metricView.chronometerId(),
                                    timeDifference.getZeroTime(), /* format= */ null,
@@ -11871,7 +11874,6 @@ public class Notification implements Parcelable
                                    "No zeroTime or pausedDuration for running TimeDifference in "
                                            + metric);
                        }
                        // TODO(b/434910979): implement format support for Chronometer.
                    } else {
                        contentView.setViewVisibility(metricView.chronometerId(), View.GONE);
                        contentView.setViewVisibility(metricView.textValueId(), View.VISIBLE);
Loading