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

Commit 5eeb6c37 authored by Dan Sandler's avatar Dan Sandler
Browse files

Launch the platform easter egg in a new task.

This ensures that when PlatLogoActivity is launched on a
large-screen device, it properly takes over the full screen
(and doesn't hide the status bar for Settings!).

Bug: 243407943
Test: make RunSettingsRoboTests ROBOTEST_FILTER=FirmwareVersionDetailPreferenceControllerTest
Change-Id: Icf10aa43e5b4a27a2fa98ea41b5a9e9cf659e895
parent 198cb566
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -98,7 +98,8 @@ public class FirmwareVersionDetailPreferenceController extends BasePreferenceCon

            final Intent intent = new Intent(Intent.ACTION_MAIN)
                    .setClassName(
                            "android", com.android.internal.app.PlatLogoActivity.class.getName());
                            "android", com.android.internal.app.PlatLogoActivity.class.getName())
                    .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            try {
                mContext.startActivity(intent);
            } catch (Exception e) {
+9 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.UserManager;

@@ -33,6 +34,7 @@ import androidx.preference.Preference;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
@@ -85,7 +87,13 @@ public class FirmwareVersionDetailPreferenceControllerTest {

        mController.handlePreferenceTreeClick(mPreference);

        verify(mContext).startActivity(any());
        final ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class);
        verify(mContext).startActivity(captor.capture());
        assertThat(captor.getValue().getAction()).isEqualTo(Intent.ACTION_MAIN);
        assertThat(captor.getValue().getComponent().getPackageName()).isEqualTo("android");
        assertThat(captor.getValue().getComponent().getClassName()).isEqualTo(
                com.android.internal.app.PlatLogoActivity.class.getName());
        assertThat(captor.getValue().getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK).isGreaterThan(0);
    }

    @Test