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

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

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

Merge cherrypicks of ['googleplex-android-review.googlesource.com/22915959', 'googleplex-android-review.googlesource.com/22599577', 'googleplex-android-review.googlesource.com/23083138', 'googleplex-android-review.googlesource.com/23034056', 'googleplex-android-review.googlesource.com/23090199', 'googleplex-android-review.googlesource.com/23330385', 'googleplex-android-review.googlesource.com/23410117', 'googleplex-android-review.googlesource.com/23210299', 'googleplex-android-review.googlesource.com/23352460', 'googleplex-android-review.googlesource.com/23412216', 'googleplex-android-review.googlesource.com/23386456', 'googleplex-android-review.googlesource.com/23473144', 'googleplex-android-review.googlesource.com/23430378', 'googleplex-android-review.googlesource.com/23449211', 'googleplex-android-review.googlesource.com/23475497', 'googleplex-android-review.googlesource.com/23438365', 'googleplex-android-review.googlesource.com/23505029'] into tm-qpr3-c-release.

Change-Id: I29a0bd6bdf49fc5107563147925e30bbbc9dd9d2
parents b78ca0b3 6025acf0
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2807,6 +2807,10 @@ public class Notification implements Parcelable
     * @hide
     */
    public void visitUris(@NonNull Consumer<Uri> visitor) {
        if (publicVersion != null) {
            publicVersion.visitUris(visitor);
        }
        visitor.accept(sound);
        if (tickerView != null) tickerView.visitUris(visitor);
@@ -2892,6 +2896,8 @@ public class Notification implements Parcelable
                    }
                }
            }
            visitIconUri(visitor, extras.getParcelable(EXTRA_CONVERSATION_ICON));
        }
        if (isStyle(CallStyle.class) & extras != null) {
+2 −1
Original line number Diff line number Diff line
@@ -12402,7 +12402,8 @@ public class DevicePolicyManager {
    /**
     * Called by a device admin to set the long support message. This will be displayed to the user
     * in the device administators settings screen.
     * in the device administrators settings screen. If the message is longer than 20000 characters
     * it may be truncated.
     * <p>
     * If the long support message needs to be localized, it is the responsibility of the
     * {@link DeviceAdminReceiver} to listen to the {@link Intent#ACTION_LOCALE_CHANGED} broadcast
+19 −1
Original line number Diff line number Diff line
@@ -726,6 +726,11 @@ public class RemoteViews implements Parcelable, Filter {
                mActions.get(i).visitUris(visitor);
            }
        }
        if (mSizedRemoteViews != null) {
            for (int i = 0; i < mSizedRemoteViews.size(); i++) {
                mSizedRemoteViews.get(i).visitUris(visitor);
            }
        }
        if (mLandscape != null) {
            mLandscape.visitUris(visitor);
        }
@@ -1830,7 +1835,7 @@ public class RemoteViews implements Parcelable, Filter {
        }

        @Override
        public final void visitUris(@NonNull Consumer<Uri> visitor) {
        public void visitUris(@NonNull Consumer<Uri> visitor) {
            switch (this.type) {
                case URI:
                    final Uri uri = (Uri) getParameterValue(null);
@@ -2293,6 +2298,14 @@ public class RemoteViews implements Parcelable, Filter {
        public int getActionTag() {
            return NIGHT_MODE_REFLECTION_ACTION_TAG;
        }

        @Override
        public void visitUris(@NonNull Consumer<Uri> visitor) {
            if (this.type == ICON) {
                visitIconUri((Icon) mDarkValue, visitor);
                visitIconUri((Icon) mLightValue, visitor);
            }
        }
    }

    /**
@@ -2583,6 +2596,11 @@ public class RemoteViews implements Parcelable, Filter {
        public int getActionTag() {
            return VIEW_GROUP_ACTION_ADD_TAG;
        }

        @Override
        public final void visitUris(@NonNull Consumer<Uri> visitor) {
            mNestedViews.visitUris(visitor);
        }
    }

    /**
+77 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import java.util.concurrent.CountDownLatch;
import java.util.function.Consumer;

@@ -719,6 +720,43 @@ public class RemoteViewsTest {
        verify(visitor, times(1)).accept(eq(icon4.getUri()));
    }

    @Test
    public void visitUris_themedIcons() {
        RemoteViews views = new RemoteViews(mPackage, R.layout.remote_views_test);
        final Icon iconLight = Icon.createWithContentUri("content://light/icon");
        final Icon iconDark = Icon.createWithContentUri("content://dark/icon");
        views.setIcon(R.id.layout, "setLargeIcon", iconLight, iconDark);

        Consumer<Uri> visitor = (Consumer<Uri>) spy(Consumer.class);
        views.visitUris(visitor);
        verify(visitor, times(1)).accept(eq(iconLight.getUri()));
        verify(visitor, times(1)).accept(eq(iconDark.getUri()));
    }

    @Test
    public void visitUris_nestedViews() {
        final RemoteViews outer = new RemoteViews(mPackage, R.layout.remote_views_test);

        final RemoteViews inner = new RemoteViews(mPackage, 33);
        final Uri imageUriI = Uri.parse("content://inner/image");
        final Icon icon1 = Icon.createWithContentUri("content://inner/icon1");
        final Icon icon2 = Icon.createWithContentUri("content://inner/icon2");
        final Icon icon3 = Icon.createWithContentUri("content://inner/icon3");
        final Icon icon4 = Icon.createWithContentUri("content://inner/icon4");
        inner.setImageViewUri(R.id.image, imageUriI);
        inner.setTextViewCompoundDrawables(R.id.text, icon1, icon2, icon3, icon4);

        outer.addView(R.id.layout, inner);

        Consumer<Uri> visitor = (Consumer<Uri>) spy(Consumer.class);
        outer.visitUris(visitor);
        verify(visitor, times(1)).accept(eq(imageUriI));
        verify(visitor, times(1)).accept(eq(icon1.getUri()));
        verify(visitor, times(1)).accept(eq(icon2.getUri()));
        verify(visitor, times(1)).accept(eq(icon3.getUri()));
        verify(visitor, times(1)).accept(eq(icon4.getUri()));
    }

    @Test
    public void visitUris_separateOrientation() {
        final RemoteViews landscape = new RemoteViews(mPackage, R.layout.remote_views_test);
@@ -754,4 +792,43 @@ public class RemoteViewsTest {
        verify(visitor, times(1)).accept(eq(icon3P.getUri()));
        verify(visitor, times(1)).accept(eq(icon4P.getUri()));
    }

    @Test
    public void visitUris_sizedViews() {
        final RemoteViews large = new RemoteViews(mPackage, R.layout.remote_views_test);
        final Uri imageUriL = Uri.parse("content://large/image");
        final Icon icon1L = Icon.createWithContentUri("content://large/icon1");
        final Icon icon2L = Icon.createWithContentUri("content://large/icon2");
        final Icon icon3L = Icon.createWithContentUri("content://large/icon3");
        final Icon icon4L = Icon.createWithContentUri("content://large/icon4");
        large.setImageViewUri(R.id.image, imageUriL);
        large.setTextViewCompoundDrawables(R.id.text, icon1L, icon2L, icon3L, icon4L);

        final RemoteViews small = new RemoteViews(mPackage, 33);
        final Uri imageUriS = Uri.parse("content://small/image");
        final Icon icon1S = Icon.createWithContentUri("content://small/icon1");
        final Icon icon2S = Icon.createWithContentUri("content://small/icon2");
        final Icon icon3S = Icon.createWithContentUri("content://small/icon3");
        final Icon icon4S = Icon.createWithContentUri("content://small/icon4");
        small.setImageViewUri(R.id.image, imageUriS);
        small.setTextViewCompoundDrawables(R.id.text, icon1S, icon2S, icon3S, icon4S);

        HashMap<SizeF, RemoteViews> sizedViews = new HashMap<>();
        sizedViews.put(new SizeF(300, 300), large);
        sizedViews.put(new SizeF(100, 100), small);
        RemoteViews views = new RemoteViews(sizedViews);

        Consumer<Uri> visitor = (Consumer<Uri>) spy(Consumer.class);
        views.visitUris(visitor);
        verify(visitor, times(1)).accept(eq(imageUriL));
        verify(visitor, times(1)).accept(eq(icon1L.getUri()));
        verify(visitor, times(1)).accept(eq(icon2L.getUri()));
        verify(visitor, times(1)).accept(eq(icon3L.getUri()));
        verify(visitor, times(1)).accept(eq(icon4L.getUri()));
        verify(visitor, times(1)).accept(eq(imageUriS));
        verify(visitor, times(1)).accept(eq(icon1S.getUri()));
        verify(visitor, times(1)).accept(eq(icon2S.getUri()));
        verify(visitor, times(1)).accept(eq(icon3S.getUri()));
        verify(visitor, times(1)).accept(eq(icon4S.getUri()));
    }
}
+4 −6
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ status_t CursorWindow::maybeInflate() {

    {
        // Migrate existing contents into new ashmem region
        uint32_t slotsSize = mSize - mSlotsOffset;
        uint32_t slotsSize = sizeOfSlots();
        uint32_t newSlotsOffset = mInflatedSize - slotsSize;
        memcpy(static_cast<uint8_t*>(newData),
                static_cast<uint8_t*>(mData), mAllocOffset);
@@ -216,11 +216,9 @@ status_t CursorWindow::writeToParcel(Parcel* parcel) {
        if (parcel->writeDupFileDescriptor(mAshmemFd)) goto fail;
    } else {
        // Since we know we're going to be read-only on the remote side,
        // we can compact ourselves on the wire, with just enough padding
        // to ensure our slots stay aligned
        size_t slotsSize = mSize - mSlotsOffset;
        size_t compactedSize = mAllocOffset + slotsSize;
        compactedSize = (compactedSize + 3) & ~3;
        // we can compact ourselves on the wire.
        size_t slotsSize = sizeOfSlots();
        size_t compactedSize = sizeInUse();
        if (parcel->writeUint32(compactedSize)) goto fail;
        if (parcel->writeBool(false)) goto fail;
        void* dest = parcel->writeInplace(compactedSize);
Loading