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

Commit 96150ed2 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12296955 from c6041993 to 24Q4-release

Change-Id: If982ef939660b6aac351aba046cd50c57905e152
parents 488bdc28 c6041993
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -438,9 +438,22 @@ aconfig_declarations {
    name: "android.companion.virtualdevice.flags-aconfig",
    package: "android.companion.virtualdevice.flags",
    container: "system",
    exportable: true,
    srcs: ["core/java/android/companion/virtual/flags/*.aconfig"],
}

java_aconfig_library {
    name: "android.companion.virtualdevice.flags-aconfig-java-export",
    aconfig_declarations: "android.companion.virtualdevice.flags-aconfig",
    defaults: ["framework-minus-apex-aconfig-java-defaults"],
    mode: "exported",
    min_sdk_version: "30",
    apex_available: [
        "//apex_available:platform",
        "com.android.permission",
    ],
}

java_aconfig_library {
    name: "android.companion.virtual.flags-aconfig-java",
    aconfig_declarations: "android.companion.virtual.flags-aconfig",
+88 −30
Original line number Diff line number Diff line
@@ -15,43 +15,54 @@
 */
package com.android.internal.protolog;

import android.perftests.utils.BenchmarkState;
import android.perftests.utils.PerfStatusReporter;
import android.app.Activity;
import android.os.Bundle;
import android.perftests.utils.Stats;

import androidx.test.InstrumentationRegistry;

import com.android.internal.protolog.common.IProtoLogGroup;
import com.android.internal.protolog.common.LogLevel;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collection;

@RunWith(Parameterized.class)
public class ProtoLogPerfTest {
    @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
    private final boolean mLogToProto;
    private final boolean mLogToLogcat;

    @Parameters(name="logToProto_{0}_logToLogcat_{1}")
    /**
     * Generates the parameters used for this test class
     */
    @Parameters(name = "LOG_TO_{0}")
    public static Collection<Object[]> params() {
        return Arrays.asList(new Object[][] {
                { true, true },
                { true, false },
                { false, true },
                { false, false }
        });
        var params = new ArrayList<Object[]>();

        for (LogTo logTo : LogTo.values()) {
            params.add(new Object[] { logTo });
        }

    private final boolean mLogToProto;
    private final boolean mLogToLogcat;
        return params;
    }

    public ProtoLogPerfTest(LogTo logTo) {
        mLogToProto = switch (logTo) {
            case ALL, PROTO_ONLY -> true;
            case LOGCAT_ONLY, NONE -> false;
        };

    public ProtoLogPerfTest(boolean logToProto, boolean logToLogcat) {
        mLogToProto = logToProto;
        mLogToLogcat = logToLogcat;
        mLogToLogcat = switch (logTo) {
            case ALL, LOGCAT_ONLY -> true;
            case PROTO_ONLY, NONE -> false;
        };
    }

    @BeforeClass
@@ -66,11 +77,11 @@ public class ProtoLogPerfTest {
    }

    @Test
    public void logProcessedProtoLogMessageWithoutArgs() {
    public void log_Processed_NoArgs() {
        final var protoLog = ProtoLog.getSingleInstance();
        final var perfMonitor = new PerfMonitor();

        BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
        while (state.keepRunning()) {
        while (perfMonitor.keepRunning()) {
            protoLog.log(
                    LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 123,
                    0, (Object[]) null);
@@ -78,11 +89,11 @@ public class ProtoLogPerfTest {
    }

    @Test
    public void logProcessedProtoLogMessageWithArgs() {
    public void log_Processed_WithArgs() {
        final var protoLog = ProtoLog.getSingleInstance();
        final var perfMonitor = new PerfMonitor();

        BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
        while (state.keepRunning()) {
        while (perfMonitor.keepRunning()) {
            protoLog.log(
                    LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 123,
                    0b1110101001010100,
@@ -91,18 +102,58 @@ public class ProtoLogPerfTest {
    }

    @Test
    public void logNonProcessedProtoLogMessageWithNoArgs() {
        BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
        while (state.keepRunning()) {
    public void log_Unprocessed_NoArgs() {
        final var perfMonitor = new PerfMonitor();

        while (perfMonitor.keepRunning()) {
            ProtoLog.d(TestProtoLogGroup.TEST_GROUP, "Test message");
        }
    }

    @Test
    public void logNonProcessedProtoLogMessageWithArgs() {
        BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
        while (state.keepRunning()) {
            ProtoLog.d(TestProtoLogGroup.TEST_GROUP, "Test messag %s, %d, %b", "arg1", 2, true);
    public void log_Unprocessed_WithArgs() {
        final var perfMonitor = new PerfMonitor();

        while (perfMonitor.keepRunning()) {
            ProtoLog.d(TestProtoLogGroup.TEST_GROUP, "Test message %s, %d, %b", "arg1", 2, true);
        }
    }

    private class PerfMonitor {
        private int mIteration = 0;

        private static final int WARM_UP_ITERATIONS = 10;
        private static final int ITERATIONS = 1000;

        private final ArrayList<Long> mResults = new ArrayList<>();

        private long mStartTimeNs;

        public boolean keepRunning() {
            final long currentTime = System.nanoTime();

            mIteration++;

            if (mIteration > ITERATIONS) {
                reportResults();
                return false;
            }

            if (mIteration > WARM_UP_ITERATIONS) {
                mResults.add(currentTime - mStartTimeNs);
            }

            mStartTimeNs = System.nanoTime();
            return true;
        }

        public void reportResults() {
            final var stats = new Stats(mResults);

            Bundle status = new Bundle();
            status.putLong("protologging_time_mean_ns", (long) stats.getMean());
            status.putLong("protologging_time_median_ns", (long) stats.getMedian());
            InstrumentationRegistry.getInstrumentation().sendStatus(Activity.RESULT_OK, status);
        }
    }

@@ -168,4 +219,11 @@ public class ProtoLogPerfTest {
            return ordinal();
        }
    }

    private enum LogTo {
        PROTO_ONLY,
        LOGCAT_ONLY,
        ALL,
        NONE,
    }
}
+10 −0
Original line number Diff line number Diff line
@@ -65,3 +65,13 @@ flag {
   description: "Remove started user if user will be stopped due to user switch"
   bug: "321598070"
}

flag {
   name: "use_correct_process_state_for_logging"
   namespace: "backstage_power"
   description: "Use correct process state for statsd logging"
   bug: "361308212"
   metadata {
       purpose: PURPOSE_BUGFIX
   }
}
+17 −2
Original line number Diff line number Diff line
@@ -473,6 +473,14 @@ public final class JobServiceContext implements ServiceConnection {
            mInitialDownloadedBytesFromCalling = TrafficStats.getUidRxBytes(job.getUid());
            mInitialUploadedBytesFromCalling = TrafficStats.getUidTxBytes(job.getUid());

            int procState = mService.getUidProcState(job.getUid());
            if (Flags.useCorrectProcessStateForLogging()
                    && procState > ActivityManager.PROCESS_STATE_TRANSIENT_BACKGROUND) {
                // Try to get the latest proc state from AMS, there might be some delay
                // for the proc states worse than TRANSIENT_BACKGROUND.
                procState = mActivityManagerInternal.getUidProcessState(job.getUid());
            }

            FrameworkStatsLog.write(FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED,
                    job.isProxyJob() ? new int[]{sourceUid, job.getUid()} : new int[]{sourceUid},
                    // Given that the source tag is set by the calling app, it should be connected
@@ -517,7 +525,7 @@ public final class JobServiceContext implements ServiceConnection {
                    job.getEstimatedNetworkDownloadBytes(),
                    job.getEstimatedNetworkUploadBytes(),
                    job.getWorkCount(),
                    ActivityManager.processStateAmToProto(mService.getUidProcState(job.getUid())),
                    ActivityManager.processStateAmToProto(procState),
                    job.getNamespaceHash(),
                    /* system_measured_source_download_bytes */ 0,
                    /* system_measured_source_upload_bytes */ 0,
@@ -1528,6 +1536,13 @@ public final class JobServiceContext implements ServiceConnection {
        mJobPackageTracker.noteInactive(completedJob,
                loggingInternalStopReason, loggingDebugReason);
        final int sourceUid = completedJob.getSourceUid();
        int procState = mService.getUidProcState(completedJob.getUid());
        if (Flags.useCorrectProcessStateForLogging()
                && procState > ActivityManager.PROCESS_STATE_TRANSIENT_BACKGROUND) {
            // Try to get the latest proc state from AMS, there might be some delay
            // for the proc states worse than TRANSIENT_BACKGROUND.
            procState = mActivityManagerInternal.getUidProcessState(completedJob.getUid());
        }
        FrameworkStatsLog.write(FrameworkStatsLog.SCHEDULED_JOB_STATE_CHANGED,
                completedJob.isProxyJob()
                        ? new int[]{sourceUid, completedJob.getUid()} : new int[]{sourceUid},
@@ -1573,7 +1588,7 @@ public final class JobServiceContext implements ServiceConnection {
                completedJob.getEstimatedNetworkUploadBytes(),
                completedJob.getWorkCount(),
                ActivityManager
                        .processStateAmToProto(mService.getUidProcState(completedJob.getUid())),
                        .processStateAmToProto(procState),
                completedJob.getNamespaceHash(),
                TrafficStats.getUidRxBytes(completedJob.getSourceUid())
                        - mInitialDownloadedBytesFromSource,
+9 −6
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ package android {
    field public static final String MANAGE_DEVICE_POLICY_APPS_CONTROL = "android.permission.MANAGE_DEVICE_POLICY_APPS_CONTROL";
    field public static final String MANAGE_DEVICE_POLICY_APP_RESTRICTIONS = "android.permission.MANAGE_DEVICE_POLICY_APP_RESTRICTIONS";
    field public static final String MANAGE_DEVICE_POLICY_APP_USER_DATA = "android.permission.MANAGE_DEVICE_POLICY_APP_USER_DATA";
    field @FlaggedApi("android.app.admin.flags.assist_content_user_restriction_enabled") public static final String MANAGE_DEVICE_POLICY_ASSIST_CONTENT = "android.permission.MANAGE_DEVICE_POLICY_ASSIST_CONTENT";
    field public static final String MANAGE_DEVICE_POLICY_ASSIST_CONTENT = "android.permission.MANAGE_DEVICE_POLICY_ASSIST_CONTENT";
    field public static final String MANAGE_DEVICE_POLICY_AUDIO_OUTPUT = "android.permission.MANAGE_DEVICE_POLICY_AUDIO_OUTPUT";
    field public static final String MANAGE_DEVICE_POLICY_AUTOFILL = "android.permission.MANAGE_DEVICE_POLICY_AUTOFILL";
    field public static final String MANAGE_DEVICE_POLICY_BACKUP_SERVICE = "android.permission.MANAGE_DEVICE_POLICY_BACKUP_SERVICE";
@@ -169,7 +169,7 @@ package android {
    field public static final String MANAGE_DEVICE_POLICY_LOCK = "android.permission.MANAGE_DEVICE_POLICY_LOCK";
    field public static final String MANAGE_DEVICE_POLICY_LOCK_CREDENTIALS = "android.permission.MANAGE_DEVICE_POLICY_LOCK_CREDENTIALS";
    field public static final String MANAGE_DEVICE_POLICY_LOCK_TASK = "android.permission.MANAGE_DEVICE_POLICY_LOCK_TASK";
    field @FlaggedApi("android.app.admin.flags.esim_management_enabled") public static final String MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS = "android.permission.MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS";
    field public static final String MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS = "android.permission.MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS";
    field public static final String MANAGE_DEVICE_POLICY_METERED_DATA = "android.permission.MANAGE_DEVICE_POLICY_METERED_DATA";
    field public static final String MANAGE_DEVICE_POLICY_MICROPHONE = "android.permission.MANAGE_DEVICE_POLICY_MICROPHONE";
    field @FlaggedApi("android.app.admin.flags.dedicated_device_control_api_enabled") public static final String MANAGE_DEVICE_POLICY_MICROPHONE_TOGGLE = "android.permission.MANAGE_DEVICE_POLICY_MICROPHONE_TOGGLE";
@@ -8081,7 +8081,7 @@ package android.app.admin {
    method public CharSequence getStartUserSessionMessage(@NonNull android.content.ComponentName);
    method @Deprecated public boolean getStorageEncryption(@Nullable android.content.ComponentName);
    method public int getStorageEncryptionStatus();
    method @FlaggedApi("android.app.admin.flags.esim_management_enabled") @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS) public java.util.Set<java.lang.Integer> getSubscriptionIds();
    method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS) public java.util.Set<java.lang.Integer> getSubscriptionIds();
    method @Nullable public android.app.admin.SystemUpdatePolicy getSystemUpdatePolicy();
    method @Nullable public android.os.PersistableBundle getTransferOwnershipBundle();
    method @Nullable public java.util.List<android.os.PersistableBundle> getTrustAgentConfiguration(@Nullable android.content.ComponentName, @NonNull android.content.ComponentName);
@@ -34116,7 +34116,7 @@ package android.os {
    field public static final String DISALLOW_AIRPLANE_MODE = "no_airplane_mode";
    field public static final String DISALLOW_AMBIENT_DISPLAY = "no_ambient_display";
    field public static final String DISALLOW_APPS_CONTROL = "no_control_apps";
    field @FlaggedApi("android.app.admin.flags.assist_content_user_restriction_enabled") public static final String DISALLOW_ASSIST_CONTENT = "no_assist_content";
    field public static final String DISALLOW_ASSIST_CONTENT = "no_assist_content";
    field public static final String DISALLOW_AUTOFILL = "no_autofill";
    field public static final String DISALLOW_BLUETOOTH = "no_bluetooth";
    field public static final String DISALLOW_BLUETOOTH_SHARING = "no_bluetooth_sharing";
@@ -34166,7 +34166,7 @@ package android.os {
    field public static final String DISALLOW_SHARE_INTO_MANAGED_PROFILE = "no_sharing_into_profile";
    field public static final String DISALLOW_SHARE_LOCATION = "no_share_location";
    field public static final String DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI = "no_sharing_admin_configured_wifi";
    field @FlaggedApi("android.app.admin.flags.esim_management_enabled") public static final String DISALLOW_SIM_GLOBALLY = "no_sim_globally";
    field public static final String DISALLOW_SIM_GLOBALLY = "no_sim_globally";
    field public static final String DISALLOW_SMS = "no_sms";
    field public static final String DISALLOW_SYSTEM_ERROR_DIALOGS = "no_system_error_dialogs";
    field @FlaggedApi("com.android.net.thread.platform.flags.thread_user_restriction_enabled") public static final String DISALLOW_THREAD_NETWORK = "no_thread_network";
@@ -43968,8 +43968,11 @@ package android.telephony {
    field @FlaggedApi("com.android.internal.telephony.flags.carrier_enabled_satellite_flag") public static final String KEY_SATELLITE_CONNECTION_HYSTERESIS_SEC_INT = "satellite_connection_hysteresis_sec_int";
    field @FlaggedApi("com.android.internal.telephony.flags.carrier_enabled_satellite_flag") public static final String KEY_SATELLITE_ENTITLEMENT_STATUS_REFRESH_DAYS_INT = "satellite_entitlement_status_refresh_days_int";
    field @FlaggedApi("com.android.internal.telephony.flags.carrier_enabled_satellite_flag") public static final String KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL = "satellite_entitlement_supported_bool";
    field @FlaggedApi("com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn") public static final String KEY_SATELLITE_ESOS_INACTIVITY_TIMEOUT_SEC_INT = "satellite_esos_inactivity_timeout_sec_int";
    field @FlaggedApi("com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn") public static final String KEY_SATELLITE_ESOS_SUPPORTED_BOOL = "satellite_esos_supported_bool";
    field @FlaggedApi("com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn") public static final String KEY_SATELLITE_SCREEN_OFF_INACTIVITY_TIMEOUT_SEC_INT = "satellite_screen_off_inactivity_timeout_duration_sec_int";
    field @FlaggedApi("com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn") public static final String KEY_SATELLITE_P2P_SMS_INACTIVITY_TIMEOUT_SEC_INT = "satellite_p2p_sms_inactivity_timeout_sec_int";
    field @FlaggedApi("com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn") public static final String KEY_SATELLITE_ROAMING_P2P_SMS_SUPPORTED_BOOL = "satellite_roaming_p2p_sms_supported_bool";
    field @FlaggedApi("com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn") public static final String KEY_SATELLITE_SCREEN_OFF_INACTIVITY_TIMEOUT_SEC_INT = "satellite_screen_off_inactivity_timeout_sec_int";
    field public static final String KEY_SHOW_4G_FOR_3G_DATA_ICON_BOOL = "show_4g_for_3g_data_icon_bool";
    field public static final String KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL = "show_4g_for_lte_data_icon_bool";
    field public static final String KEY_SHOW_APN_SETTING_CDMA_BOOL = "show_apn_setting_cdma_bool";
Loading