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

Commit 881f464f authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/27140479',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/27140479', 'googleplex-android-review.googlesource.com/27053555', 'googleplex-android-review.googlesource.com/27250425', 'googleplex-android-review.googlesource.com/27094197', 'googleplex-android-review.googlesource.com/27431144', 'googleplex-android-review.googlesource.com/27263999', 'googleplex-android-review.googlesource.com/27801400'] into 24Q2-release.

Change-Id: Ibeca3b997ee82d1d30cd8872a3ff99b405c8a93d
parents 4d553c25 eab1808d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ class AppOpInfo {

    /**
     * This specifies whether each option is only allowed to be read
     * by apps with manage appops permission.
     * by apps with privileged appops permission.
     */
    public final boolean restrictRead;

+1 −1
Original line number Diff line number Diff line
@@ -3268,7 +3268,7 @@ public class AppOpsManager {
    }

    /**
     * Retrieve whether the op can be read by apps with manage appops permission.
     * Retrieve whether the op can be read by apps with privileged appops permission.
     * @hide
     */
    public static boolean opRestrictsRead(int op) {
+50 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import static android.util.XmlTest.doVerifyRead;
import static android.util.XmlTest.doVerifyWrite;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.fail;
import static org.xmlpull.v1.XmlPullParser.START_TAG;

import android.os.PersistableBundle;
@@ -41,12 +43,15 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;

@RunWith(AndroidJUnit4.class)
public class BinaryXmlTest {
    private static final int MAX_UNSIGNED_SHORT = 65_535;

    /**
     * Verify that we can write and read large numbers of interned
     * {@link String} values.
@@ -170,4 +175,49 @@ public class BinaryXmlTest {
            }
        }
    }

    @Test
    public void testAttributeBytes_BinaryDataOverflow() throws Exception {
        final TypedXmlSerializer out = Xml.newBinarySerializer();
        final ByteArrayOutputStream os = new ByteArrayOutputStream();
        out.setOutput(os, StandardCharsets.UTF_8.name());

        final byte[] testBytes = new byte[MAX_UNSIGNED_SHORT + 1];
        assertThrows(IOException.class,
                () -> out.attributeBytesHex(/* namespace */ null, /* name */ "attributeBytesHex",
                        testBytes));

        assertThrows(IOException.class,
                () -> out.attributeBytesBase64(/* namespace */ null, /* name */
                        "attributeBytesBase64", testBytes));
    }

    @Test
    public void testAttributeBytesHex_MaximumBinaryData() throws Exception {
        final TypedXmlSerializer out = Xml.newBinarySerializer();
        final ByteArrayOutputStream os = new ByteArrayOutputStream();
        out.setOutput(os, StandardCharsets.UTF_8.name());

        final byte[] testBytes = new byte[MAX_UNSIGNED_SHORT];
        try {
            out.attributeBytesHex(/* namespace */ null, /* name */ "attributeBytesHex", testBytes);
        } catch (Exception e) {
            fail("testAttributeBytesHex fails with exception: " + e.toString());
        }
    }

    @Test
    public void testAttributeBytesBase64_MaximumBinaryData() throws Exception {
        final TypedXmlSerializer out = Xml.newBinarySerializer();
        final ByteArrayOutputStream os = new ByteArrayOutputStream();
        out.setOutput(os, StandardCharsets.UTF_8.name());

        final byte[] testBytes = new byte[MAX_UNSIGNED_SHORT];
        try {
            out.attributeBytesBase64(/* namespace */ null, /* name */ "attributeBytesBase64",
                    testBytes);
        } catch (Exception e) {
            fail("testAttributeBytesBase64 fails with exception: " + e.toString());
        }
    }
}
+12 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import com.android.systemui.common.shared.model.Icon
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.globalactions.GlobalActionsDialogLite
import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.plugins.FalsingManager
import com.android.systemui.qs.dagger.QSFlagsModule.PM_LITE_ENABLED
import com.android.systemui.qs.footer.data.model.UserSwitcherStatusModel
@@ -109,6 +110,7 @@ class FooterActionsViewModel(
        private val falsingManager: FalsingManager,
        private val footerActionsInteractor: FooterActionsInteractor,
        private val globalActionsDialogLiteProvider: Provider<GlobalActionsDialogLite>,
        private val activityStarter: ActivityStarter,
        @Named(PM_LITE_ENABLED) private val showPowerButton: Boolean,
    ) {
        /** Create a [FooterActionsViewModel] bound to the lifecycle of [lifecycleOwner]. */
@@ -134,6 +136,7 @@ class FooterActionsViewModel(
                footerActionsInteractor,
                falsingManager,
                globalActionsDialogLite,
                activityStarter,
                showPowerButton,
            )
        }
@@ -145,6 +148,7 @@ fun FooterActionsViewModel(
    footerActionsInteractor: FooterActionsInteractor,
    falsingManager: FalsingManager,
    globalActionsDialogLite: GlobalActionsDialogLite,
    activityStarter: ActivityStarter,
    showPowerButton: Boolean,
): FooterActionsViewModel {
    suspend fun observeDeviceMonitoringDialogRequests(quickSettingsContext: Context) {
@@ -169,7 +173,14 @@ fun FooterActionsViewModel(
            return
        }

        activityStarter.dismissKeyguardThenExecute(
            {
                footerActionsInteractor.showForegroundServicesDialog(expandable)
                false /* if the dismiss should be deferred */
            },
            null /* cancelAction */,
            true /* afterKeyguardGone */
        )
    }

    fun onUserSwitcherClicked(expandable: Expandable) {
+50 −2
Original line number Diff line number Diff line
@@ -27,5 +27,53 @@ val Kosmos.instanceIdSequenceFake: InstanceIdSequenceFake by
val Kosmos.qsEventLogger: QsEventLoggerFake by
    Kosmos.Fixture { QsEventLoggerFake(uiEventLoggerFake, instanceIdSequenceFake) }

var Kosmos.newQSTileFactory by Kosmos.Fixture<NewQSTileFactory>()
var Kosmos.qsTileFactory by Kosmos.Fixture<QSFactory>()
var Kosmos.qsTileFactory by Fixture<QSFactory>()

val Kosmos.fgsManagerController by Fixture { FakeFgsManagerController() }

val Kosmos.footerActionsController by Fixture {
    FooterActionsController(
        fgsManagerController = fgsManagerController,
    )
}

val Kosmos.qsSecurityFooterUtils by Fixture {
    QSSecurityFooterUtils(
        applicationContext,
        devicePolicyManager,
        userTracker,
        fakeExecutorHandler,
        activityStarter,
        securityController,
        looper,
        dialogTransitionAnimator,
    )
}

val Kosmos.footerActionsInteractor by Fixture {
    FooterActionsInteractorImpl(
        activityStarter = activityStarter,
        metricsLogger = metricsLogger,
        uiEventLogger = uiEventLogger,
        deviceProvisionedController = deviceProvisionedController,
        qsSecurityFooterUtils = qsSecurityFooterUtils,
        fgsManagerController = fgsManagerController,
        userSwitcherInteractor = userSwitcherInteractor,
        securityRepository = securityRepository,
        foregroundServicesRepository = foregroundServicesRepository,
        userSwitcherRepository = userSwitcherRepository,
        broadcastDispatcher = broadcastDispatcher,
        bgDispatcher = testDispatcher,
    )
}

val Kosmos.footerActionsViewModelFactory by Fixture {
    FooterActionsViewModel.Factory(
        context = applicationContext,
        falsingManager = falsingManager,
        footerActionsInteractor = footerActionsInteractor,
        globalActionsDialogLiteProvider = { mock() },
        activityStarter,
        showPowerButton = true,
    )
}
Loading