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

Commit 7fd8fcb3 authored by Xin Li's avatar Xin Li Committed by Gerrit Code Review
Browse files

Merge "Merge Android 14 QPR1" into main

parents e701119e 620c66bc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -58,8 +58,8 @@
        <option name="instrumentation-arg" key="report" value="true" />
        <option name="instrumentation-arg" key="arguments" value="-g" />
        <option name="instrumentation-arg" key="events_to_record" value="instructions,cpu-cycles,raw-l3d-cache-refill,sched:sched_waking" />
        <option name="instrumentation-arg" key="processes_to_record" value="surfaceflinger" />
        <option name="instrumentation-arg" key="symbols_to_report" value="&quot;commit;android::SurfaceFlinger::commit(;composite;android::SurfaceFlinger::composite(&quot;" />
        <option name="instrumentation-arg" key="processes_to_record" value="surfaceflinger,android.perftests.surfaceflinger" />
        <option name="instrumentation-arg" key="symbols_to_report" value="&quot;commit;android::SurfaceFlinger::commit(;composite;android::SurfaceFlinger::composite(;outbound;android::SurfaceComposerClient::Transaction::apply(;inbound;android::BnTransactionCompletedListener::onTransact(&quot;"/>

        <!-- should match profiling-iterations -->
        <option name="instrumentation-arg" key="test_iterations" value="525" />
+16 −0
Original line number Diff line number Diff line
@@ -17,10 +17,14 @@
package android.surfaceflinger;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceControl;
import android.view.SurfaceHolder;
import android.view.SurfaceView;


import androidx.test.ext.junit.rules.ActivityScenarioRule;
import androidx.test.filters.LargeTest;
@@ -194,4 +198,16 @@ public class SurfaceFlingerPerfTest {
            mTransaction.apply(true);
        }
    }

    @Test
    public void bufferQueue() throws Exception {
        SurfaceView testSV = mActivity.mTestSurfaceView;
        SurfaceHolder holder = testSV.getHolder();
        holder.getSurface();
        for (int i = 0; i < sProfilingIterations; i++) {
            Canvas canvas = holder.lockCanvas();
            holder.unlockCanvasAndPost(canvas);
            mTransaction.apply(true);
        }
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES;
import static android.os.UserHandle.USER_CURRENT;
import static android.os.UserHandle.USER_NULL;

import static com.android.internal.util.ConcurrentUtils.DIRECT_EXECUTOR;
import static com.android.server.blob.BlobStoreConfig.INVALID_BLOB_ID;
import static com.android.server.blob.BlobStoreConfig.INVALID_BLOB_SIZE;
import static com.android.server.blob.BlobStoreConfig.LOGV;
@@ -1915,7 +1916,7 @@ public class BlobStoreManagerService extends SystemService {
        mStatsManager.setPullAtomCallback(
                FrameworkStatsLog.BLOB_INFO,
                null, // use default PullAtomMetadata values
                BackgroundThread.getExecutor(),
                DIRECT_EXECUTOR,
                mStatsCallbackImpl
        );
    }
+2 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.alarm;

import static com.android.internal.util.ConcurrentUtils.DIRECT_EXECUTOR;
import static com.android.internal.util.FrameworkStatsLog.ALARM_SCHEDULED__EXACT_ALARM_ALLOWED_REASON__ALLOW_LIST;
import static com.android.internal.util.FrameworkStatsLog.ALARM_SCHEDULED__EXACT_ALARM_ALLOWED_REASON__CHANGE_DISABLED;
import static com.android.internal.util.FrameworkStatsLog.ALARM_SCHEDULED__EXACT_ALARM_ALLOWED_REASON__LISTENER;
@@ -31,7 +32,6 @@ import android.app.StatsManager;
import android.content.Context;
import android.os.SystemClock;

import com.android.internal.os.BackgroundThread;
import com.android.internal.util.FrameworkStatsLog;

import java.util.function.Supplier;
@@ -51,7 +51,7 @@ class MetricsHelper {
    void registerPuller(Supplier<AlarmStore> alarmStoreSupplier) {
        final StatsManager statsManager = mContext.getSystemService(StatsManager.class);
        statsManager.setPullAtomCallback(FrameworkStatsLog.PENDING_ALARM_INFO, null,
                BackgroundThread.getExecutor(), (atomTag, data) -> {
                DIRECT_EXECUTOR, (atomTag, data) -> {
                    if (atomTag != FrameworkStatsLog.PENDING_ALARM_INFO) {
                        throw new UnsupportedOperationException("Unknown tag" + atomTag);
                    }
+26 −8
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.FrameworkStatsLog;
import com.android.modules.expresslog.Counter;
import com.android.server.LocalServices;
import com.android.server.job.GrantedUriPermissions;
import com.android.server.job.JobSchedulerInternal;
@@ -161,6 +162,9 @@ public final class JobStatus {
    /** If the job is going to be passed an unmetered network. */
    private boolean mHasAccessToUnmetered;

    /** If the effective bucket has been downgraded once due to being buggy. */
    private boolean mIsDowngradedDueToBuggyApp;

    /**
     * The additional set of dynamic constraints that must be met if this is an expedited job that
     * had a long enough run while the device was Dozing or in battery saver.
@@ -1173,18 +1177,32 @@ public final class JobStatus {
            // like other ACTIVE apps.
            return ACTIVE_INDEX;
        }

        final int bucketWithMediaExemption;
        if (actualBucket != RESTRICTED_INDEX && actualBucket != NEVER_INDEX
                && mHasMediaBackupExemption) {
            // Treat it as if it's at most WORKING_INDEX (lower index grants higher quota) since
            // media backup jobs are important to the user, and the source package may not have
            // been used directly in a while.
            bucketWithMediaExemption = Math.min(WORKING_INDEX, actualBucket);
        } else {
            bucketWithMediaExemption = actualBucket;
        }

        // If the app is considered buggy, but hasn't yet been put in the RESTRICTED bucket
        // (potentially because it's used frequently by the user), limit its effective bucket
        // so that it doesn't get to run as much as a normal ACTIVE app.
        final int highestBucket = isBuggy ? WORKING_INDEX : ACTIVE_INDEX;
        if (actualBucket != RESTRICTED_INDEX && actualBucket != NEVER_INDEX
                && mHasMediaBackupExemption) {
            // Treat it as if it's at least WORKING_INDEX since media backup jobs are important
            // to the user, and the
            // source package may not have been used directly in a while.
            return Math.max(highestBucket, Math.min(WORKING_INDEX, actualBucket));
        if (isBuggy && bucketWithMediaExemption < WORKING_INDEX) {
            if (!mIsDowngradedDueToBuggyApp) {
                // Safety check to avoid logging multiple times for the same job.
                Counter.logIncrementWithUid(
                        "job_scheduler.value_job_quota_reduced_due_to_buggy_uid",
                        getTimeoutBlameUid());
                mIsDowngradedDueToBuggyApp = true;
            }
            return WORKING_INDEX;
        }
        return Math.max(highestBucket, actualBucket);
        return bucketWithMediaExemption;
    }

    /** Returns the real standby bucket of the job. */
Loading