summaryrefslogtreecommitdiff
path: root/services/core/java/com/android/server/wm/TaskFragment.java
diff options
context:
space:
mode:
Diffstat (limited to 'services/core/java/com/android/server/wm/TaskFragment.java')
-rw-r--r--services/core/java/com/android/server/wm/TaskFragment.java67
1 files changed, 10 insertions, 57 deletions
diff --git a/services/core/java/com/android/server/wm/TaskFragment.java b/services/core/java/com/android/server/wm/TaskFragment.java
index 1b0c01816f73..1d328671876f 100644
--- a/services/core/java/com/android/server/wm/TaskFragment.java
+++ b/services/core/java/com/android/server/wm/TaskFragment.java
@@ -140,45 +140,6 @@ class TaskFragment extends WindowContainer<WindowContainer> {
static final boolean SHOW_APP_STARTING_PREVIEW = true;
/**
- * An embedding check result of {@link #isAllowedToEmbedActivity(ActivityRecord)} or
- * {@link ActivityStarter#canEmbedActivity(TaskFragment, ActivityRecord, Task)}:
- * indicate that an Activity can be embedded successfully.
- */
- static final int EMBEDDING_ALLOWED = 0;
- /**
- * An embedding check result of {@link #isAllowedToEmbedActivity(ActivityRecord)} or
- * {@link ActivityStarter#canEmbedActivity(TaskFragment, ActivityRecord, Task)}:
- * indicate that an Activity can't be embedded because either the Activity does not allow
- * untrusted embedding, and the embedding host app is not trusted.
- */
- static final int EMBEDDING_DISALLOWED_UNTRUSTED_HOST = 1;
- /**
- * An embedding check result of {@link #isAllowedToEmbedActivity(ActivityRecord)} or
- * {@link ActivityStarter#canEmbedActivity(TaskFragment, ActivityRecord, Task)}:
- * indicate that an Activity can't be embedded because this taskFragment's bounds are
- * {@link #smallerThanMinDimension(ActivityRecord)}.
- */
- static final int EMBEDDING_DISALLOWED_MIN_DIMENSION_VIOLATION = 2;
- /**
- * An embedding check result of
- * {@link ActivityStarter#canEmbedActivity(TaskFragment, ActivityRecord, Task)}:
- * indicate that an Activity can't be embedded because the Activity is started on a new task.
- */
- static final int EMBEDDING_DISALLOWED_NEW_TASK = 3;
-
- /**
- * Embedding check results of {@link #isAllowedToEmbedActivity(ActivityRecord)} or
- * {@link ActivityStarter#canEmbedActivity(TaskFragment, ActivityRecord, Task)}.
- */
- @IntDef(prefix = {"EMBEDDING_"}, value = {
- EMBEDDING_ALLOWED,
- EMBEDDING_DISALLOWED_UNTRUSTED_HOST,
- EMBEDDING_DISALLOWED_MIN_DIMENSION_VIOLATION,
- EMBEDDING_DISALLOWED_NEW_TASK,
- })
- @interface EmbeddingCheckResult {}
-
- /**
* Indicate that the minimal width/height should use the default value.
*
* @see #mMinWidth
@@ -559,29 +520,20 @@ class TaskFragment extends WindowContainer<WindowContainer> {
return false;
}
- @EmbeddingCheckResult
- int isAllowedToEmbedActivity(@NonNull ActivityRecord a) {
+ boolean isAllowedToEmbedActivity(@NonNull ActivityRecord a) {
return isAllowedToEmbedActivity(a, mTaskFragmentOrganizerUid);
}
/**
* Checks if the organized task fragment is allowed to have the specified activity, which is
- * allowed if an activity allows embedding in untrusted mode, if the trusted mode can be
- * enabled, or if the organized task fragment bounds are not
- * {@link #smallerThanMinDimension(ActivityRecord)}.
- *
- * @param uid uid of the TaskFragment organizer.
+ * allowed if an activity allows embedding in untrusted mode, or if the trusted mode can be
+ * enabled.
* @see #isAllowedToEmbedActivityInTrustedMode(ActivityRecord)
+ * @param uid uid of the TaskFragment organizer.
*/
- @EmbeddingCheckResult
- int isAllowedToEmbedActivity(@NonNull ActivityRecord a, int uid) {
- if (!isAllowedToEmbedActivityInUntrustedMode(a)
- && !isAllowedToEmbedActivityInTrustedMode(a, uid)) {
- return EMBEDDING_DISALLOWED_UNTRUSTED_HOST;
- } else if (smallerThanMinDimension(a)) {
- return EMBEDDING_DISALLOWED_MIN_DIMENSION_VIOLATION;
- }
- return EMBEDDING_ALLOWED;
+ boolean isAllowedToEmbedActivity(@NonNull ActivityRecord a, int uid) {
+ return isAllowedToEmbedActivityInUntrustedMode(a)
+ || isAllowedToEmbedActivityInTrustedMode(a, uid);
}
boolean smallerThanMinDimension(@NonNull ActivityRecord activity) {
@@ -598,8 +550,9 @@ class TaskFragment extends WindowContainer<WindowContainer> {
}
final int minWidth = minDimensions.x;
final int minHeight = minDimensions.y;
- return taskFragBounds.width() < minWidth
+ final boolean smaller = taskFragBounds.width() < minWidth
|| taskFragBounds.height() < minHeight;
+ return smaller;
}
/**
@@ -656,7 +609,7 @@ class TaskFragment extends WindowContainer<WindowContainer> {
// The system is trusted to embed other apps securely and for all users.
return UserHandle.getAppId(uid) == SYSTEM_UID
// Activities from the same UID can be embedded freely by the host.
- || a.isUid(uid);
+ || uid == a.getUid();
}
/**