Loading core/java/android/app/ActivityManagerInternal.java +4 −2 Original line number Diff line number Diff line Loading @@ -529,9 +529,11 @@ public abstract class ActivityManagerInternal { Notification notification, int id, String pkg, @UserIdInt int userId); /** * Un-foreground all foreground services in the given app. * Fully stop the given app's processes without restoring service starts or * bindings, but without the other durable effects of the full-scale * "force stop" intervention. */ public abstract void makeServicesNonForeground(String pkg, @UserIdInt int userId); public abstract void stopAppForUser(String pkg, @UserIdInt int userId); /** * If the given app has any FGSs whose notifications are in the given channel, Loading core/java/android/app/IActivityManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -279,7 +279,7 @@ interface IActivityManager { List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState(); boolean clearApplicationUserData(in String packageName, boolean keepState, in IPackageDataObserver observer, int userId); void makeServicesNonForeground(in String packageName, int userId); void stopAppForUser(in String packageName, int userId); /** Returns {@code false} if the callback could not be registered, {@true} otherwise. */ boolean registerForegroundServiceObserver(in IForegroundServiceObserver callback); @UnsupportedAppUsage Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/RunningFgsControllerImpl.kt +1 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ class RunningFgsControllerImpl @Inject constructor( override fun stopFgs(userId: Int, packageName: String) { init() try { activityManager.makeServicesNonForeground(packageName, userId) activityManager.stopAppForUser(packageName, userId) } catch (e: RemoteException) { e.rethrowFromSystemServer() } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/RunningFgsControllerTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -246,7 +246,7 @@ public class RunningFgsControllerTest extends SysuiTestCase { public void testStopFgs() throws RemoteException { String pkgName = "package.name"; mController.stopFgs(0, pkgName); verify(mActivityManager).makeServicesNonForeground(pkgName, 0); verify(mActivityManager).stopAppForUser(pkgName, 0); } /** Loading services/core/java/com/android/server/am/ActiveServices.java +0 −23 Original line number Diff line number Diff line Loading @@ -5150,29 +5150,6 @@ public final class ActiveServices { return didSomething; } void makeServicesNonForegroundLocked(final String pkg, final @UserIdInt int userId) { final ServiceMap smap = mServiceMap.get(userId); if (smap != null) { ArrayList<ServiceRecord> fgsList = new ArrayList<>(); for (int i = 0; i < smap.mServicesByInstanceName.size(); i++) { final ServiceRecord sr = smap.mServicesByInstanceName.valueAt(i); if (sr.appInfo.packageName.equals(pkg) && sr.isForeground) { fgsList.add(sr); } } final int numServices = fgsList.size(); if (DEBUG_FOREGROUND_SERVICE) { Slog.i(TAG_SERVICE, "Forcing " + numServices + " services out of foreground in u" + userId + "/" + pkg); } for (int i = 0; i < numServices; i++) { final ServiceRecord sr = fgsList.get(i); setServiceForegroundInnerLocked(sr, 0, null, Service.STOP_FOREGROUND_REMOVE, 0); } } } @GuardedBy("mAm") private void signalForegroundServiceObserversLocked(ServiceRecord r) { final int num = mFgsObservers.beginBroadcast(); Loading Loading
core/java/android/app/ActivityManagerInternal.java +4 −2 Original line number Diff line number Diff line Loading @@ -529,9 +529,11 @@ public abstract class ActivityManagerInternal { Notification notification, int id, String pkg, @UserIdInt int userId); /** * Un-foreground all foreground services in the given app. * Fully stop the given app's processes without restoring service starts or * bindings, but without the other durable effects of the full-scale * "force stop" intervention. */ public abstract void makeServicesNonForeground(String pkg, @UserIdInt int userId); public abstract void stopAppForUser(String pkg, @UserIdInt int userId); /** * If the given app has any FGSs whose notifications are in the given channel, Loading
core/java/android/app/IActivityManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -279,7 +279,7 @@ interface IActivityManager { List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState(); boolean clearApplicationUserData(in String packageName, boolean keepState, in IPackageDataObserver observer, int userId); void makeServicesNonForeground(in String packageName, int userId); void stopAppForUser(in String packageName, int userId); /** Returns {@code false} if the callback could not be registered, {@true} otherwise. */ boolean registerForegroundServiceObserver(in IForegroundServiceObserver callback); @UnsupportedAppUsage Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/RunningFgsControllerImpl.kt +1 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ class RunningFgsControllerImpl @Inject constructor( override fun stopFgs(userId: Int, packageName: String) { init() try { activityManager.makeServicesNonForeground(packageName, userId) activityManager.stopAppForUser(packageName, userId) } catch (e: RemoteException) { e.rethrowFromSystemServer() } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/RunningFgsControllerTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -246,7 +246,7 @@ public class RunningFgsControllerTest extends SysuiTestCase { public void testStopFgs() throws RemoteException { String pkgName = "package.name"; mController.stopFgs(0, pkgName); verify(mActivityManager).makeServicesNonForeground(pkgName, 0); verify(mActivityManager).stopAppForUser(pkgName, 0); } /** Loading
services/core/java/com/android/server/am/ActiveServices.java +0 −23 Original line number Diff line number Diff line Loading @@ -5150,29 +5150,6 @@ public final class ActiveServices { return didSomething; } void makeServicesNonForegroundLocked(final String pkg, final @UserIdInt int userId) { final ServiceMap smap = mServiceMap.get(userId); if (smap != null) { ArrayList<ServiceRecord> fgsList = new ArrayList<>(); for (int i = 0; i < smap.mServicesByInstanceName.size(); i++) { final ServiceRecord sr = smap.mServicesByInstanceName.valueAt(i); if (sr.appInfo.packageName.equals(pkg) && sr.isForeground) { fgsList.add(sr); } } final int numServices = fgsList.size(); if (DEBUG_FOREGROUND_SERVICE) { Slog.i(TAG_SERVICE, "Forcing " + numServices + " services out of foreground in u" + userId + "/" + pkg); } for (int i = 0; i < numServices; i++) { final ServiceRecord sr = fgsList.get(i); setServiceForegroundInnerLocked(sr, 0, null, Service.STOP_FOREGROUND_REMOVE, 0); } } } @GuardedBy("mAm") private void signalForegroundServiceObserversLocked(ServiceRecord r) { final int num = mFgsObservers.beginBroadcast(); Loading