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

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

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

Merge cherrypicks of ['googleplex-android-review.googlesource.com/26635185', 'googleplex-android-review.googlesource.com/26635186', 'googleplex-android-review.googlesource.com/26681729', 'googleplex-android-review.googlesource.com/26685062', 'googleplex-android-review.googlesource.com/26709389', 'googleplex-android-review.googlesource.com/26735320'] into 24Q2-release.

Change-Id: I3992eb9dc9d0345063f4833f8190c6d56c2dc46e
parents de00f0c7 7ed9aea8
Loading
Loading
Loading
Loading
+24 −25
Original line number Diff line number Diff line
@@ -229,7 +229,8 @@ public class EmphasizedNotificationButton extends Button {
                    + "gluedLayoutDirection = " + mGluedLayoutDirection);
        }

        if (layoutDirection != mGluedLayoutDirection) {
        final boolean alreadyGlued = mGluedLayoutDirection != LAYOUT_DIRECTION_UNDEFINED;
        if (alreadyGlued && layoutDirection != mGluedLayoutDirection) {
            if (DEBUG_NEW_ACTION_LAYOUT) {
                Log.d(TAG, "onRtlPropertiesChanged: layout direction changed; regluing");
            }
@@ -249,14 +250,6 @@ public class EmphasizedNotificationButton extends Button {
            return;
        }

        if (mIconToGlue == null && mLabelToGlue == null) {
            if (DEBUG_NEW_ACTION_LAYOUT) {
                Log.v(TAG, "glueIconAndLabelIfNeeded: no icon or label to glue; doing nothing");
            }
            mGluePending = false;
            return;
        }

        if (!evenlyDividedCallStyleActionLayout()) {
            Log.e(TAG, "glueIconAndLabelIfNeeded: new action layout disabled; doing nothing");
            return;
@@ -272,22 +265,6 @@ public class EmphasizedNotificationButton extends Button {
            return;
        }

        // Ready to glue but don't have an icon *and* a label:
        //
        // (Note that this will *not* happen while the button is being initialized, since we won't
        // be ready to glue. This can only happen if the button is initialized and displayed and
        // *then* someone calls glueIcon or glueLabel.

        if (mIconToGlue == null) {
            Log.w(TAG, "glueIconAndLabelIfNeeded: label glued without icon; doing nothing");
            return;
        }

        if (mLabelToGlue == null) {
            Log.w(TAG, "glueIconAndLabelIfNeeded: icon glued without label; doing nothing");
            return;
        }

        // Can't glue:

        final int layoutDirection = getLayoutDirection();
@@ -318,6 +295,28 @@ public class EmphasizedNotificationButton extends Button {
    private static final String POP_DIRECTIONAL_ISOLATE = "\u2069";

    private void glueIconAndLabel(int layoutDirection) {
        if (mIconToGlue == null && mLabelToGlue == null) {
            if (DEBUG_NEW_ACTION_LAYOUT) {
                Log.d(TAG, "glueIconAndLabel: null icon and label, setting text to empty string");
            }
            setText("");
            return;
        } else if (mIconToGlue == null) {
            if (DEBUG_NEW_ACTION_LAYOUT) {
                Log.d(TAG, "glueIconAndLabel: null icon, setting text to label");
            }
            setText(mLabelToGlue);
            return;
        } else if (mLabelToGlue == null) {
            if (DEBUG_NEW_ACTION_LAYOUT) {
                Log.d(TAG, "glueIconAndLabel: null label, setting text to ImageSpan with icon");
            }
            final SpannableStringBuilder builder = new SpannableStringBuilder();
            appendSpan(builder, IMAGE_SPAN_TEXT, new ImageSpan(mIconToGlue, ALIGN_CENTER));
            setText(builder);
            return;
        }

        final boolean rtlLayout = layoutDirection == LAYOUT_DIRECTION_RTL;

        if (DEBUG_NEW_ACTION_LAYOUT) {
+1 −0
Original line number Diff line number Diff line
@@ -454,6 +454,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
                        setTopMargin(0);
                        if (grandParent != null) grandParent.setClipChildren(true);
                        setVisibility(GONE);
                        setAlpha(1f);
                        if (mWrapper != null) {
                            mWrapper.setRemoteInputVisible(false);
                        }
+30 −1
Original line number Diff line number Diff line
@@ -67,11 +67,11 @@ import androidx.test.filters.SmallTest;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.logging.testing.UiEventLoggerFake;
import com.android.systemui.Dependency;
import com.android.systemui.res.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.animation.AnimatorTestRule;
import com.android.systemui.flags.FakeFeatureFlags;
import com.android.systemui.flags.Flags;
import com.android.systemui.res.R;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.RemoteInputController;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -449,6 +449,35 @@ public class RemoteInputViewTest extends SysuiTestCase {
        assertEquals(1f, fadeInView.getAlpha());
    }

    @Test
    public void testUnanimatedFocusAfterDefocusAnimation() throws Exception {
        mFeatureFlags.set(Flags.NOTIFICATION_INLINE_REPLY_ANIMATION, true);
        NotificationTestHelper helper = new NotificationTestHelper(
                mContext,
                mDependency,
                TestableLooper.get(this));
        ExpandableNotificationRow row = helper.createRow();
        RemoteInputView view = RemoteInputView.inflate(mContext, null, row.getEntry(), mController);
        bindController(view, row.getEntry());

        FrameLayout parent = new FrameLayout(mContext);
        parent.addView(view);

        // Play defocus animation
        view.onDefocus(true /* animate */, false /* logClose */, null /* doAfterDefocus */);
        mAnimatorTestRule.advanceTimeBy(ANIMATION_DURATION_STANDARD);

        // assert that RemoteInputView is no longer visible, but alpha is reset to 1f
        assertEquals(View.GONE, view.getVisibility());
        assertEquals(1f, view.getAlpha());

        // focus RemoteInputView without an animation
        view.focus();
        // assert that RemoteInputView is visible, and alpha is 1f
        assertEquals(View.VISIBLE, view.getVisibility());
        assertEquals(1f, view.getAlpha());
    }

    // NOTE: because we're refactoring the RemoteInputView and moving logic into the
    // RemoteInputViewController, it's easiest to just test the system of the two classes together.
    @NonNull
+5 −1
Original line number Diff line number Diff line
@@ -1091,7 +1091,11 @@ public class DisplayModeDirector {
                maxRefreshRate = Math.min(defaultRefreshRate, peakRefreshRate);
            }

            mBrightnessObserver.onRefreshRateSettingChangedLocked(minRefreshRate, maxRefreshRate);
            // TODO(b/310237068): Make this work for multiple displays
            if (displayId == Display.DEFAULT_DISPLAY) {
                mBrightnessObserver.onRefreshRateSettingChangedLocked(minRefreshRate,
                        maxRefreshRate);
            }
        }

        private void removeRefreshRateSetting(int displayId) {
+4 −9
Original line number Diff line number Diff line
@@ -596,7 +596,7 @@ public class PackageInfoUtils {
        ai.requiredDisplayCategory = a.getRequiredDisplayCategory();
        ai.requireContentUriPermissionFromCaller = a.getRequireContentUriPermissionFromCaller();
        ai.setKnownActivityEmbeddingCerts(a.getKnownActivityEmbeddingCerts());
        assignFieldsComponentInfoParsedMainComponent(ai, a, pkgSetting, state, userId);
        assignFieldsComponentInfoParsedMainComponent(ai, a, pkgSetting, userId);
        return ai;
    }

@@ -659,7 +659,7 @@ public class PackageInfoUtils {
            // Backwards compatibility, coerce to null if empty
            si.metaData = metaData.isEmpty() ? null : metaData;
        }
        assignFieldsComponentInfoParsedMainComponent(si, s, pkgSetting, state, userId);
        assignFieldsComponentInfoParsedMainComponent(si, s, pkgSetting, userId);
        return si;
    }

@@ -710,7 +710,7 @@ public class PackageInfoUtils {
            pi.metaData = metaData.isEmpty() ? null : metaData;
        }
        pi.applicationInfo = applicationInfo;
        assignFieldsComponentInfoParsedMainComponent(pi, p, pkgSetting, state, userId);
        assignFieldsComponentInfoParsedMainComponent(pi, p, pkgSetting, userId);
        return pi;
    }

@@ -903,13 +903,8 @@ public class PackageInfoUtils {

    private static void assignFieldsComponentInfoParsedMainComponent(
            @NonNull ComponentInfo info, @NonNull ParsedMainComponent component,
            @NonNull PackageStateInternal pkgSetting, @NonNull PackageUserStateInternal state,
            @UserIdInt int userId) {
            @NonNull PackageStateInternal pkgSetting, @UserIdInt int userId) {
        assignFieldsComponentInfoParsedMainComponent(info, component);
        // overwrite the enabled state with the current user state
        info.enabled = PackageUserStateUtils.isEnabled(state, info.applicationInfo.enabled,
                info.enabled, info.name, /* flags */ 0);

        Pair<CharSequence, Integer> labelAndIcon =
                ParsedComponentStateUtils.getNonLocalizedLabelAndIcon(component, pkgSetting,
                        userId);
Loading