Re-enforce MANAGE_ACTIVITY_TASKS for applySyncTransaction
The conditional permission was introduced for TaskFragmentOrganizer, but not really needed. Remove the conditional check. Bug: 259938771 Test: pass existing tests Merged-In: I666b9ee6b6076766513b97e675fdbaa002428601 Change-Id: I666b9ee6b6076766513b97e675fdbaa002428601
This commit is contained in:
@@ -3436,7 +3436,7 @@ package android.window {
|
|||||||
|
|
||||||
public class WindowOrganizer {
|
public class WindowOrganizer {
|
||||||
ctor public WindowOrganizer();
|
ctor public WindowOrganizer();
|
||||||
method @RequiresPermission(value=android.Manifest.permission.MANAGE_ACTIVITY_TASKS, conditional=true) public int applySyncTransaction(@NonNull android.window.WindowContainerTransaction, @NonNull android.window.WindowContainerTransactionCallback);
|
method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public int applySyncTransaction(@NonNull android.window.WindowContainerTransaction, @NonNull android.window.WindowContainerTransactionCallback);
|
||||||
method @RequiresPermission(value=android.Manifest.permission.MANAGE_ACTIVITY_TASKS, conditional=true) public void applyTransaction(@NonNull android.window.WindowContainerTransaction);
|
method @RequiresPermission(value=android.Manifest.permission.MANAGE_ACTIVITY_TASKS, conditional=true) public void applyTransaction(@NonNull android.window.WindowContainerTransaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -179,15 +179,6 @@ public class TaskFragmentOrganizer extends WindowOrganizer {
|
|||||||
super.applyTransaction(t);
|
super.applyTransaction(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Suppress the lint because it is not a registration method.
|
|
||||||
@SuppressWarnings("ExecutorRegistration")
|
|
||||||
@Override
|
|
||||||
public int applySyncTransaction(@NonNull WindowContainerTransaction t,
|
|
||||||
@NonNull WindowContainerTransactionCallback callback) {
|
|
||||||
t.setTaskFragmentOrganizer(mInterface);
|
|
||||||
return super.applySyncTransaction(t, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
private final ITaskFragmentOrganizer mInterface = new ITaskFragmentOrganizer.Stub() {
|
private final ITaskFragmentOrganizer mInterface = new ITaskFragmentOrganizer.Stub() {
|
||||||
@Override
|
@Override
|
||||||
public void onTaskFragmentAppeared(@NonNull TaskFragmentInfo taskFragmentInfo) {
|
public void onTaskFragmentAppeared(@NonNull TaskFragmentInfo taskFragmentInfo) {
|
||||||
|
|||||||
@@ -61,9 +61,7 @@ public class WindowOrganizer {
|
|||||||
* Apply multiple WindowContainer operations at once.
|
* Apply multiple WindowContainer operations at once.
|
||||||
*
|
*
|
||||||
* Note that using this API requires the caller to hold
|
* Note that using this API requires the caller to hold
|
||||||
* {@link android.Manifest.permission#MANAGE_ACTIVITY_TASKS}, unless the caller is using
|
* {@link android.Manifest.permission#MANAGE_ACTIVITY_TASKS}.
|
||||||
* {@link TaskFragmentOrganizer}, in which case it is allowed to change TaskFragment that is
|
|
||||||
* created by itself.
|
|
||||||
*
|
*
|
||||||
* @param t The transaction to apply.
|
* @param t The transaction to apply.
|
||||||
* @param callback This transaction will use the synchronization scheme described in
|
* @param callback This transaction will use the synchronization scheme described in
|
||||||
@@ -72,8 +70,7 @@ public class WindowOrganizer {
|
|||||||
* @return An ID for the sync operation which will later be passed to transactionReady callback.
|
* @return An ID for the sync operation which will later be passed to transactionReady callback.
|
||||||
* This lets the caller differentiate overlapping sync operations.
|
* This lets the caller differentiate overlapping sync operations.
|
||||||
*/
|
*/
|
||||||
@RequiresPermission(value = android.Manifest.permission.MANAGE_ACTIVITY_TASKS,
|
@RequiresPermission(value = android.Manifest.permission.MANAGE_ACTIVITY_TASKS)
|
||||||
conditional = true)
|
|
||||||
public int applySyncTransaction(@NonNull WindowContainerTransaction t,
|
public int applySyncTransaction(@NonNull WindowContainerTransaction t,
|
||||||
@NonNull WindowContainerTransactionCallback callback) {
|
@NonNull WindowContainerTransactionCallback callback) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
|
|||||||
if (t == null) {
|
if (t == null) {
|
||||||
throw new IllegalArgumentException("Null transaction passed to applySyncTransaction");
|
throw new IllegalArgumentException("Null transaction passed to applySyncTransaction");
|
||||||
}
|
}
|
||||||
enforceTaskPermission("applySyncTransaction()", t);
|
enforceTaskPermission("applySyncTransaction()");
|
||||||
final CallerInfo caller = new CallerInfo();
|
final CallerInfo caller = new CallerInfo();
|
||||||
final long ident = Binder.clearCallingIdentity();
|
final long ident = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ import android.window.TaskFragmentOrganizer;
|
|||||||
import android.window.TaskFragmentOrganizerToken;
|
import android.window.TaskFragmentOrganizerToken;
|
||||||
import android.window.WindowContainerToken;
|
import android.window.WindowContainerToken;
|
||||||
import android.window.WindowContainerTransaction;
|
import android.window.WindowContainerTransaction;
|
||||||
import android.window.WindowContainerTransactionCallback;
|
|
||||||
|
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
|
|
||||||
@@ -335,19 +334,6 @@ public class TaskFragmentOrganizerControllerTest extends WindowTestsBase {
|
|||||||
assertNull(mController.getRemoteAnimationDefinition(mIOrganizer, TASK_ID));
|
assertNull(mController.getRemoteAnimationDefinition(mIOrganizer, TASK_ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testWindowContainerTransaction_setTaskFragmentOrganizer() {
|
|
||||||
mOrganizer.applyTransaction(mTransaction);
|
|
||||||
|
|
||||||
assertEquals(mIOrganizer, mTransaction.getTaskFragmentOrganizer());
|
|
||||||
|
|
||||||
mTransaction = new WindowContainerTransaction();
|
|
||||||
mOrganizer.applySyncTransaction(
|
|
||||||
mTransaction, mock(WindowContainerTransactionCallback.class));
|
|
||||||
|
|
||||||
assertEquals(mIOrganizer, mTransaction.getTaskFragmentOrganizer());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testApplyTransaction_enforceConfigurationChangeOnOrganizedTaskFragment()
|
public void testApplyTransaction_enforceConfigurationChangeOnOrganizedTaskFragment()
|
||||||
throws RemoteException {
|
throws RemoteException {
|
||||||
|
|||||||
Reference in New Issue
Block a user