Loading apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java +5 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.app.usage.UsageStatsManager.REASON_MAIN_DEFAULT; import static android.app.usage.UsageStatsManager.REASON_MAIN_FORCED_BY_USER; import static android.app.usage.UsageStatsManager.REASON_MAIN_MASK; import static android.app.usage.UsageStatsManager.REASON_MAIN_PREDICTED; import static android.app.usage.UsageStatsManager.REASON_MAIN_TIMEOUT; import static android.app.usage.UsageStatsManager.REASON_MAIN_USAGE; import static android.app.usage.UsageStatsManager.REASON_SUB_MASK; import static android.app.usage.UsageStatsManager.REASON_SUB_USAGE_USER_INTERACTION; Loading Loading @@ -259,8 +260,10 @@ public class AppIdleHistory { int bucketingReason = REASON_MAIN_USAGE | usageReason; final boolean isUserUsage = isUserUsage(bucketingReason); if (appUsageHistory.currentBucket == STANDBY_BUCKET_RESTRICTED && !isUserUsage) { // Only user usage should bring an app out of the RESTRICTED bucket. if (appUsageHistory.currentBucket == STANDBY_BUCKET_RESTRICTED && !isUserUsage && (appUsageHistory.bucketingReason & REASON_MAIN_MASK) != REASON_MAIN_TIMEOUT) { // Only user usage should bring an app out of the RESTRICTED bucket, unless the app // just timed out into RESTRICTED. newBucket = STANDBY_BUCKET_RESTRICTED; bucketingReason = appUsageHistory.bucketingReason; } else { Loading api/OWNERS +5 −0 Original line number Diff line number Diff line hansson@google.com # Modularization team file:platform/packages/modules/common:/OWNERS per-file Android.bp = file:platform/build/soong:/OWNERS core/java/android/app/ActivityThread.java +9 −6 Original line number Diff line number Diff line Loading @@ -447,7 +447,7 @@ public final class ActivityThread extends ClientTransactionHandler @GuardedBy("mLock") ContentProviderHolder mHolder; // Temp holder to be used between notifier and waiter Object mLock; // The lock to be used to get notified when the provider is ready final Object mLock; // The lock to be used to get notified when the provider is ready public ProviderKey(String authority, int userId) { this.authority = authority; Loading Loading @@ -1827,13 +1827,16 @@ public final class ActivityThread extends ClientTransactionHandler @Override public void notifyContentProviderPublishStatus(@NonNull ContentProviderHolder holder, @NonNull String auth, int userId, boolean published) { @NonNull String authorities, int userId, boolean published) { final String auths[] = authorities.split(";"); for (String auth: auths) { final ProviderKey key = getGetProviderKey(auth, userId); synchronized (key.mLock) { key.mHolder = holder; key.mLock.notifyAll(); } } } @Override public void instrumentWithoutRestart(ComponentName instrumentationName, Loading core/java/android/app/IApplicationThread.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ oneway interface IApplicationThread { void performDirectAction(IBinder activityToken, String actionId, in Bundle arguments, in RemoteCallback cancellationCallback, in RemoteCallback resultCallback); void notifyContentProviderPublishStatus(in ContentProviderHolder holder, String auth, void notifyContentProviderPublishStatus(in ContentProviderHolder holder, String authorities, int userId, boolean published); void instrumentWithoutRestart(in ComponentName instrumentationName, in Bundle instrumentationArgs, Loading core/java/android/app/Service.java +24 −0 Original line number Diff line number Diff line Loading @@ -697,6 +697,18 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac * service element of manifest file. The value of attribute * {@link android.R.attr#foregroundServiceType} can be multiple flags ORed together.</p> * * <div class="caution"> * <p><strong>Note:</strong> * Beginning with SDK Version {@link android.os.Build.VERSION_CODES#S}, * apps targeting SDK Version {@link android.os.Build.VERSION_CODES#S} * or higher are not allowed to start foreground services from the background. * See * <a href="{@docRoot}/about/versions/12/behavior-changes-12"> * Behavior changes: Apps targeting Android 12 * </a> * for more details. * </div> * * @throws ForegroundServiceStartNotAllowedException * If the app targeting API is * {@link android.os.Build.VERSION_CODES#S} or later, and the service is restricted from Loading Loading @@ -733,6 +745,18 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac * {@link android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_MANIFEST} to use all flags that * is specified in manifest attribute foregroundServiceType.</p> * * <div class="caution"> * <p><strong>Note:</strong> * Beginning with SDK Version {@link android.os.Build.VERSION_CODES#S}, * apps targeting SDK Version {@link android.os.Build.VERSION_CODES#S} * or higher are not allowed to start foreground services from the background. * See * <a href="{@docRoot}/about/versions/12/behavior-changes-12"> * Behavior changes: Apps targeting Android 12 * </a> * for more details. * </div> * * @param id The identifier for this notification as per * {@link NotificationManager#notify(int, Notification) * NotificationManager.notify(int, Notification)}; must not be 0. Loading Loading
apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java +5 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.app.usage.UsageStatsManager.REASON_MAIN_DEFAULT; import static android.app.usage.UsageStatsManager.REASON_MAIN_FORCED_BY_USER; import static android.app.usage.UsageStatsManager.REASON_MAIN_MASK; import static android.app.usage.UsageStatsManager.REASON_MAIN_PREDICTED; import static android.app.usage.UsageStatsManager.REASON_MAIN_TIMEOUT; import static android.app.usage.UsageStatsManager.REASON_MAIN_USAGE; import static android.app.usage.UsageStatsManager.REASON_SUB_MASK; import static android.app.usage.UsageStatsManager.REASON_SUB_USAGE_USER_INTERACTION; Loading Loading @@ -259,8 +260,10 @@ public class AppIdleHistory { int bucketingReason = REASON_MAIN_USAGE | usageReason; final boolean isUserUsage = isUserUsage(bucketingReason); if (appUsageHistory.currentBucket == STANDBY_BUCKET_RESTRICTED && !isUserUsage) { // Only user usage should bring an app out of the RESTRICTED bucket. if (appUsageHistory.currentBucket == STANDBY_BUCKET_RESTRICTED && !isUserUsage && (appUsageHistory.bucketingReason & REASON_MAIN_MASK) != REASON_MAIN_TIMEOUT) { // Only user usage should bring an app out of the RESTRICTED bucket, unless the app // just timed out into RESTRICTED. newBucket = STANDBY_BUCKET_RESTRICTED; bucketingReason = appUsageHistory.bucketingReason; } else { Loading
api/OWNERS +5 −0 Original line number Diff line number Diff line hansson@google.com # Modularization team file:platform/packages/modules/common:/OWNERS per-file Android.bp = file:platform/build/soong:/OWNERS
core/java/android/app/ActivityThread.java +9 −6 Original line number Diff line number Diff line Loading @@ -447,7 +447,7 @@ public final class ActivityThread extends ClientTransactionHandler @GuardedBy("mLock") ContentProviderHolder mHolder; // Temp holder to be used between notifier and waiter Object mLock; // The lock to be used to get notified when the provider is ready final Object mLock; // The lock to be used to get notified when the provider is ready public ProviderKey(String authority, int userId) { this.authority = authority; Loading Loading @@ -1827,13 +1827,16 @@ public final class ActivityThread extends ClientTransactionHandler @Override public void notifyContentProviderPublishStatus(@NonNull ContentProviderHolder holder, @NonNull String auth, int userId, boolean published) { @NonNull String authorities, int userId, boolean published) { final String auths[] = authorities.split(";"); for (String auth: auths) { final ProviderKey key = getGetProviderKey(auth, userId); synchronized (key.mLock) { key.mHolder = holder; key.mLock.notifyAll(); } } } @Override public void instrumentWithoutRestart(ComponentName instrumentationName, Loading
core/java/android/app/IApplicationThread.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ oneway interface IApplicationThread { void performDirectAction(IBinder activityToken, String actionId, in Bundle arguments, in RemoteCallback cancellationCallback, in RemoteCallback resultCallback); void notifyContentProviderPublishStatus(in ContentProviderHolder holder, String auth, void notifyContentProviderPublishStatus(in ContentProviderHolder holder, String authorities, int userId, boolean published); void instrumentWithoutRestart(in ComponentName instrumentationName, in Bundle instrumentationArgs, Loading
core/java/android/app/Service.java +24 −0 Original line number Diff line number Diff line Loading @@ -697,6 +697,18 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac * service element of manifest file. The value of attribute * {@link android.R.attr#foregroundServiceType} can be multiple flags ORed together.</p> * * <div class="caution"> * <p><strong>Note:</strong> * Beginning with SDK Version {@link android.os.Build.VERSION_CODES#S}, * apps targeting SDK Version {@link android.os.Build.VERSION_CODES#S} * or higher are not allowed to start foreground services from the background. * See * <a href="{@docRoot}/about/versions/12/behavior-changes-12"> * Behavior changes: Apps targeting Android 12 * </a> * for more details. * </div> * * @throws ForegroundServiceStartNotAllowedException * If the app targeting API is * {@link android.os.Build.VERSION_CODES#S} or later, and the service is restricted from Loading Loading @@ -733,6 +745,18 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac * {@link android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_MANIFEST} to use all flags that * is specified in manifest attribute foregroundServiceType.</p> * * <div class="caution"> * <p><strong>Note:</strong> * Beginning with SDK Version {@link android.os.Build.VERSION_CODES#S}, * apps targeting SDK Version {@link android.os.Build.VERSION_CODES#S} * or higher are not allowed to start foreground services from the background. * See * <a href="{@docRoot}/about/versions/12/behavior-changes-12"> * Behavior changes: Apps targeting Android 12 * </a> * for more details. * </div> * * @param id The identifier for this notification as per * {@link NotificationManager#notify(int, Notification) * NotificationManager.notify(int, Notification)}; must not be 0. Loading