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

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

Snap for 8509668 from a90dda92 to tm-qpr1-release

Change-Id: If223b43abd389b47194e8ef589c87e1d480ff86f
parents 1ec1f850 a90dda92
Loading
Loading
Loading
Loading
+25 −7
Original line number Original line Diff line number Diff line
@@ -241,7 +241,7 @@ public class JobInfo implements Parcelable {


    /**
    /**
     * Default value for all regular jobs. As noted in {@link JobScheduler},
     * Default value for all regular jobs. As noted in {@link JobScheduler},
     * these jobs have a general maximum execution time of 10 minutes.
     * these jobs have a general execution time of 10 minutes.
     * Receives the standard job management policy.
     * Receives the standard job management policy.
     */
     */
    public static final int PRIORITY_DEFAULT = 300;
    public static final int PRIORITY_DEFAULT = 300;
@@ -250,7 +250,7 @@ public class JobInfo implements Parcelable {
     * This task should be ordered ahead of most other tasks. It may be
     * This task should be ordered ahead of most other tasks. It may be
     * deferred a little, but if it doesn't run at some point, the user may think
     * deferred a little, but if it doesn't run at some point, the user may think
     * something is wrong. Assuming all constraints remain satisfied
     * something is wrong. Assuming all constraints remain satisfied
     * (including ideal system load conditions), these jobs will have a maximum
     * (including ideal system load conditions), these jobs can have an
     * execution time of at least 4 minutes. Setting all of your jobs to high
     * execution time of at least 4 minutes. Setting all of your jobs to high
     * priority will not be beneficial to your app and in fact may hurt its
     * priority will not be beneficial to your app and in fact may hurt its
     * performance in the long run.
     * performance in the long run.
@@ -260,7 +260,7 @@ public class JobInfo implements Parcelable {
    /**
    /**
     * This task should be run ahead of all other tasks. Only Expedited Jobs
     * This task should be run ahead of all other tasks. Only Expedited Jobs
     * {@link Builder#setExpedited(boolean)} can have this priority and as such,
     * {@link Builder#setExpedited(boolean)} can have this priority and as such,
     * are subject to the same maximum execution time details noted in
     * are subject to the same execution time details noted in
     * {@link Builder#setExpedited(boolean)}.
     * {@link Builder#setExpedited(boolean)}.
     * A sample task of max priority: receiving a text message and processing it to
     * A sample task of max priority: receiving a text message and processing it to
     * show a notification
     * show a notification
@@ -1414,6 +1414,15 @@ public class JobInfo implements Parcelable {
         * you also need to define the network traffic used by each work item
         * you also need to define the network traffic used by each work item
         * when constructing them.
         * when constructing them.
         *
         *
         * <p class="note">
         * Prior to Android version {@link Build.VERSION_CODES#TIRAMISU}, JobScheduler used the
         * estimated transfer numbers in a similar fashion to
         * {@link #setMinimumNetworkChunkBytes(long)} (to estimate if the work would complete
         * within the time available to job). In other words, JobScheduler treated the transfer as
         * all-or-nothing. Starting from Android version {@link Build.VERSION_CODES#TIRAMISU},
         * JobScheduler will only use the estimated transfer numbers in this manner if minimum
         * chunk sizes have not been provided via {@link #setMinimumNetworkChunkBytes(long)}.
         *
         * @param downloadBytes The estimated size of network traffic that will
         * @param downloadBytes The estimated size of network traffic that will
         *            be downloaded by this job, in bytes.
         *            be downloaded by this job, in bytes.
         * @param uploadBytes The estimated size of network traffic that will be
         * @param uploadBytes The estimated size of network traffic that will be
@@ -1756,14 +1765,19 @@ public class JobInfo implements Parcelable {
         *
         *
         * <p>
         * <p>
         * Assuming all constraints remain satisfied (including ideal system load conditions),
         * Assuming all constraints remain satisfied (including ideal system load conditions),
         * expedited jobs will have a maximum execution time of at least 1 minute. If your
         * expedited jobs can have an execution time of at least 1 minute. If your
         * app has remaining expedited job quota, then the expedited job <i>may</i> potentially run
         * app has remaining expedited job quota, then the expedited job <i>may</i> potentially run
         * longer until remaining quota is used up. Just like with regular jobs, quota is not
         * longer until remaining quota is used up. Just like with regular jobs, quota is not
         * consumed while the app is on top and visible to the user.
         * consumed while the app is on top and visible to the user.
         *
         *
         * <p>
         * <p class="note">
         * Note: Even though expedited jobs are meant to run as soon as possible, they may be
         * Note: Even though expedited jobs are meant to run as soon as possible, they may be
         * deferred if the system is under heavy load or requested constraints are not satisfied.
         * deferred if the system is under heavy load or requested constraints are not satisfied.
         * This delay may be true for expedited jobs of the foreground app on Android version
         * {@link Build.VERSION_CODES#S}, but starting from Android version
         * {@link Build.VERSION_CODES#TIRAMISU}, expedited jobs for the foreground app are
         * guaranteed to be started before {@link JobScheduler#schedule(JobInfo)} returns (assuming
         * all requested constraints are satisfied), similar to foreground services.
         *
         *
         * @see JobInfo#isExpedited()
         * @see JobInfo#isExpedited()
         */
         */
@@ -1799,6 +1813,9 @@ public class JobInfo implements Parcelable {
         * and in the background, or the job failed due to unsatisfied constraints,
         * and in the background, or the job failed due to unsatisfied constraints,
         * this job should be expected to behave like other jobs without this flag.
         * this job should be expected to behave like other jobs without this flag.
         *
         *
         * <p>
         * Jobs marked as important-while-foreground are given {@link #PRIORITY_HIGH} by default.
         *
         * @param importantWhileForeground whether to relax doze restrictions for this job when the
         * @param importantWhileForeground whether to relax doze restrictions for this job when the
         *                                 app is in the foreground. False by default.
         *                                 app is in the foreground. False by default.
         * @see JobInfo#isImportantWhileForeground()
         * @see JobInfo#isImportantWhileForeground()
@@ -1831,8 +1848,9 @@ public class JobInfo implements Parcelable {
         * the specific user of this device. For example, fetching top headlines
         * the specific user of this device. For example, fetching top headlines
         * of interest to the current user.
         * of interest to the current user.
         * <p>
         * <p>
         * Starting with Android version {@link Build.VERSION_CODES#TIRAMISU}, prefetch jobs are
         * Apps targeting Android version {@link Build.VERSION_CODES#TIRAMISU} or later are
         * not allowed to have deadlines (set via {@link #setOverrideDeadline(long)}.
         * not allowed to have deadlines (set via {@link #setOverrideDeadline(long)} on their
         * prefetch jobs.
         * <p>
         * <p>
         * The system may use this signal to relax the network constraints you
         * The system may use this signal to relax the network constraints you
         * originally requested, such as allowing a
         * originally requested, such as allowing a
+1 −1
Original line number Original line Diff line number Diff line
@@ -167,7 +167,7 @@ public class JobParameters implements Parcelable {
    /**
    /**
     * The job used up its maximum execution time and timed out. Each individual job has a maximum
     * The job used up its maximum execution time and timed out. Each individual job has a maximum
     * execution time limit, regardless of how much total quota the app has. See the note on
     * execution time limit, regardless of how much total quota the app has. See the note on
     * {@link JobScheduler} for the execution time limits.
     * {@link JobScheduler} and {@link JobInfo} for the execution time limits.
     */
     */
    public static final int STOP_REASON_TIMEOUT = 3;
    public static final int STOP_REASON_TIMEOUT = 3;
    /**
    /**
+20 −2
Original line number Original line Diff line number Diff line
@@ -690,6 +690,12 @@ class JobConcurrencyManager {
        int projectedRunningCount = numRunningJobs;
        int projectedRunningCount = numRunningJobs;
        while ((nextPending = pendingJobQueue.next()) != null) {
        while ((nextPending = pendingJobQueue.next()) != null) {
            if (mRunningJobs.contains(nextPending)) {
            if (mRunningJobs.contains(nextPending)) {
                // Should never happen.
                Slog.wtf(TAG, "Pending queue contained a running job");
                if (DEBUG) {
                    Slog.e(TAG, "Pending+running job: " + nextPending);
                }
                pendingJobQueue.remove(nextPending);
                continue;
                continue;
            }
            }


@@ -1137,7 +1143,8 @@ class JobConcurrencyManager {
            }
            }
        }
        }


        if (mActiveServices.size() >= STANDARD_CONCURRENCY_LIMIT) {
        final PendingJobQueue pendingJobQueue = mService.getPendingJobQueue();
        if (mActiveServices.size() >= STANDARD_CONCURRENCY_LIMIT || pendingJobQueue.size() == 0) {
            worker.clearPreferredUid();
            worker.clearPreferredUid();
            // We're over the limit (because the TOP app scheduled a lot of EJs). Don't start
            // We're over the limit (because the TOP app scheduled a lot of EJs). Don't start
            // running anything new until we get back below the limit.
            // running anything new until we get back below the limit.
@@ -1145,7 +1152,6 @@ class JobConcurrencyManager {
            return;
            return;
        }
        }


        final PendingJobQueue pendingJobQueue = mService.getPendingJobQueue();
        if (worker.getPreferredUid() != JobServiceContext.NO_PREFERRED_UID) {
        if (worker.getPreferredUid() != JobServiceContext.NO_PREFERRED_UID) {
            updateCounterConfigLocked();
            updateCounterConfigLocked();
            // Preemption case needs special care.
            // Preemption case needs special care.
@@ -1162,6 +1168,12 @@ class JobConcurrencyManager {
            pendingJobQueue.resetIterator();
            pendingJobQueue.resetIterator();
            while ((nextPending = pendingJobQueue.next()) != null) {
            while ((nextPending = pendingJobQueue.next()) != null) {
                if (mRunningJobs.contains(nextPending)) {
                if (mRunningJobs.contains(nextPending)) {
                    // Should never happen.
                    Slog.wtf(TAG, "Pending queue contained a running job");
                    if (DEBUG) {
                        Slog.e(TAG, "Pending+running job: " + nextPending);
                    }
                    pendingJobQueue.remove(nextPending);
                    continue;
                    continue;
                }
                }


@@ -1239,6 +1251,12 @@ class JobConcurrencyManager {
            while ((nextPending = pendingJobQueue.next()) != null) {
            while ((nextPending = pendingJobQueue.next()) != null) {


                if (mRunningJobs.contains(nextPending)) {
                if (mRunningJobs.contains(nextPending)) {
                    // Should never happen.
                    Slog.wtf(TAG, "Pending queue contained a running job");
                    if (DEBUG) {
                        Slog.e(TAG, "Pending+running job: " + nextPending);
                    }
                    pendingJobQueue.remove(nextPending);
                    continue;
                    continue;
                }
                }


+7 −2
Original line number Original line Diff line number Diff line
@@ -1749,8 +1749,13 @@ public class JobSchedulerService extends com.android.server.SystemService
        if (!removed) {
        if (!removed) {
            // We never create JobStatus objects for the express purpose of removing them, and this
            // We never create JobStatus objects for the express purpose of removing them, and this
            // method is only ever called for jobs that were saved in the JobStore at some point,
            // method is only ever called for jobs that were saved in the JobStore at some point,
            // so if we can't find it, something went seriously wrong.
            // so if we can't find it, something may be wrong. As of Android T, there is a
            Slog.wtfStack(TAG, "Job didn't exist in JobStore");
            // legitimate code path where removed is false --- when an actively running job is
            // cancelled (eg. via JobScheduler.cancel() or the app scheduling a new job with the
            // same job ID), we remove it from the JobStore and tell the JobServiceContext to stop
            // running the job. Once the job stops running, we then call this method again.
            // TODO: rework code so we don't intentionally call this method twice for the same job
            Slog.w(TAG, "Job didn't exist in JobStore");
        }
        }
        if (mReadyToRock) {
        if (mReadyToRock) {
            for (int i = 0; i < mControllers.size(); i++) {
            for (int i = 0; i < mControllers.size(); i++) {
+21 −8
Original line number Original line Diff line number Diff line
@@ -1459,6 +1459,8 @@ bool BootAnimation::playAnimation(const Animation& animation) {


    int fadedFramesCount = 0;
    int fadedFramesCount = 0;
    int lastDisplayedProgress = 0;
    int lastDisplayedProgress = 0;
    int colorTransitionStart = animation.colorTransitionStart;
    int colorTransitionEnd = animation.colorTransitionEnd;
    for (size_t i=0 ; i<pcount ; i++) {
    for (size_t i=0 ; i<pcount ; i++) {
        const Animation::Part& part(animation.parts[i]);
        const Animation::Part& part(animation.parts[i]);
        const size_t fcount = part.frames.size();
        const size_t fcount = part.frames.size();
@@ -1471,15 +1473,27 @@ bool BootAnimation::playAnimation(const Animation& animation) {
            continue; //to next part
            continue; //to next part
        }
        }


        if (animation.dynamicColoringEnabled && part.useDynamicColoring && !mDynamicColorsApplied) {
            SLOGD("Trying to load dynamic color sysprops.");
            initDynamicColors();
        }

        // process the part not only while the count allows but also if already fading
        // process the part not only while the count allows but also if already fading
        for (int r=0 ; !part.count || r<part.count || fadedFramesCount > 0 ; r++) {
        for (int r=0 ; !part.count || r<part.count || fadedFramesCount > 0 ; r++) {
            if (shouldStopPlayingPart(part, fadedFramesCount, lastDisplayedProgress)) break;
            if (shouldStopPlayingPart(part, fadedFramesCount, lastDisplayedProgress)) break;


            // It's possible that the sysprops were not loaded yet at this boot phase.
            // If that's the case, then we should keep trying until they are available.
            if (animation.dynamicColoringEnabled && !mDynamicColorsApplied
                && (part.useDynamicColoring || part.postDynamicColoring)) {
                SLOGD("Trying to load dynamic color sysprops.");
                initDynamicColors();
                if (mDynamicColorsApplied) {
                    // Sysprops were loaded. Next step is to adjust the animation if we loaded
                    // the colors after the animation should have started.
                    const int transitionLength = colorTransitionEnd - colorTransitionStart;
                    if (part.postDynamicColoring) {
                        colorTransitionStart = 0;
                        colorTransitionEnd = fmin(transitionLength, fcount - 1);
                    }
                }
            }

            mCallbacks->playPart(i, part, r);
            mCallbacks->playPart(i, part, r);


            glClearColor(
            glClearColor(
@@ -1509,9 +1523,8 @@ bool BootAnimation::playAnimation(const Animation& animation) {
                // - 1 for parts that come after.
                // - 1 for parts that come after.
                float colorProgress = part.useDynamicColoring
                float colorProgress = part.useDynamicColoring
                    ? fmin(fmax(
                    ? fmin(fmax(
                        ((float)j - animation.colorTransitionStart) /
                        ((float)j - colorTransitionStart) /
                            fmax(animation.colorTransitionEnd -
                            fmax(colorTransitionEnd - colorTransitionStart, 1.0f), 0.0f), 1.0f)
                                animation.colorTransitionStart, 1.0f), 0.0f), 1.0f)
                    : (part.postDynamicColoring ? 1 : 0);
                    : (part.postDynamicColoring ? 1 : 0);


                processDisplayEvents();
                processDisplayEvents();
Loading