From 8797e1f00b829c9ed2e4d3f267218f3668b15580 Mon Sep 17 00:00:00 2001 From: Hui Yu Date: Mon, 27 Feb 2023 17:09:56 +0000 Subject: [PATCH] Add interface tempAllowWhileInUsePermissionInFgs() to ActivityManagerInternal. So Telecomm can potentially call tempAllowWhileInUsePermissionInFgs() to allow a FGS started for incoming call to have a while-in-use permission. Previously tempAllowWhileInUsePermissionInFgs() is an interface in ActivityManagerLocal, because Telecomm is in packages/services/Telecomm directory, it has difficulty to call ActivityManagerLocal interfaces. Add tempAllowWhileInUsePermissionInFgs() to ActivityManagerInternal is the easiest workaround. Bug: 270966067 Test: build and run. Change-Id: I1112ec2b9d4d4a273f47d7d9abae1bd91f2987c2 --- core/java/android/app/ActivityManagerInternal.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/java/android/app/ActivityManagerInternal.java b/core/java/android/app/ActivityManagerInternal.java index 90427cb51c260..b96f8c94aaa3d 100644 --- a/core/java/android/app/ActivityManagerInternal.java +++ b/core/java/android/app/ActivityManagerInternal.java @@ -994,6 +994,16 @@ public abstract class ActivityManagerInternal { */ public abstract void logFgsApiEnd(int apiType, int uid, int pid); + /** + * Temporarily allow foreground service started by an uid to have while-in-use permission + * for durationMs. + * + * @param uid The UID of the app that starts the foreground service. + * @param durationMs elapsedRealTime duration in milliseconds. + * @hide + */ + public abstract void tempAllowWhileInUsePermissionInFgs(int uid, long durationMs); + /** * The list of the events about the {@link android.media.projection.IMediaProjection} itself. *