Loading apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java +11 −6 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.app.ActivityManagerInternal; import android.app.AlarmManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.IIntentReceiver; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ApplicationInfo; Loading Loading @@ -740,8 +741,10 @@ public class DeviceIdleController extends SystemService } }; private final BroadcastReceiver mIdleStartedDoneReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { private final IIntentReceiver mIdleStartedDoneReceiver = new IIntentReceiver.Stub() { @Override public void performReceive(Intent intent, int resultCode, String data, Bundle extras, boolean ordered, boolean sticky, int sendingUser) { // When coming out of a deep idle, we will add in some delay before we allow // the system to settle down and finish the maintenance window. This is // to give a chance for any pending work to be scheduled. Loading Loading @@ -1816,13 +1819,15 @@ public class DeviceIdleController extends SystemService } if (deepChanged) { incActiveIdleOps(); getContext().sendOrderedBroadcastAsUser(mIdleIntent, UserHandle.ALL, null, mIdleStartedDoneReceiver, null, 0, null, null); mLocalActivityManager.broadcastIntentWithCallback(mIdleIntent, mIdleStartedDoneReceiver, null, UserHandle.USER_ALL, null, null, null); } if (lightChanged) { incActiveIdleOps(); getContext().sendOrderedBroadcastAsUser(mLightIdleIntent, UserHandle.ALL, null, mIdleStartedDoneReceiver, null, 0, null, null); mLocalActivityManager.broadcastIntentWithCallback(mLightIdleIntent, mIdleStartedDoneReceiver, null, UserHandle.USER_ALL, null, null, null); } // Always start with one active op for the message being sent here. // Now we are done! Loading core/java/android/app/ActivityManagerInternal.java +15 −0 Original line number Diff line number Diff line Loading @@ -649,6 +649,8 @@ public abstract class ActivityManagerInternal { * using the rules of package visibility. Returns extras with legitimate package info that the * receiver is able to access, or {@code null} if none of the packages is visible to the * receiver. * @param serialized Specifies whether or not the broadcast should be delivered to the * receivers in a serial order. * * @see com.android.server.am.ActivityManagerService#broadcastIntentWithFeature( * IApplicationThread, String, Intent, String, IIntentReceiver, int, String, Bundle, Loading @@ -661,6 +663,19 @@ public abstract class ActivityManagerInternal { @Nullable BiFunction<Integer, Bundle, Bundle> filterExtrasForReceiver, @Nullable Bundle bOptions); /** * Variant of * {@link #broadcastIntent(Intent, IIntentReceiver, String[], boolean, int, int[], BiFunction, Bundle)} * that allows sender to receive a finish callback once the broadcast delivery is completed, * but provides no ordering guarantee for how the broadcast is delivered to receivers. */ public abstract int broadcastIntentWithCallback(Intent intent, IIntentReceiver resultTo, String[] requiredPermissions, int userId, int[] appIdAllowList, @Nullable BiFunction<Integer, Bundle, Bundle> filterExtrasForReceiver, @Nullable Bundle bOptions); /** * Add uid to the ActivityManagerService PendingStartActivityUids list. * @param uid uid Loading services/core/java/com/android/server/am/ActivityManagerService.java +15 −0 Original line number Diff line number Diff line Loading @@ -17430,6 +17430,21 @@ public class ActivityManagerService extends IActivityManager.Stub } @Override public int broadcastIntentWithCallback(Intent intent, IIntentReceiver resultTo, String[] requiredPermissions, int userId, int[] appIdAllowList, @Nullable BiFunction<Integer, Bundle, Bundle> filterExtrasForReceiver, @Nullable Bundle bOptions) { // Sending broadcasts with a finish callback without the need for the broadcasts // delivery to be serialized is only supported by modern queue. So, when modern // queue is disabled, we continue to send broadcasts in a serialized fashion. final boolean serialized = !isModernQueueEnabled(); return broadcastIntent(intent, resultTo, requiredPermissions, serialized, userId, appIdAllowList, filterExtrasForReceiver, bOptions); } @Override public ComponentName startServiceInPackage(int uid, Intent service, String resolvedType, boolean fgRequired, String callingPackage, @Nullable String callingFeatureId, Loading
apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java +11 −6 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.app.ActivityManagerInternal; import android.app.AlarmManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.IIntentReceiver; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ApplicationInfo; Loading Loading @@ -740,8 +741,10 @@ public class DeviceIdleController extends SystemService } }; private final BroadcastReceiver mIdleStartedDoneReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { private final IIntentReceiver mIdleStartedDoneReceiver = new IIntentReceiver.Stub() { @Override public void performReceive(Intent intent, int resultCode, String data, Bundle extras, boolean ordered, boolean sticky, int sendingUser) { // When coming out of a deep idle, we will add in some delay before we allow // the system to settle down and finish the maintenance window. This is // to give a chance for any pending work to be scheduled. Loading Loading @@ -1816,13 +1819,15 @@ public class DeviceIdleController extends SystemService } if (deepChanged) { incActiveIdleOps(); getContext().sendOrderedBroadcastAsUser(mIdleIntent, UserHandle.ALL, null, mIdleStartedDoneReceiver, null, 0, null, null); mLocalActivityManager.broadcastIntentWithCallback(mIdleIntent, mIdleStartedDoneReceiver, null, UserHandle.USER_ALL, null, null, null); } if (lightChanged) { incActiveIdleOps(); getContext().sendOrderedBroadcastAsUser(mLightIdleIntent, UserHandle.ALL, null, mIdleStartedDoneReceiver, null, 0, null, null); mLocalActivityManager.broadcastIntentWithCallback(mLightIdleIntent, mIdleStartedDoneReceiver, null, UserHandle.USER_ALL, null, null, null); } // Always start with one active op for the message being sent here. // Now we are done! Loading
core/java/android/app/ActivityManagerInternal.java +15 −0 Original line number Diff line number Diff line Loading @@ -649,6 +649,8 @@ public abstract class ActivityManagerInternal { * using the rules of package visibility. Returns extras with legitimate package info that the * receiver is able to access, or {@code null} if none of the packages is visible to the * receiver. * @param serialized Specifies whether or not the broadcast should be delivered to the * receivers in a serial order. * * @see com.android.server.am.ActivityManagerService#broadcastIntentWithFeature( * IApplicationThread, String, Intent, String, IIntentReceiver, int, String, Bundle, Loading @@ -661,6 +663,19 @@ public abstract class ActivityManagerInternal { @Nullable BiFunction<Integer, Bundle, Bundle> filterExtrasForReceiver, @Nullable Bundle bOptions); /** * Variant of * {@link #broadcastIntent(Intent, IIntentReceiver, String[], boolean, int, int[], BiFunction, Bundle)} * that allows sender to receive a finish callback once the broadcast delivery is completed, * but provides no ordering guarantee for how the broadcast is delivered to receivers. */ public abstract int broadcastIntentWithCallback(Intent intent, IIntentReceiver resultTo, String[] requiredPermissions, int userId, int[] appIdAllowList, @Nullable BiFunction<Integer, Bundle, Bundle> filterExtrasForReceiver, @Nullable Bundle bOptions); /** * Add uid to the ActivityManagerService PendingStartActivityUids list. * @param uid uid Loading
services/core/java/com/android/server/am/ActivityManagerService.java +15 −0 Original line number Diff line number Diff line Loading @@ -17430,6 +17430,21 @@ public class ActivityManagerService extends IActivityManager.Stub } @Override public int broadcastIntentWithCallback(Intent intent, IIntentReceiver resultTo, String[] requiredPermissions, int userId, int[] appIdAllowList, @Nullable BiFunction<Integer, Bundle, Bundle> filterExtrasForReceiver, @Nullable Bundle bOptions) { // Sending broadcasts with a finish callback without the need for the broadcasts // delivery to be serialized is only supported by modern queue. So, when modern // queue is disabled, we continue to send broadcasts in a serialized fashion. final boolean serialized = !isModernQueueEnabled(); return broadcastIntent(intent, resultTo, requiredPermissions, serialized, userId, appIdAllowList, filterExtrasForReceiver, bOptions); } @Override public ComponentName startServiceInPackage(int uid, Intent service, String resolvedType, boolean fgRequired, String callingPackage, @Nullable String callingFeatureId,