Loading services/core/java/com/android/server/am/ProcessRecord.java +11 −6 Original line number Diff line number Diff line Loading @@ -16,10 +16,13 @@ package com.android.server.am; import static com.android.internal.util.Preconditions.checkArgument; import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.am.ActivityManagerService.MY_PID; import static java.util.Objects.requireNonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityManager; Loading Loading @@ -63,7 +66,6 @@ import com.android.server.wm.WindowProcessListener; import java.io.PrintWriter; import java.util.Arrays; import java.util.List; import java.util.Objects; /** * Full information about a particular process that Loading Loading @@ -1350,16 +1352,19 @@ class ProcessRecord implements WindowProcessListener { * {@param originatingToken} if you have one such originating token, this is useful for tracing * back the grant in the case of the notification token. */ void addOrUpdateBackgroundStartPrivileges(Binder entity, BackgroundStartPrivileges backgroundStartPrivileges) { Objects.requireNonNull(entity); void addOrUpdateBackgroundStartPrivileges(@NonNull Binder entity, @NonNull BackgroundStartPrivileges backgroundStartPrivileges) { requireNonNull(entity, "entity"); requireNonNull(backgroundStartPrivileges, "backgroundStartPrivileges"); checkArgument(backgroundStartPrivileges.allowsAny(), "backgroundStartPrivileges does not allow anything"); mWindowProcessController.addOrUpdateBackgroundStartPrivileges(entity, backgroundStartPrivileges); setBackgroundStartPrivileges(entity, backgroundStartPrivileges); } void removeBackgroundStartPrivileges(Binder entity) { Objects.requireNonNull(entity); void removeBackgroundStartPrivileges(@NonNull Binder entity) { requireNonNull(entity, "entity"); mWindowProcessController.removeBackgroundStartPrivileges(entity); setBackgroundStartPrivileges(entity, null); } Loading services/core/java/com/android/server/am/ServiceRecord.java +4 −3 Original line number Diff line number Diff line Loading @@ -850,10 +850,11 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN mAppForAllowingBgActivityStartsByStart = mBackgroundStartPrivilegesByStartMerged.allowsAny() ? proc : null; if (mBackgroundStartPrivilegesByStartMerged.allowsAny() || mIsAllowedBgActivityStartsByBinding) { BackgroundStartPrivileges backgroundStartPrivileges = getBackgroundStartPrivilegesWithExclusiveToken(); if (backgroundStartPrivileges.allowsAny()) { proc.addOrUpdateBackgroundStartPrivileges(this, getBackgroundStartPrivilegesWithExclusiveToken()); backgroundStartPrivileges); } else { proc.removeBackgroundStartPrivileges(this); } Loading services/core/java/com/android/server/wm/BackgroundLaunchProcessController.java +5 −4 Original line number Diff line number Diff line Loading @@ -254,11 +254,12 @@ class BackgroundLaunchProcessController { * * If {@code entity} is already added, this method will update its {@code originatingToken}. */ void addOrUpdateAllowBackgroundStartPrivileges( Binder entity, BackgroundStartPrivileges backgroundStartPrivileges) { void addOrUpdateAllowBackgroundStartPrivileges(@NonNull Binder entity, @NonNull BackgroundStartPrivileges backgroundStartPrivileges) { requireNonNull(entity, "entity"); requireNonNull(backgroundStartPrivileges, "backgroundStartPrivileges"); checkArgument(backgroundStartPrivileges.allowsAny()); checkArgument(backgroundStartPrivileges.allowsAny(), "backgroundStartPrivileges does not allow anything"); synchronized (this) { if (mBackgroundStartPrivileges == null) { mBackgroundStartPrivileges = new ArrayMap<>(); Loading @@ -271,7 +272,7 @@ class BackgroundLaunchProcessController { * Removes token {@code entity} that allowed background activity starts added via {@link * #addOrUpdateAllowBackgroundStartPrivileges(Binder, BackgroundStartPrivileges)}. */ void removeAllowBackgroundStartPrivileges(Binder entity) { void removeAllowBackgroundStartPrivileges(@NonNull Binder entity) { requireNonNull(entity, "entity"); synchronized (this) { if (mBackgroundStartPrivileges != null) { Loading services/core/java/com/android/server/wm/WindowProcessController.java +10 −3 Original line number Diff line number Diff line Loading @@ -45,6 +45,8 @@ import static com.android.server.wm.ActivityTaskManagerService.RELAUNCH_REASON_N import static com.android.server.wm.BackgroundActivityStartController.BAL_BLOCK; import static com.android.server.wm.WindowManagerService.MY_PID; import static java.util.Objects.requireNonNull; import android.Manifest; import android.annotation.NonNull; import android.annotation.Nullable; Loading Loading @@ -559,14 +561,19 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio * @see BackgroundLaunchProcessController#addOrUpdateAllowBackgroundStartPrivileges(Binder, * BackgroundStartPrivileges) */ public void addOrUpdateBackgroundStartPrivileges(Binder entity, BackgroundStartPrivileges backgroundStartPrivileges) { public void addOrUpdateBackgroundStartPrivileges(@NonNull Binder entity, @NonNull BackgroundStartPrivileges backgroundStartPrivileges) { requireNonNull(entity, "entity"); requireNonNull(backgroundStartPrivileges, "backgroundStartPrivileges"); checkArgument(backgroundStartPrivileges.allowsAny(), "backgroundStartPrivileges does not allow anything"); mBgLaunchController.addOrUpdateAllowBackgroundStartPrivileges(entity, backgroundStartPrivileges); } /** @see BackgroundLaunchProcessController#removeAllowBackgroundStartPrivileges(Binder) */ public void removeBackgroundStartPrivileges(Binder entity) { public void removeBackgroundStartPrivileges(@NonNull Binder entity) { requireNonNull(entity, "entity"); mBgLaunchController.removeAllowBackgroundStartPrivileges(entity); } Loading Loading
services/core/java/com/android/server/am/ProcessRecord.java +11 −6 Original line number Diff line number Diff line Loading @@ -16,10 +16,13 @@ package com.android.server.am; import static com.android.internal.util.Preconditions.checkArgument; import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.am.ActivityManagerService.MY_PID; import static java.util.Objects.requireNonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityManager; Loading Loading @@ -63,7 +66,6 @@ import com.android.server.wm.WindowProcessListener; import java.io.PrintWriter; import java.util.Arrays; import java.util.List; import java.util.Objects; /** * Full information about a particular process that Loading Loading @@ -1350,16 +1352,19 @@ class ProcessRecord implements WindowProcessListener { * {@param originatingToken} if you have one such originating token, this is useful for tracing * back the grant in the case of the notification token. */ void addOrUpdateBackgroundStartPrivileges(Binder entity, BackgroundStartPrivileges backgroundStartPrivileges) { Objects.requireNonNull(entity); void addOrUpdateBackgroundStartPrivileges(@NonNull Binder entity, @NonNull BackgroundStartPrivileges backgroundStartPrivileges) { requireNonNull(entity, "entity"); requireNonNull(backgroundStartPrivileges, "backgroundStartPrivileges"); checkArgument(backgroundStartPrivileges.allowsAny(), "backgroundStartPrivileges does not allow anything"); mWindowProcessController.addOrUpdateBackgroundStartPrivileges(entity, backgroundStartPrivileges); setBackgroundStartPrivileges(entity, backgroundStartPrivileges); } void removeBackgroundStartPrivileges(Binder entity) { Objects.requireNonNull(entity); void removeBackgroundStartPrivileges(@NonNull Binder entity) { requireNonNull(entity, "entity"); mWindowProcessController.removeBackgroundStartPrivileges(entity); setBackgroundStartPrivileges(entity, null); } Loading
services/core/java/com/android/server/am/ServiceRecord.java +4 −3 Original line number Diff line number Diff line Loading @@ -850,10 +850,11 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN mAppForAllowingBgActivityStartsByStart = mBackgroundStartPrivilegesByStartMerged.allowsAny() ? proc : null; if (mBackgroundStartPrivilegesByStartMerged.allowsAny() || mIsAllowedBgActivityStartsByBinding) { BackgroundStartPrivileges backgroundStartPrivileges = getBackgroundStartPrivilegesWithExclusiveToken(); if (backgroundStartPrivileges.allowsAny()) { proc.addOrUpdateBackgroundStartPrivileges(this, getBackgroundStartPrivilegesWithExclusiveToken()); backgroundStartPrivileges); } else { proc.removeBackgroundStartPrivileges(this); } Loading
services/core/java/com/android/server/wm/BackgroundLaunchProcessController.java +5 −4 Original line number Diff line number Diff line Loading @@ -254,11 +254,12 @@ class BackgroundLaunchProcessController { * * If {@code entity} is already added, this method will update its {@code originatingToken}. */ void addOrUpdateAllowBackgroundStartPrivileges( Binder entity, BackgroundStartPrivileges backgroundStartPrivileges) { void addOrUpdateAllowBackgroundStartPrivileges(@NonNull Binder entity, @NonNull BackgroundStartPrivileges backgroundStartPrivileges) { requireNonNull(entity, "entity"); requireNonNull(backgroundStartPrivileges, "backgroundStartPrivileges"); checkArgument(backgroundStartPrivileges.allowsAny()); checkArgument(backgroundStartPrivileges.allowsAny(), "backgroundStartPrivileges does not allow anything"); synchronized (this) { if (mBackgroundStartPrivileges == null) { mBackgroundStartPrivileges = new ArrayMap<>(); Loading @@ -271,7 +272,7 @@ class BackgroundLaunchProcessController { * Removes token {@code entity} that allowed background activity starts added via {@link * #addOrUpdateAllowBackgroundStartPrivileges(Binder, BackgroundStartPrivileges)}. */ void removeAllowBackgroundStartPrivileges(Binder entity) { void removeAllowBackgroundStartPrivileges(@NonNull Binder entity) { requireNonNull(entity, "entity"); synchronized (this) { if (mBackgroundStartPrivileges != null) { Loading
services/core/java/com/android/server/wm/WindowProcessController.java +10 −3 Original line number Diff line number Diff line Loading @@ -45,6 +45,8 @@ import static com.android.server.wm.ActivityTaskManagerService.RELAUNCH_REASON_N import static com.android.server.wm.BackgroundActivityStartController.BAL_BLOCK; import static com.android.server.wm.WindowManagerService.MY_PID; import static java.util.Objects.requireNonNull; import android.Manifest; import android.annotation.NonNull; import android.annotation.Nullable; Loading Loading @@ -559,14 +561,19 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio * @see BackgroundLaunchProcessController#addOrUpdateAllowBackgroundStartPrivileges(Binder, * BackgroundStartPrivileges) */ public void addOrUpdateBackgroundStartPrivileges(Binder entity, BackgroundStartPrivileges backgroundStartPrivileges) { public void addOrUpdateBackgroundStartPrivileges(@NonNull Binder entity, @NonNull BackgroundStartPrivileges backgroundStartPrivileges) { requireNonNull(entity, "entity"); requireNonNull(backgroundStartPrivileges, "backgroundStartPrivileges"); checkArgument(backgroundStartPrivileges.allowsAny(), "backgroundStartPrivileges does not allow anything"); mBgLaunchController.addOrUpdateAllowBackgroundStartPrivileges(entity, backgroundStartPrivileges); } /** @see BackgroundLaunchProcessController#removeAllowBackgroundStartPrivileges(Binder) */ public void removeBackgroundStartPrivileges(Binder entity) { public void removeBackgroundStartPrivileges(@NonNull Binder entity) { requireNonNull(entity, "entity"); mBgLaunchController.removeAllowBackgroundStartPrivileges(entity); } Loading