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

Commit 5c39fab5 authored by Steve McKay's avatar Steve McKay Committed by android-build-merger
Browse files

Only use new ClipData constructor on O devices.

am: de67a7b3

Change-Id: I569b3fea217dd17c36047fbb87ca38fa275ae450
parents 579f8d3e de67a7b3
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;
    }
}