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

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

Snap for 12680993 from 13e05e63 to 25Q1-release

Change-Id: I630335451a5f2c069ee738d9625f52a18f31b9f5
parents fd1d2cac 13e05e63
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ import org.junit.Test;
public class TextClassificationManagerPerfTest {
    private static final String WRITE_DEVICE_CONFIG_PERMISSION =
            "android.permission.WRITE_DEVICE_CONFIG";
    private static final String WRITE_ALLOWLISTED_DEVICE_CONFIG_PERMISSION =
            "android.permission.WRITE_ALLOWLISTED_DEVICE_CONFIG";

    @Rule
    public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@@ -44,7 +46,7 @@ public class TextClassificationManagerPerfTest {
    public static void setUpClass() {
        InstrumentationRegistry.getInstrumentation().getUiAutomation()
                .adoptShellPermissionIdentity(
                        WRITE_DEVICE_CONFIG_PERMISSION);
                        WRITE_DEVICE_CONFIG_PERMISSION, WRITE_ALLOWLISTED_DEVICE_CONFIG_PERMISSION);
    }

    @AfterClass
+6 −14
Original line number Diff line number Diff line
@@ -2085,8 +2085,12 @@ public class JobSchedulerService extends com.android.server.SystemService
        if (DEBUG) {
            Slog.v(TAG, debugPrefix + " ready=" + jobReady);
        }
        if (!jobReady) {
            return job.getPendingJobReasons();
        final JobRestriction restriction = checkIfRestricted(job);
        if (DEBUG) {
            Slog.v(TAG, debugPrefix + " restriction=" + restriction);
        }
        if (!jobReady || restriction != null) {
            return job.getPendingJobReasons(restriction);
        }

        final boolean userStarted = areUsersStartedLocked(job);
@@ -2106,18 +2110,6 @@ public class JobSchedulerService extends com.android.server.SystemService
            return new int[] { JobScheduler.PENDING_JOB_REASON_APP };
        }

        final JobRestriction restriction = checkIfRestricted(job);
        if (DEBUG) {
            Slog.v(TAG, debugPrefix + " restriction=" + restriction);
        }
        if (restriction != null) {
            // Currently this will return _DEVICE_STATE because of thermal reasons.
            // TODO (b/372031023): does it make sense to move this along with the
            //  pendingJobReasons() call above and also get the pending reasons from
            //  all of the restriction controllers?
            return new int[] { restriction.getPendingReason() };
        }

        // The following can be a little more expensive, so we are doing it later,
        // but still before checking with the package manager!
        final boolean jobPending = mPendingJobQueue.contains(job);
+11 −1
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ import com.android.server.job.JobSchedulerService;
import com.android.server.job.JobServerProtoEnums;
import com.android.server.job.JobStatusDumpProto;
import com.android.server.job.JobStatusShortInfoProto;
import com.android.server.job.restrictions.JobRestriction;

import dalvik.annotation.optimization.NeverCompile;

@@ -2179,11 +2180,20 @@ public final class JobStatus {
     * This will return all potential reasons why the job is pending.
     */
    @NonNull
    public int[] getPendingJobReasons() {
    public int[] getPendingJobReasons(@Nullable JobRestriction restriction) {
        final int unsatisfiedConstraints = ~satisfiedConstraints
                & (requiredConstraints | mDynamicConstraints | IMPLICIT_CONSTRAINTS);
        final ArrayList<Integer> reasons = constraintsToPendingJobReasons(unsatisfiedConstraints);

        if (restriction != null) {
            // Currently only ThermalStatusRestriction extends the JobRestriction class and
            // returns PENDING_JOB_REASON_DEVICE_STATE if the job is restricted because of thermal.
            @JobScheduler.PendingJobReason final int reason = restriction.getPendingReason();
            if (!reasons.contains(reason)) {
                reasons.addLast(reason);
            }
        }

        if (reasons.isEmpty()) {
            if (getEffectiveStandbyBucket() == NEVER_INDEX) {
                Slog.wtf(TAG, "App in NEVER bucket querying pending job reason");
+1 −2
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
 * limitations under the License.
 */

#define _GNU_SOURCE

/**
 * The probability of a syscall failing from 0.0 to 1.0
@@ -32,8 +33,6 @@
#include <sys/stat.h>
#include <fcntl.h>

/* For builds on glibc */
#define __USE_GNU
#include <dlfcn.h>

#include "interrupter.h"
+65 −11

File changed.

Preview size limit exceeded, changes collapsed.

Loading