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

Commit 56a279b4 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

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

Merge cherrypicks of ['googleplex-android-review.googlesource.com/29854424', 'googleplex-android-review.googlesource.com/29901367', 'googleplex-android-review.googlesource.com/29932247'] into 24Q4-release.

Change-Id: I869e29861ed11dec32337589d50d1abc63126f57
parents a1c57064 810d2b8d
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -58,22 +58,22 @@
             android:layout_height="match_parent"
             android:visibility="invisible" />

    <!-- Shared container for the notification stack. Can be positioned by either
         the keyguard_root_view or notification_panel -->
    <com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer
        android:id="@+id/shared_notification_container"
    <!-- Root for all keyguard content. It was previously located within the shade. -->
    <com.android.systemui.keyguard.ui.view.KeyguardRootView
        android:id="@id/keyguard_root_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipChildren="false"
        android:clipToPadding="false"
        />

    <!-- Root for all keyguard content. It was previously located within the shade. -->
    <com.android.systemui.keyguard.ui.view.KeyguardRootView
        android:id="@id/keyguard_root_view"
    <!-- Shared container for the notification stack. Can be positioned by either
         the keyguard_root_view or notification_panel -->
    <com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer
        android:id="@+id/shared_notification_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipChildren="false"
        android:clipToPadding="false"
        />

    <include layout="@layout/brightness_mirror_container" />
+20 −13
Original line number Diff line number Diff line
@@ -427,6 +427,11 @@ final class UiModeManagerService extends SystemService {
        mDreamsDisabledByAmbientModeSuppression = disabledByAmbientModeSuppression;
    }

    @VisibleForTesting
    void setCurrentUser(int currentUserId) {
        mCurrentUser = currentUserId;
    }

    @Override
    public void onUserSwitching(@Nullable TargetUser from, @NonNull TargetUser to) {
        mCurrentUser = to.getUserIdentifier();
@@ -848,9 +853,9 @@ final class UiModeManagerService extends SystemService {
                    throw new IllegalArgumentException("Unknown mode: " + mode);
            }

            final int user = UserHandle.getCallingUserId();
            enforceCurrentUserIfVisibleBackgroundEnabled(user);
            enforceCurrentUserIfVisibleBackgroundEnabled(mCurrentUser);

            final int user = UserHandle.getCallingUserId();
            final long ident = Binder.clearCallingIdentity();
            try {
                synchronized (mLock) {
@@ -913,7 +918,7 @@ final class UiModeManagerService extends SystemService {
                @AttentionModeThemeOverlayType int attentionModeThemeOverlayType) {
            setAttentionModeThemeOverlay_enforcePermission();

            enforceCurrentUserIfVisibleBackgroundEnabled(UserHandle.getCallingUserId());
            enforceCurrentUserIfVisibleBackgroundEnabled(mCurrentUser);

            synchronized (mLock) {
                if (mAttentionModeThemeOverlay != attentionModeThemeOverlayType) {
@@ -1004,16 +1009,16 @@ final class UiModeManagerService extends SystemService {
                return false;
            }
            final int user = Binder.getCallingUserHandle().getIdentifier();
            enforceCurrentUserIfVisibleBackgroundEnabled(user);

            if (user != mCurrentUser && getContext().checkCallingOrSelfPermission(
                    android.Manifest.permission.INTERACT_ACROSS_USERS)
                    != PackageManager.PERMISSION_GRANTED) {
                Slog.e(TAG, "Target user is not current user,"
                        + " INTERACT_ACROSS_USERS permission is required");
                return false;

            }

            enforceCurrentUserIfVisibleBackgroundEnabled(mCurrentUser);

            // Store the last requested bedtime night mode state so that we don't need to notify
            // anyone if the user decides to switch to the night mode to bedtime.
            if (modeCustomType == MODE_NIGHT_CUSTOM_TYPE_BEDTIME) {
@@ -1062,9 +1067,10 @@ final class UiModeManagerService extends SystemService {
                Slog.e(TAG, "Set custom time start, requires MODIFY_DAY_NIGHT_MODE permission");
                return;
            }
            final int user = UserHandle.getCallingUserId();
            enforceCurrentUserIfVisibleBackgroundEnabled(user);

            enforceCurrentUserIfVisibleBackgroundEnabled(mCurrentUser);

            final int user = UserHandle.getCallingUserId();
            final long ident = Binder.clearCallingIdentity();
            try {
                LocalTime newTime = LocalTime.ofNanoOfDay(time * 1000);
@@ -1092,9 +1098,10 @@ final class UiModeManagerService extends SystemService {
                Slog.e(TAG, "Set custom time end, requires MODIFY_DAY_NIGHT_MODE permission");
                return;
            }
            final int user = UserHandle.getCallingUserId();
            enforceCurrentUserIfVisibleBackgroundEnabled(user);

            enforceCurrentUserIfVisibleBackgroundEnabled(mCurrentUser);

            final int user = UserHandle.getCallingUserId();
            final long ident = Binder.clearCallingIdentity();
            try {
                LocalTime newTime = LocalTime.ofNanoOfDay(time * 1000);
@@ -1115,7 +1122,7 @@ final class UiModeManagerService extends SystemService {
            assertLegit(callingPackage);
            assertSingleProjectionType(projectionType);
            enforceProjectionTypePermissions(projectionType);
            enforceCurrentUserIfVisibleBackgroundEnabled(getCallingUserId());
            enforceCurrentUserIfVisibleBackgroundEnabled(mCurrentUser);

            synchronized (mLock) {
                if (mProjectionHolders == null) {
@@ -1161,7 +1168,7 @@ final class UiModeManagerService extends SystemService {
            assertLegit(callingPackage);
            assertSingleProjectionType(projectionType);
            enforceProjectionTypePermissions(projectionType);
            enforceCurrentUserIfVisibleBackgroundEnabled(getCallingUserId());
            enforceCurrentUserIfVisibleBackgroundEnabled(mCurrentUser);

            return releaseProjectionUnchecked(projectionType, callingPackage);
        }
@@ -1203,7 +1210,7 @@ final class UiModeManagerService extends SystemService {
                return;
            }

            enforceCurrentUserIfVisibleBackgroundEnabled(getCallingUserId());
            enforceCurrentUserIfVisibleBackgroundEnabled(mCurrentUser);

            synchronized (mLock) {
                if (mProjectionListeners == null) {
+2 −1
Original line number Diff line number Diff line
@@ -400,7 +400,7 @@ class InsetsSourceProvider {
        }
        final Point position = getWindowFrameSurfacePosition();
        if (!mPosition.equals(position)) {
            mPosition.set(position.x, position.y);
            mPosition.set(position);
            if (windowState != null && windowState.getWindowFrames().didFrameSizeChange()
                    && windowState.mWinAnimator.getShown() && mWindowContainer.okToDisplay()) {
                windowState.applyWithNextDraw(mSetControlPositionConsumer);
@@ -543,6 +543,7 @@ class InsetsSourceProvider {
        }
        boolean initiallyVisible = mClientVisible;
        final Point surfacePosition = getWindowFrameSurfacePosition();
        mPosition.set(surfacePosition);
        mAdapter = new ControlAdapter(surfacePosition);
        if (mSource.getType() == WindowInsets.Type.ime()) {
            if (android.view.inputmethod.Flags.refactorInsetsController()) {
+3 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ import static org.testng.Assert.assertThrows;

import android.Manifest;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.AlarmManager;
import android.app.Flags;
import android.app.IOnProjectionStateChangedListener;
@@ -247,6 +248,8 @@ public class UiModeManagerServiceTest extends UiServiceTestCase {
        mInjector = spy(new TestInjector());
        mUiManagerService = new UiModeManagerService(mContext, /* setupWizardComplete= */ true,
                mTwilightManager, mInjector);
        // Initialize the current user.
        mUiManagerService.setCurrentUser(ActivityManager.getCurrentUser());
        try {
            mUiManagerService.onBootPhase(SystemService.PHASE_SYSTEM_SERVICES_READY);
        } catch (SecurityException e) {/* ignore for permission denial */}
+22 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import android.graphics.Insets;
import android.graphics.Point;
import android.graphics.Rect;
import android.platform.test.annotations.Presubmit;
import android.view.InsetsSource;
@@ -259,6 +260,27 @@ public class InsetsSourceProviderTest extends WindowTestsBase {
        assertEquals(Insets.of(0, 0, 0, 100), insets);
    }

    @Test
    public void testUpdateInsetsControlPosition() {
        final WindowState target = createWindow(null, TYPE_APPLICATION, "target");

        final WindowState ime1 = createWindow(null, TYPE_INPUT_METHOD, "ime1");
        ime1.getFrame().set(new Rect(0, 0, 0, 0));
        mImeProvider.setWindowContainer(ime1, null, null);
        mImeProvider.updateControlForTarget(target, false /* force */, null /* statsToken */);
        ime1.getFrame().set(new Rect(0, 400, 500, 500));
        mImeProvider.updateInsetsControlPosition(ime1);
        assertEquals(new Point(0, 400), mImeProvider.getControl(target).getSurfacePosition());

        final WindowState ime2 = createWindow(null, TYPE_INPUT_METHOD, "ime2");
        ime2.getFrame().set(new Rect(0, 0, 0, 0));
        mImeProvider.setWindowContainer(ime2, null, null);
        mImeProvider.updateControlForTarget(target, false /* force */, null /* statsToken */);
        ime2.getFrame().set(new Rect(0, 400, 500, 500));
        mImeProvider.updateInsetsControlPosition(ime2);
        assertEquals(new Point(0, 400), mImeProvider.getControl(target).getSurfacePosition());
    }

    @Test
    public void testSetRequestedVisibleTypes() {
        final WindowState statusBar = createWindow(null, TYPE_APPLICATION, "statusBar");