Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73efbf23 authored by Eric Lin's avatar Eric Lin Committed by Android (Google) Code Review
Browse files

Merge "Cleanup support_widget_intents_on_connected_display flag." into main

parents 5726b764 d119916d
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -254,8 +254,8 @@ import com.android.internal.util.FastPrintWriter;
import com.android.internal.util.Preconditions;
import com.android.internal.util.function.pooled.PooledLambda;
import com.android.org.conscrypt.TrustedCertificateStore;
import com.android.server.am.MemInfoDumpProto;
import com.android.server.am.BitmapDumpProto;
import com.android.server.am.MemInfoDumpProto;

import dalvik.annotation.optimization.NeverCompile;
import dalvik.system.AppSpecializationHooks;
@@ -881,11 +881,7 @@ public final class ActivityThread extends ClientTransactionHandler
                    assumeDelivered, token, sendingUser, intent.getFlags(), sendingUid,
                    sendingPackage);
            this.intent = intent;
            if (com.android.window.flags.Flags.supportWidgetIntentsOnConnectedDisplay()) {
            mOptions = ActivityOptions.fromBundle(resultExtras);
            } else {
                mOptions = null;
            }
        }

        @UnsupportedAppUsage
@@ -5145,10 +5141,6 @@ public final class ActivityThread extends ClientTransactionHandler
    @VisibleForTesting(visibility = PRIVATE)
    public Context createDisplayContextIfNeeded(@NonNull Context context,
            @NonNull ReceiverData data) {
        if (!com.android.window.flags.Flags.supportWidgetIntentsOnConnectedDisplay()) {
            return context;
        }

        final ActivityOptions options = data.mOptions;
        if (options == null) {
            return context;
+0 −11
Original line number Diff line number Diff line
@@ -103,17 +103,6 @@ flag {
    bug: "380132497"
}

flag {
    namespace: "windowing_sdk"
    name: "support_widget_intents_on_connected_display"
    description: "Launch widget intents on originating display"
    bug: "358368849"
    is_fixed_read_only: true
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    namespace: "windowing_sdk"
    name: "exclude_task_from_recents"
+0 −6
Original line number Diff line number Diff line
@@ -25,8 +25,6 @@ import static android.platform.test.flag.junit.SetFlagsRule.DefaultInitValueType
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.Display.INVALID_DISPLAY;

import static com.android.window.flags.Flags.FLAG_SUPPORT_WIDGET_INTENTS_ON_CONNECTED_DISPLAY;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;

@@ -1043,7 +1041,6 @@ public class ActivityThreadTest {
    }

    @Test
    @RequiresFlagsEnabled(FLAG_SUPPORT_WIDGET_INTENTS_ON_CONNECTED_DISPLAY)
    public void tesScheduleReceiver_withLaunchDisplayId_receivesDisplayContext() {
        final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
        final Display virtualDisplay = createVirtualDisplay(context, 100 /* w */, 100 /* h */);
@@ -1063,7 +1060,6 @@ public class ActivityThreadTest {
    }

    @Test
    @RequiresFlagsEnabled(FLAG_SUPPORT_WIDGET_INTENTS_ON_CONNECTED_DISPLAY)
    public void tesScheduleReceiver_withNotExistDisplayId_receivesNoneUiContext() {
        final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
        final Display virtualDisplay = createVirtualDisplay(context, 100 /* w */, 100 /* h */);
@@ -1080,7 +1076,6 @@ public class ActivityThreadTest {
    }

    @Test
    @RequiresFlagsEnabled(FLAG_SUPPORT_WIDGET_INTENTS_ON_CONNECTED_DISPLAY)
    public void tesScheduleReceiver_withInvalidDisplay_receivesNoneUiContext() {
        final Context context = mock(Context.class);
        final ActivityOptions activityOptions =
@@ -1095,7 +1090,6 @@ public class ActivityThreadTest {
    }

    @Test
    @RequiresFlagsEnabled(FLAG_SUPPORT_WIDGET_INTENTS_ON_CONNECTED_DISPLAY)
    public void tesScheduleReceiver_withoutDisplayManagerService_receivesNoneUiContext() {
        final Context context = mock(Context.class);
        when(context.getSystemService(DisplayManager.class)).thenReturn(null);
+0 −3
Original line number Diff line number Diff line
@@ -731,9 +731,6 @@ public final class PendingIntentRecord extends IIntentSender.Stub {
     */
    @Nullable
    private Bundle createSafeActivityOptionsBundle(@Nullable Bundle optionsBundle) {
        if (!com.android.window.flags.Flags.supportWidgetIntentsOnConnectedDisplay()) {
            return null;
        }
        if (optionsBundle == null) {
            return null;
        }
+6 −11
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ import static com.android.server.am.PendingIntentRecord.cancelReasonToString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -228,7 +227,7 @@ public class PendingIntentControllerTest {
    }

    @Test
    public void testSendWithBundleExtras() {
    public void testSend_withBundleExtras_passesLaunchDisplayId() {
        final PendingIntentRecord pir = createPendingIntentRecord(0);
        final ActivityOptions activityOptions = ActivityOptions.makeBasic();
        activityOptions.setLaunchDisplayId(2);
@@ -261,15 +260,11 @@ public class PendingIntentControllerTest {
                any() // broadcastAllowList
        );
        final Bundle result = resultExtrasCaptor.getValue();
        if (com.android.window.flags.Flags.supportWidgetIntentsOnConnectedDisplay()) {
        // Check that only launchDisplayId in ActivityOptions is passed via resultExtras.
        final ActivityOptions expected = ActivityOptions.makeBasic().setLaunchDisplayId(2);
        assertBundleEquals(expected.toBundle(), result);
        // Check that launchTaskId is dropped in resultExtras.
        assertNotEquals(123, ActivityOptions.fromBundle(result).getLaunchTaskId());
        } else {
            assertNull(result);
        }
    }

    private void assertBundleEquals(@NonNull Bundle expected, @NonNull Bundle observed) {