diff options
| author | Christopher Tate <ctate@google.com> | 2021-11-03 12:15:13 -0700 |
|---|---|---|
| committer | Christopher Tate <ctate@google.com> | 2021-11-05 14:42:42 -0700 |
| commit | 59ee488c495f35994e816c57e4d37c19e8359cc7 (patch) | |
| tree | 930dff8db71285521e99a20be51ed4e533494116 /core/java | |
| parent | 8d85ed8a3236c3c57f27fae3704c3ff71dfdd6c6 (diff) | |
Infra for SysUI to monitor FGSes
There's now a way for it to track what apps currently have services in
the FGS state in real time.
Bug: 192504071
Test: manual
Test: atest CtsAppTestCases:android.app.cts.ServiceTest
Ignore-AOSP-First: new API should not be revealed in AOSP prior to drop
Change-Id: Ief1b6f8ef7deba6abbbf42f20b3f498861c1fe69
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/IActivityManager.aidl | 3 | ||||
| -rw-r--r-- | core/java/android/app/IForegroundServiceObserver.aidl | 31 | ||||
| -rw-r--r-- | core/java/android/app/OWNERS | 1 |
3 files changed, 35 insertions, 0 deletions
diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl index 658c1309b94e..6b4319ac06e3 100644 --- a/core/java/android/app/IActivityManager.aidl +++ b/core/java/android/app/IActivityManager.aidl @@ -26,6 +26,7 @@ import android.app.GrantedUriPermission; import android.app.IApplicationThread; import android.app.IActivityController; import android.app.IAppTask; +import android.app.IForegroundServiceObserver; import android.app.IInstrumentationWatcher; import android.app.IProcessObserver; import android.app.IServiceConnection; @@ -279,6 +280,8 @@ interface IActivityManager { boolean clearApplicationUserData(in String packageName, boolean keepState, in IPackageDataObserver observer, int userId); void makeServicesNonForeground(in String packageName, int userId); + /** Returns {@code false} if the callback could not be registered, {@true} otherwise. */ + boolean registerForegroundServiceObserver(in IForegroundServiceObserver callback); @UnsupportedAppUsage void forceStopPackage(in String packageName, int userId); boolean killPids(in int[] pids, in String reason, boolean secure); diff --git a/core/java/android/app/IForegroundServiceObserver.aidl b/core/java/android/app/IForegroundServiceObserver.aidl new file mode 100644 index 000000000000..2b0cbed8a507 --- /dev/null +++ b/core/java/android/app/IForegroundServiceObserver.aidl @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2021 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.app; + +/** + * Notify the client of all changes to services' foreground state. + * @param serviceToken unique identifier for a service instance + * @param packageName identifies the app hosting the service + * @param userId identifies the started user in which the app is running + * @param isForeground whether the service is in the "foreground" mode now, i.e. + * whether it is an FGS + * + * @hide + */ +oneway interface IForegroundServiceObserver { + void onForegroundStateChanged(in IBinder serviceToken, in String packageName, int userId, boolean isForeground); +} diff --git a/core/java/android/app/OWNERS b/core/java/android/app/OWNERS index 4da51c13045b..9da5693ff480 100644 --- a/core/java/android/app/OWNERS +++ b/core/java/android/app/OWNERS @@ -15,6 +15,7 @@ per-file IActivityController.aidl = file:/services/core/java/com/android/server/ per-file IActivityManager.aidl = file:/services/core/java/com/android/server/am/OWNERS per-file IApplicationThread.aidl = file:/services/core/java/com/android/server/am/OWNERS per-file IAppTraceRetriever.aidl = file:/services/core/java/com/android/server/am/OWNERS +per-file IForegroundServiceObserver.aidl = file:/services/core/java/com/android/server/am/OWNERS per-file IInstrumentationWatcher.aidl = file:/services/core/java/com/android/server/am/OWNERS per-file IntentService.aidl = file:/services/core/java/com/android/server/am/OWNERS per-file IServiceConnection.aidl = file:/services/core/java/com/android/server/am/OWNERS |
