Merge "Don't allow activites on virtual displays" into rvc-dev am: b79905f0af
Change-Id: If2a20d4c050bae15b451a4900125e8fae989492e
This commit is contained in:
@@ -1092,8 +1092,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
|
||||
final boolean uidPresentOnDisplay = displayContent.isUidPresent(callingUid);
|
||||
|
||||
final int displayOwnerUid = displayContent.mDisplay.getOwnerUid();
|
||||
if (displayContent.mDisplay.getType() == TYPE_VIRTUAL && displayOwnerUid != SYSTEM_UID
|
||||
&& displayOwnerUid != aInfo.applicationInfo.uid) {
|
||||
if (displayContent.mDisplay.getType() == TYPE_VIRTUAL && displayOwnerUid != SYSTEM_UID) {
|
||||
// Limit launching on virtual displays, because their contents can be read from Surface
|
||||
// by apps that created them.
|
||||
if ((aInfo.flags & ActivityInfo.FLAG_ALLOW_EMBEDDED) == 0) {
|
||||
|
||||
@@ -25,6 +25,7 @@ android_test {
|
||||
"testables",
|
||||
"ub-uiautomator",
|
||||
"hamcrest-library",
|
||||
"compatibility-device-util-axt",
|
||||
],
|
||||
|
||||
libs: [
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<activity android:name="com.android.server.wm.TaskStackChangedListenerTest$ActivityInActivityView"
|
||||
android:resizeableActivity="true" />
|
||||
<activity android:name="com.android.server.wm.ScreenDecorWindowTests$TestActivity"
|
||||
android:showWhenLocked="true" />
|
||||
android:showWhenLocked="true" android:allowEmbedded="true"/>
|
||||
</application>
|
||||
|
||||
<instrumentation
|
||||
|
||||
@@ -64,6 +64,8 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.test.filters.SmallTest;
|
||||
|
||||
import com.android.compatibility.common.util.SystemUtil;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -343,7 +345,10 @@ public class ScreenDecorWindowTests {
|
||||
intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
|
||||
final ActivityOptions options = ActivityOptions.makeBasic();
|
||||
options.setLaunchDisplayId(displayId);
|
||||
final Activity activity = mInstrumentation.startActivitySync(intent, options.toBundle());
|
||||
|
||||
final Activity activity = SystemUtil.runWithShellPermissionIdentity(
|
||||
() -> mInstrumentation.startActivitySync(intent, options.toBundle()),
|
||||
"android.permission.ACTIVITY_EMBEDDING");
|
||||
waitForIdle();
|
||||
|
||||
assertEquals(displayId, activity.getDisplayId());
|
||||
|
||||
Reference in New Issue
Block a user