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

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

Snap for 11896415 from 2b83c174 to 24Q3-release

Change-Id: Id28c7ceac1d77bd23d6710202abe34622d8562a2
parents c9232ae5 2b83c174
Loading
Loading
Loading
Loading
+23 −24
Original line number Original line Diff line number Diff line
@@ -22,12 +22,12 @@ import android.perftests.utils.ShellHelper;
import android.util.Log;
import android.util.Log;


import java.util.ArrayList;
import java.util.ArrayList;
import java.util.concurrent.TimeoutException;


// Based on //platform/frameworks/base/apct-tests/perftests/utils/BenchmarkState.java
// Based on //platform/frameworks/base/apct-tests/perftests/utils/BenchmarkState.java
public class BenchmarkRunner {
public class BenchmarkRunner {
    private static final String TAG = BenchmarkRunner.class.getSimpleName();
    private static final String TAG = BenchmarkRunner.class.getSimpleName();
    private static final int TIMEOUT_IN_SECONDS = 45;
    private static final long COOL_OFF_PERIOD_MS = 1000;
    private static final int CPU_IDLE_TIMEOUT_MS = 60 * 1000;
    private static final int CPU_IDLE_THRESHOLD_PERCENTAGE = 90;
    private static final int CPU_IDLE_THRESHOLD_PERCENTAGE = 90;


    private static final int NUM_ITERATIONS = 4;
    private static final int NUM_ITERATIONS = 4;
@@ -82,6 +82,7 @@ public class BenchmarkRunner {
    }
    }


    private void prepareForNextRun() {
    private void prepareForNextRun() {
        SystemClock.sleep(COOL_OFF_PERIOD_MS);
        waitCoolDownPeriod();
        waitCoolDownPeriod();
        mStartTimeNs = System.nanoTime();
        mStartTimeNs = System.nanoTime();
        mPausedDurationNs = 0;
        mPausedDurationNs = 0;
@@ -165,42 +166,42 @@ public class BenchmarkRunner {
        return null;
        return null;
    }
    }


    /** Waits for the CPU cores and the broadcast queue to be idle. */
    /** Waits for the broadcast queue and the CPU cores to be idle. */
    public void waitCoolDownPeriod() {
    public void waitCoolDownPeriod() {
        waitForCpuIdle();
        waitForBroadcastIdle();
        waitForBroadcastIdle();
        waitForCpuIdle();
    }
    }


    private void waitForBroadcastIdle() {
    private void waitForBroadcastIdle() {
        try {
        Log.d(TAG, "starting to waitForBroadcastIdle");
            ShellHelper.runShellCommandWithTimeout(
        final long startedAt = System.currentTimeMillis();
                    "am wait-for-broadcast-idle --flush-broadcast-loopers", TIMEOUT_IN_SECONDS);
        ShellHelper.runShellCommand("am wait-for-broadcast-idle --flush-broadcast-loopers");
        } catch (TimeoutException e) {
        final long elapsed = System.currentTimeMillis() - startedAt;
            Log.e(TAG, "Ending waitForBroadcastIdle because it didn't finish in "
        Log.d(TAG, "waitForBroadcastIdle is complete in " + elapsed + " ms");
                    + TIMEOUT_IN_SECONDS + " seconds", e);
        }
    }
    }

    private void waitForCpuIdle() {
    private void waitForCpuIdle() {
        int count = 0;
        Log.d(TAG, "starting to waitForCpuIdle");
        int idleCpuPercentage;
        final long startedAt = System.currentTimeMillis();
        while (count++ < TIMEOUT_IN_SECONDS) {
        while (true) {
            idleCpuPercentage = getIdleCpuPercentage();
            final int idleCpuPercentage = getIdleCpuPercentage();
            Log.d(TAG, "Waiting for CPU idle #" + count + "=" + idleCpuPercentage + "%");
            final long elapsed = System.currentTimeMillis() - startedAt;
            if (idleCpuPercentage > CPU_IDLE_THRESHOLD_PERCENTAGE) {
            Log.d(TAG, "waitForCpuIdle " + idleCpuPercentage + "% (" + elapsed + "ms elapsed)");
            if (idleCpuPercentage >= CPU_IDLE_THRESHOLD_PERCENTAGE) {
                Log.d(TAG, "waitForCpuIdle is complete in " + elapsed + " ms");
                return;
            }
            if (elapsed >= CPU_IDLE_TIMEOUT_MS) {
                Log.e(TAG, "Ending waitForCpuIdle because it didn't finish in "
                        + CPU_IDLE_TIMEOUT_MS + " ms");
                return;
                return;
            }
            }
            SystemClock.sleep(1000);
            SystemClock.sleep(1000);
        }
        }
        Log.e(TAG, "Ending waitForCpuIdle because it didn't finish in "
                + TIMEOUT_IN_SECONDS + " seconds");
    }
    }


    private int getIdleCpuPercentage() {
    private int getIdleCpuPercentage() {
        String output = ShellHelper.runShellCommand("top -m 1 -n 1");
        String output = ShellHelper.runShellCommand("top -m 1 -n 1");

        String[] tokens = output.split("\\s+");
        String[] tokens = output.split("\\s+");

        float totalCpu = -1;
        float totalCpu = -1;
        float idleCpu = -1;
        float idleCpu = -1;
        for (String token : tokens) {
        for (String token : tokens) {
@@ -210,12 +211,10 @@ public class BenchmarkRunner {
                idleCpu = Float.parseFloat(token.split("%")[0]);
                idleCpu = Float.parseFloat(token.split("%")[0]);
            }
            }
        }
        }

        if (totalCpu < 0 || idleCpu < 0) {
        if (totalCpu < 0 || idleCpu < 0) {
            Log.e(TAG, "Could not get idle cpu percentage, output=" + output);
            Log.e(TAG, "Could not get idle cpu percentage, output=" + output);
            return -1;
            return -1;
        }
        }

        return (int) (100 * idleCpu / totalCpu);
        return (int) (100 * idleCpu / totalCpu);
    }
    }
}
}
 No newline at end of file
+3 −2
Original line number Original line Diff line number Diff line
@@ -355,7 +355,7 @@ public final class ActivityThread extends ClientTransactionHandler


    private static final String DEFAULT_FULL_BACKUP_AGENT = "android.app.backup.FullBackupAgent";
    private static final String DEFAULT_FULL_BACKUP_AGENT = "android.app.backup.FullBackupAgent";


    private static final long BINDER_CALLBACK_THROTTLE = 10_100L;
    private static final long BINDER_CALLBACK_THROTTLE_MS = 10_100L;
    private long mBinderCallbackLast = -1;
    private long mBinderCallbackLast = -1;


    /**
    /**
@@ -7551,12 +7551,13 @@ public final class ActivityThread extends ClientTransactionHandler
            @Override
            @Override
            public void onTransactionError(int pid, int code, int flags, int err) {
            public void onTransactionError(int pid, int code, int flags, int err) {
                final long now = SystemClock.uptimeMillis();
                final long now = SystemClock.uptimeMillis();
                if (now < mBinderCallbackLast + BINDER_CALLBACK_THROTTLE) {
                if (now < mBinderCallbackLast + BINDER_CALLBACK_THROTTLE_MS) {
                    Slog.d(TAG, "Too many transaction errors, throttling freezer binder callback.");
                    Slog.d(TAG, "Too many transaction errors, throttling freezer binder callback.");
                    return;
                    return;
                }
                }
                mBinderCallbackLast = now;
                mBinderCallbackLast = now;
                try {
                try {
                    Log.wtfStack(TAG, "Binder Transaction Error");
                    mgr.frozenBinderTransactionDetected(pid, code, flags, err);
                    mgr.frozenBinderTransactionDetected(pid, code, flags, err);
                } catch (RemoteException ex) {
                } catch (RemoteException ex) {
                    throw ex.rethrowFromSystemServer();
                    throw ex.rethrowFromSystemServer();
+4 −0
Original line number Original line Diff line number Diff line
@@ -5637,6 +5637,10 @@ public class Notification implements Parcelable
                    contentView.setDrawableTint(R.id.profile_badge, false,
                    contentView.setDrawableTint(R.id.profile_badge, false,
                            getPrimaryTextColor(p), PorterDuff.Mode.SRC_ATOP);
                            getPrimaryTextColor(p), PorterDuff.Mode.SRC_ATOP);
                }
                }
                contentView.setContentDescription(
                        R.id.profile_badge,
                        mContext.getSystemService(UserManager.class)
                                .getProfileAccessibilityString(mContext.getUserId()));
            }
            }
        }
        }
+8 −1
Original line number Original line Diff line number Diff line
@@ -167,3 +167,10 @@ flag {
  description: "[Minimal HUN] Enables the compact heads up notification reply capability for Conversation Notifications"
  description: "[Minimal HUN] Enables the compact heads up notification reply capability for Conversation Notifications"
  bug: "336229954"
  bug: "336229954"
}
}

flag {
  name: "remove_remote_views"
  namespace: "systemui"
  description: "Removes all custom views"
  bug: "342602960"
}
+0 −1
Original line number Original line Diff line number Diff line
@@ -4398,7 +4398,6 @@ public abstract class PackageManager {
     * Windows have title bars and can be moved and resized.
     * Windows have title bars and can be moved and resized.
     */
     */
    // If this feature is present, you also need to set
    // If this feature is present, you also need to set
    // com.android.internal.R.config_freeformWindowManagement to true in your configuration overlay.
    @SdkConstant(SdkConstantType.FEATURE)
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT
    public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT
            = "android.software.freeform_window_management";
            = "android.software.freeform_window_management";
Loading