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

Commit 5141c444 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7402811 from e487bd11 to sc-release

Change-Id: I3a7776b6e28013855ee792d985bd74379b4e6bbc
parents 62767af3 e487bd11
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -273,9 +273,12 @@ java_library {
    installable: false,
}

// NOTE: This filegroup is exposed for vendor libraries to depend on and is referenced in
// documentation. Do not remove without consulting the treble/hidl teams.
filegroup {
    name: "framework-jarjar-rules",
    srcs: ["framework-jarjar-rules.txt"],
    visibility: ["//visibility:public"],
}

java_defaults {
+5 −1
Original line number Diff line number Diff line
@@ -1229,7 +1229,11 @@ public class JobInfo implements Parcelable {
         * </ul>
         * Note that the system may choose to delay jobs with large network
         * usage estimates when the device has a poor network connection, in
         * order to save battery.
         * order to save battery and possible network costs.
         * Starting from Android version {@link Build.VERSION_CODES#S}, JobScheduler may attempt
         * to run large jobs when the device is charging and on an unmetered network, even if the
         * network is slow. This gives large jobs an opportunity to make forward progress, even if
         * they risk timing out.
         * <p>
         * The values provided here only reflect the traffic that will be
         * performed by the base job; if you're using {@link JobWorkItem} then
+1 −1
Original line number Diff line number Diff line
@@ -547,7 +547,7 @@ public class DeviceIdleController extends SystemService
    private int[] mPowerSaveWhitelistUserAppIdArray = new int[0];

    /**
     * List of end times for UIDs that are temporarily marked as being allowed to access
     * List of end times for app-IDs that are temporarily marked as being allowed to access
     * the network and acquire wakelocks. Times are in milliseconds.
     */
    private final SparseArray<Pair<MutableLong, String>> mTempWhitelistAppIdEndTimes
+9 −13
Original line number Diff line number Diff line
@@ -121,7 +121,6 @@ import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.IAppOpsCallback;
import com.android.internal.app.IAppOpsService;
import com.android.internal.os.BinderDeathDispatcher;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.FrameworkStatsLog;
import com.android.internal.util.LocalLog;
@@ -184,8 +183,7 @@ public class AlarmManagerService extends SystemService {
    static final boolean DEBUG_BG_LIMIT = localLOGV || false;
    static final boolean DEBUG_STANDBY = localLOGV || false;
    static final boolean RECORD_ALARMS_IN_HISTORY = true;
    // TODO(b/178484639) : Turn off once alarms and reminders work is complete.
    static final boolean RECORD_DEVICE_IDLE_ALARMS = true;
    static final boolean RECORD_DEVICE_IDLE_ALARMS = false;
    static final String TIMEZONE_PROPERTY = "persist.sys.timezone";

    static final int TICK_HISTORY_DEPTH = 10;
@@ -206,8 +204,6 @@ public class AlarmManagerService extends SystemService {
                    .addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING
                            | Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);

    private static final BinderDeathDispatcher<IAlarmListener> sListenerDeathDispatcher =
            new BinderDeathDispatcher<>();
    final LocalLog mLog = new LocalLog(TAG);

    AppOpsManager mAppOps;
@@ -1837,8 +1833,9 @@ public class AlarmManagerService extends SystemService {
        }

        if (directReceiver != null) {
            if (sListenerDeathDispatcher.linkToDeath(directReceiver, mListenerDeathRecipient)
                    <= 0) {
            try {
                directReceiver.asBinder().linkToDeath(mListenerDeathRecipient, 0);
            } catch (RemoteException e) {
                Slog.w(TAG, "Dropping unreachable alarm listener " + listenerTag);
                return;
            }
@@ -2851,12 +2848,6 @@ public class AlarmManagerService extends SystemService {
                pw.println();
            }

            pw.println("Listener death dispatcher state:");
            pw.increaseIndent();
            sListenerDeathDispatcher.dump(pw);
            pw.println();
            pw.decreaseIndent();

            if (mLog.dump(pw, "Recent problems:")) {
                pw.println();
            }
@@ -3448,6 +3439,9 @@ public class AlarmManagerService extends SystemService {

        for (final Alarm removed : removedAlarms) {
            decrementAlarmCount(removed.uid, 1);
            if (removed.listener != null) {
                removed.listener.asBinder().unlinkToDeath(mListenerDeathRecipient, 0);
            }
            if (!RemovedAlarm.isLoggable(reason)) {
                continue;
            }
@@ -4701,6 +4695,8 @@ public class AlarmManagerService extends SystemService {
                    // Direct listener callback alarm
                    mListenerCount++;

                    alarm.listener.asBinder().unlinkToDeath(mListenerDeathRecipient, 0);

                    if (RECORD_ALARMS_IN_HISTORY) {
                        if (alarm.listener == mTimeTickTrigger) {
                            mTickHistory[mNextTickHistory++] = nowELAPSED;
+67 −2
Original line number Diff line number Diff line
@@ -25,12 +25,18 @@ import static com.android.server.job.JobSchedulerService.sElapsedRealtimeClock;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.job.JobInfo;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.ConnectivityManager.NetworkCallback;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkPolicyManager;
import android.net.NetworkRequest;
import android.os.BatteryManager;
import android.os.BatteryManagerInternal;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
@@ -101,6 +107,8 @@ public final class ConnectivityController extends RestrictingController implemen
    private final ConnectivityManager mConnManager;
    private final NetworkPolicyManagerInternal mNetPolicyManagerInternal;

    private final ChargingTracker mChargingTracker;

    /** List of tracked jobs keyed by source UID. */
    @GuardedBy("mLock")
    private final SparseArray<ArraySet<JobStatus>> mTrackedJobs = new SparseArray<>();
@@ -229,6 +237,9 @@ public final class ConnectivityController extends RestrictingController implemen
        // network changes against the active network for each UID with jobs.
        final NetworkRequest request = new NetworkRequest.Builder().clearCapabilities().build();
        mConnManager.registerNetworkCallback(request, mNetworkCallback);

        mChargingTracker = new ChargingTracker();
        mChargingTracker.startTracking();
    }

    @GuardedBy("mLock")
@@ -538,6 +549,14 @@ public final class ConnectivityController extends RestrictingController implemen
     */
    private boolean isInsane(JobStatus jobStatus, Network network,
            NetworkCapabilities capabilities, Constants constants) {
        if (capabilities.hasCapability(NET_CAPABILITY_NOT_METERED)
                && mChargingTracker.isCharging()) {
            // We're charging and on an unmetered network. We don't have to be as conservative about
            // making sure the job will run within its max execution time. Let's just hope the app
            // supports interruptible work.
            return false;
        }

        // Use the maximum possible time since it gives us an upper bound, even though the job
        // could end up stopping earlier.
        final long maxJobExecutionTimeMs = mService.getMaxJobExecutionTimeMs(jobStatus);
@@ -922,7 +941,7 @@ public final class ConnectivityController extends RestrictingController implemen
     *                      {@link Network}, or {@code null} to update all tracked jobs.
     */
    @GuardedBy("mLock")
    private void updateTrackedJobsLocked(int filterUid, Network filterNetwork) {
    private void updateTrackedJobsLocked(int filterUid, @Nullable Network filterNetwork) {
        boolean changed = false;
        if (filterUid == -1) {
            for (int i = mTrackedJobs.size() - 1; i >= 0; i--) {
@@ -937,7 +956,8 @@ public final class ConnectivityController extends RestrictingController implemen
    }

    @GuardedBy("mLock")
    private boolean updateTrackedJobsLocked(ArraySet<JobStatus> jobs, Network filterNetwork) {
    private boolean updateTrackedJobsLocked(ArraySet<JobStatus> jobs,
            @Nullable Network filterNetwork) {
        if (jobs == null || jobs.size() == 0) {
            return false;
        }
@@ -993,6 +1013,51 @@ public final class ConnectivityController extends RestrictingController implemen
        }
    }

    private final class ChargingTracker extends BroadcastReceiver {
        /**
         * Track whether we're "charging", where charging means that we're ready to commit to
         * doing work.
         */
        private boolean mCharging;

        ChargingTracker() {}

        public void startTracking() {
            IntentFilter filter = new IntentFilter();
            filter.addAction(BatteryManager.ACTION_CHARGING);
            filter.addAction(BatteryManager.ACTION_DISCHARGING);
            mContext.registerReceiver(this, filter);

            // Initialise tracker state.
            final BatteryManagerInternal batteryManagerInternal =
                    LocalServices.getService(BatteryManagerInternal.class);
            mCharging = batteryManagerInternal.isPowered(BatteryManager.BATTERY_PLUGGED_ANY);
        }

        public boolean isCharging() {
            return mCharging;
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            synchronized (mLock) {
                final String action = intent.getAction();
                if (BatteryManager.ACTION_CHARGING.equals(action)) {
                    if (mCharging) {
                        return;
                    }
                    mCharging = true;
                } else if (BatteryManager.ACTION_DISCHARGING.equals(action)) {
                    if (!mCharging) {
                        return;
                    }
                    mCharging = false;
                }
                updateTrackedJobsLocked(-1, null);
            }
        }
    }

    private final NetworkCallback mNetworkCallback = new NetworkCallback() {
        @Override
        public void onAvailable(Network network) {
Loading