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

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

Snap for 12800583 from 8d7d869d to 25Q2-release

Change-Id: Iae4802e24e79eae56a437c261ef5b3a1c34071f4
parents b38a670a 8d7d869d
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
@@ -530,6 +530,50 @@ java_library {
        ],
    },
    jarjar_prefix: "com.android.internal.hidden_from_bootclasspath",

    jarjar_shards: select(release_flag("RELEASE_USE_SHARDED_JARJAR_ON_FRAMEWORK_MINUS_APEX"), {
        true: "10",
        default: "1",
    }),
}

// This is identical to "framework-minus-apex" but with "jarjar_shards" hardcodd.
// (also "stem" is commented out to avoid a conflict with the "framework-minus-apex")
// TODO(b/383559945) This module is just for local testing / verification. It's not used
// by anything. Remove it once we roll out RELEASE_USE_SHARDED_JARJAR_ON_FRAMEWORK_MINUS_APEX.
java_library {
    name: "framework-minus-apex_jarjar-sharded",
    defaults: [
        "framework-minus-apex-with-libs-defaults",
        "framework-non-updatable-lint-defaults",
    ],
    installable: true,
    // For backwards compatibility.
    // stem: "framework",
    apex_available: ["//apex_available:platform"],
    visibility: [
        "//frameworks/base",
        "//frameworks/base/location",
        // TODO(b/147128803) remove the below lines
        "//frameworks/base/apex/blobstore/framework",
        "//frameworks/base/apex/jobscheduler/framework",
        "//frameworks/base/packages/Tethering/tests/unit",
        "//packages/modules/Connectivity/Tethering/tests/unit",
    ],
    errorprone: {
        javacflags: [
            "-Xep:AndroidFrameworkCompatChange:ERROR",
            "-Xep:AndroidFrameworkUid:ERROR",
        ],
    },
    lint: {
        baseline_filename: "lint-baseline.xml",
        warning_checks: [
            "FlaggedApi",
        ],
    },
    jarjar_prefix: "com.android.internal.hidden_from_bootclasspath",
    jarjar_shards: "10",
}

java_library {
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp
               tests/
               tools/
bpfmt = -d
ktfmt = --kotlinlang-style --include-dirs=services/permission,packages/SystemUI,libs/WindowManager/Shell/src/com/android/wm/shell/freeform,libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode
ktfmt = --kotlinlang-style --include-dirs=services/permission,packages/SystemUI,libs/WindowManager/Shell/src/com/android/wm/shell/freeform,libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode,libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode

[Hook Scripts]
checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT}
+22 −0
Original line number Diff line number Diff line
@@ -23,6 +23,10 @@ import android.annotation.Nullable;
import android.annotation.TestApi;
import android.app.ActivityManager;
import android.app.usage.UsageStatsManager;
import android.compat.Compatibility;
import android.compat.annotation.ChangeId;
import android.compat.annotation.Disabled;
import android.compat.annotation.Overridable;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.ClipData;
import android.content.pm.PackageManager;
@@ -349,6 +353,16 @@ public class JobParameters implements Parcelable {
    private JobCleanupCallback mJobCleanupCallback;
    @Nullable
    private Cleaner.Cleanable mCleanable;
    /**
     * Override handling of abandoned jobs in the system. Overriding this change
     * will prevent the system to handle abandoned jobs and report it as a new
     * stop reason STOP_REASON_TIMEOUT_ABANDONED.
     * @hide
     */
    @ChangeId
    @Disabled
    @Overridable
    public static final long OVERRIDE_HANDLE_ABANDONED_JOBS = 372529068L;

    /** @hide */
    public JobParameters(IBinder callback, String namespace, int jobId, PersistableBundle extras,
@@ -677,6 +691,10 @@ public class JobParameters implements Parcelable {
     * @hide
     */
    public void enableCleaner() {
        if (!Flags.handleAbandonedJobs()
                || Compatibility.isChangeEnabled(OVERRIDE_HANDLE_ABANDONED_JOBS)) {
            return;
        }
        // JobParameters objects are passed by reference in local Binder
        // transactions for clients running as SYSTEM. The life cycle of the
        // JobParameters objects are no longer controlled by the client.
@@ -695,6 +713,10 @@ public class JobParameters implements Parcelable {
     * @hide
     */
    public void disableCleaner() {
        if (!Flags.handleAbandonedJobs()
                || Compatibility.isChangeEnabled(OVERRIDE_HANDLE_ABANDONED_JOBS)) {
            return;
        }
        if (mJobCleanupCallback != null) {
            mJobCleanupCallback.disableCleaner();
            if (mCleanable != null) {
+3 −7
Original line number Diff line number Diff line
@@ -165,11 +165,9 @@ public abstract class JobServiceEngine {
                case MSG_EXECUTE_JOB: {
                    final JobParameters params = (JobParameters) msg.obj;
                    try {
                        if (Flags.handleAbandonedJobs()) {
                        params.enableCleaner();
                        }
                        boolean workOngoing = JobServiceEngine.this.onStartJob(params);
                        if (Flags.handleAbandonedJobs() && !workOngoing) {
                        if (!workOngoing) {
                            params.disableCleaner();
                        }
                        ackStartMessage(params, workOngoing);
@@ -196,9 +194,7 @@ public abstract class JobServiceEngine {
                    IJobCallback callback = params.getCallback();
                    if (callback != null) {
                        try {
                            if (Flags.handleAbandonedJobs()) {
                            params.disableCleaner();
                            }
                            callback.jobFinished(params.getJobId(), needsReschedule);
                        } catch (RemoteException e) {
                            Log.e(TAG, "Error reporting job finish to system: binder has gone" +
+15 −6
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.job;

import static android.app.job.JobParameters.OVERRIDE_HANDLE_ABANDONED_JOBS;
import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
import static android.Manifest.permission.MANAGE_ACTIVITY_TASKS;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
@@ -1986,8 +1987,8 @@ public class JobSchedulerService extends com.android.server.SystemService
                    jobStatus.getNumAbandonedFailures(),
                    /* 0 is reserved for UNKNOWN_POLICY */
                    jobStatus.getJob().getBackoffPolicy() + 1,
                    shouldUseAggressiveBackoff(jobStatus.getNumAbandonedFailures()));

                    shouldUseAggressiveBackoff(
                            jobStatus.getNumAbandonedFailures(), jobStatus.getSourceUid()));

            // If the job is immediately ready to run, then we can just immediately
            // put it in the pending list and try to schedule it.  This is especially
@@ -2432,7 +2433,8 @@ public class JobSchedulerService extends com.android.server.SystemService
                    cancelled.getNumAbandonedFailures(),
                    /* 0 is reserved for UNKNOWN_POLICY */
                    cancelled.getJob().getBackoffPolicy() + 1,
                    shouldUseAggressiveBackoff(cancelled.getNumAbandonedFailures()));
                    shouldUseAggressiveBackoff(
                            cancelled.getNumAbandonedFailures(), cancelled.getSourceUid()));
        }
        // If this is a replacement, bring in the new version of the job
        if (incomingJob != null) {
@@ -3024,6 +3026,7 @@ public class JobSchedulerService extends com.android.server.SystemService
        int numFailures = failureToReschedule.getNumFailures();
        int numAbandonedFailures = failureToReschedule.getNumAbandonedFailures();
        int numSystemStops = failureToReschedule.getNumSystemStops();
        final int uid = failureToReschedule.getSourceUid();
        // We should back off slowly if JobScheduler keeps stopping the job,
        // but back off immediately if the issue appeared to be the app's fault
        // or the user stopped the job somehow.
@@ -3033,6 +3036,7 @@ public class JobSchedulerService extends com.android.server.SystemService
                || stopReason == JobParameters.STOP_REASON_USER) {
            numFailures++;
        } else if (android.app.job.Flags.handleAbandonedJobs()
                && !CompatChanges.isChangeEnabled(OVERRIDE_HANDLE_ABANDONED_JOBS, uid)
                && internalStopReason == JobParameters.INTERNAL_STOP_REASON_TIMEOUT_ABANDONED) {
            numAbandonedFailures++;
            numFailures++;
@@ -3041,7 +3045,7 @@ public class JobSchedulerService extends com.android.server.SystemService
        }

        int backoffPolicy = job.getBackoffPolicy();
        if (shouldUseAggressiveBackoff(numAbandonedFailures)) {
        if (shouldUseAggressiveBackoff(numAbandonedFailures, uid)) {
            backoffPolicy = JobInfo.BACKOFF_POLICY_EXPONENTIAL;
        }

@@ -3112,8 +3116,9 @@ public class JobSchedulerService extends com.android.server.SystemService
     * @return {@code true} if the given number of abandoned failures indicates that JobScheduler
     *     should use an aggressive backoff policy.
     */
    public boolean shouldUseAggressiveBackoff(int numAbandonedFailures) {
    public boolean shouldUseAggressiveBackoff(int numAbandonedFailures, int uid) {
        return android.app.job.Flags.handleAbandonedJobs()
                && !CompatChanges.isChangeEnabled(OVERRIDE_HANDLE_ABANDONED_JOBS, uid)
                && numAbandonedFailures
                        > mConstants.ABANDONED_JOB_TIMEOUTS_BEFORE_AGGRESSIVE_BACKOFF;
    }
@@ -3223,7 +3228,9 @@ public class JobSchedulerService extends com.android.server.SystemService
    @VisibleForTesting
    void maybeProcessBuggyJob(@NonNull JobStatus jobStatus, int debugStopReason) {
        boolean jobTimedOut = debugStopReason == JobParameters.INTERNAL_STOP_REASON_TIMEOUT;
        if (android.app.job.Flags.handleAbandonedJobs()) {
        if (android.app.job.Flags.handleAbandonedJobs()
                && !CompatChanges.isChangeEnabled(
                        OVERRIDE_HANDLE_ABANDONED_JOBS, jobStatus.getSourceUid())) {
            jobTimedOut |= (debugStopReason
                == JobParameters.INTERNAL_STOP_REASON_TIMEOUT_ABANDONED);
        }
@@ -3309,6 +3316,8 @@ public class JobSchedulerService extends com.android.server.SystemService
        final JobStatus rescheduledJob = needsReschedule
                ? getRescheduleJobForFailureLocked(jobStatus, stopReason, debugStopReason) : null;
        final boolean isStopReasonAbandoned = android.app.job.Flags.handleAbandonedJobs()
                && !CompatChanges.isChangeEnabled(
                        OVERRIDE_HANDLE_ABANDONED_JOBS, jobStatus.getSourceUid())
                && (debugStopReason == JobParameters.INTERNAL_STOP_REASON_TIMEOUT_ABANDONED);
        if (rescheduledJob != null
                && !rescheduledJob.shouldTreatAsUserInitiatedJob()
Loading