Add updateLockTaskPackages API to ActivityTaskManager

The API will be available in CTS so that we can use it directly instead
of calling it from other system components.

Bug: 240602359
Test: Build & call the API from CTS
Change-Id: I8aa6ee85adb62cda67479c7213d2bc022acd0eec
This commit is contained in:
Yanli Wan
2022-08-16 23:32:40 +00:00
parent 582bfc69f2
commit e95e91730e
4 changed files with 15 additions and 0 deletions

View File

@@ -195,6 +195,7 @@ package android.app {
method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void stopSystemLockTaskMode();
method public static boolean supportsMultiWindow(android.content.Context);
method public static boolean supportsSplitScreenMultiWindow(android.content.Context);
method @RequiresPermission("android.permission.UPDATE_LOCK_TASK_PACKAGES") public void updateLockTaskPackages(@NonNull android.content.Context, @NonNull String[]);
field public static final int DEFAULT_MINIMAL_SPLIT_SCREEN_DISPLAY_SIZE_DP = 440; // 0x1b8
field public static final int INVALID_STACK_ID = -1; // 0xffffffff
}

View File

@@ -496,6 +496,16 @@ public class ActivityTaskManager {
}
}
/** Update the list of packages allowed in lock task mode. */
@RequiresPermission(android.Manifest.permission.UPDATE_LOCK_TASK_PACKAGES)
public void updateLockTaskPackages(@NonNull Context context, @NonNull String[] packages) {
try {
getService().updateLockTaskPackages(context.getUserId(), packages);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
/**
* Information you can retrieve about a root task in the system.
* @hide

View File

@@ -173,6 +173,7 @@ interface IActivityTaskManager {
Rect getTaskBounds(int taskId);
void cancelRecentsAnimation(boolean restoreHomeRootTaskPosition);
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.UPDATE_LOCK_TASK_PACKAGES)")
void updateLockTaskPackages(int userId, in String[] packages);
boolean isInLockTaskMode();
int getLockTaskModeState();

View File

@@ -704,6 +704,9 @@
<!-- Permission required for CTS test - CtsKeystoreTestCases -->
<uses-permission android:name="android.permission.REQUEST_UNIQUE_ID_ATTESTATION" />
<!-- Permission required for CTS test - CtsWindowManagerDeviceTestCases-->
<uses-permission android:name="android.permission.UPDATE_LOCK_TASK_PACKAGES" />
<application android:label="@string/app_label"
android:theme="@android:style/Theme.DeviceDefault.DayNight"
android:defaultToDeviceProtectedStorage="true"