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

Commit de67a7b3 authored by Steve McKay's avatar Steve McKay
Browse files

Only use new ClipData constructor on O devices.

Bug: 34818475
Change-Id: I6dbe776f482c362315556f555847303e7ef9f017
Test: Build with O features disable + drag/drop.
parent 91bc40e8
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ public final class DocumentClipper {
                clipTypes.toArray(new String[0]));
        description.setExtras(bundle);

        return new ClipData(description, clipItems);
        return createClipData(description, clipItems);
    }

    /**
@@ -182,7 +182,7 @@ public final class DocumentClipper {
                clipTypes.toArray(new String[0]));
        description.setExtras(bundle);

        return new ClipData(description, clipItems);
        return createClipData(description, clipItems);
    }

    /**
@@ -333,4 +333,18 @@ public final class DocumentClipper {
    private static @OpType int getOpType(PersistableBundle bundle) {
        return bundle.getInt(OP_TYPE_KEY);
    }

    private static ClipData createClipData(
            ClipDescription description, ArrayList<ClipData.Item> clipItems) {

        if (Shared.ENABLE_OMC_API_FEATURES) {
            return new ClipData(description, clipItems);
        }

        ClipData clip = new ClipData(description, clipItems.get(0));
        for (int i = 1; i < clipItems.size(); i++) {
            clip.addItem(clipItems.get(i));
        }
        return clip;
    }
}