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

Commit 73067713 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

[1/?] Support android.content for Ravenwood.

Initial pass at foundational classes under android.content, along
with CTS to verify consistency.

Methods that interface to broader parts of OS remain marked as
"throw" for the moment, such as cross-process work and StrictMode.

Bug: 292141694
Test: atest-dev CtsOsTestCasesRavenwood CtsOsTestCases
Test: atest-dev CtsContentTestCasesRavenwood CtsContentTestCases
Change-Id: Ic3deafb1f4058fcc104882a3508728994669f7d2
parent f8810f0d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ android_ravenwood_libgroup {
        "junit",
        "truth",
        "ravenwood-junit",
        "android.test.mock",
    ],
}

+10 −0
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@ import java.util.List;
 * into an editor), then {@link Item#coerceToText(Context)} will ask the content
 * provider for the clip URI as text and successfully paste the entire note.
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public class ClipData implements Parcelable {
    static final String[] MIMETYPES_TEXT_PLAIN = new String[] {
        ClipDescription.MIMETYPE_TEXT_PLAIN };
@@ -387,6 +388,7 @@ public class ClipData implements Parcelable {
         * @return Returns the item's textual representation.
         */
//BEGIN_INCLUDE(coerceToText)
        @android.ravenwood.annotation.RavenwoodThrow
        public CharSequence coerceToText(Context context) {
            // If this Item has an explicit textual value, simply return that.
            CharSequence text = getText();
@@ -470,6 +472,7 @@ public class ClipData implements Parcelable {
         * and other things can be retrieved.
         * @return Returns the item's textual representation.
         */
        @android.ravenwood.annotation.RavenwoodThrow
        public CharSequence coerceToStyledText(Context context) {
            CharSequence text = getText();
            if (text instanceof Spanned) {
@@ -520,6 +523,7 @@ public class ClipData implements Parcelable {
         * and other things can be retrieved.
         * @return Returns the item's representation as HTML text.
         */
        @android.ravenwood.annotation.RavenwoodThrow
        public String coerceToHtmlText(Context context) {
            // If the item has an explicit HTML value, simply return that.
            String htmlText = getHtmlText();
@@ -540,6 +544,7 @@ public class ClipData implements Parcelable {
            return text != null ? text.toString() : null;
        }

        @android.ravenwood.annotation.RavenwoodThrow
        private CharSequence coerceToHtmlOrStyledText(Context context, boolean styled) {
            // If this Item has a URI value, try using that.
            if (mUri != null) {
@@ -1030,6 +1035,7 @@ public class ClipData implements Parcelable {
     *
     * @hide
     */
    @android.ravenwood.annotation.RavenwoodThrow
    public void prepareToLeaveProcess(boolean leavingPackage) {
        // Assume that callers are going to be granting permissions
        prepareToLeaveProcess(leavingPackage, Intent.FLAG_GRANT_READ_URI_PERMISSION);
@@ -1040,6 +1046,7 @@ public class ClipData implements Parcelable {
     *
     * @hide
     */
    @android.ravenwood.annotation.RavenwoodThrow
    public void prepareToLeaveProcess(boolean leavingPackage, int intentFlags) {
        final int size = mItems.size();
        for (int i = 0; i < size; i++) {
@@ -1060,6 +1067,7 @@ public class ClipData implements Parcelable {
    }

    /** {@hide} */
    @android.ravenwood.annotation.RavenwoodThrow
    public void prepareToEnterProcess(AttributionSource source) {
        final int size = mItems.size();
        for (int i = 0; i < size; i++) {
@@ -1073,6 +1081,7 @@ public class ClipData implements Parcelable {
    }

    /** @hide */
    @android.ravenwood.annotation.RavenwoodThrow
    public void fixUris(int contentUserHint) {
        final int size = mItems.size();
        for (int i = 0; i < size; i++) {
@@ -1090,6 +1099,7 @@ public class ClipData implements Parcelable {
     * Only fixing the data field of the intents
     * @hide
     */
    @android.ravenwood.annotation.RavenwoodThrow
    public void fixUrisLight(int contentUserHint) {
        final int size = mItems.size();
        for (int i = 0; i < size; i++) {
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import java.util.Map;
 * developer guide.</p>
 * </div>
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public class ClipDescription implements Parcelable {
    /**
     * The MIME type for a clip holding plain text.
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import java.io.PrintWriter;
 * name inside of that package.
 *
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public final class ComponentName implements Parcelable, Cloneable, Comparable<ComponentName> {
    private final String mPackage;
    private final String mClass;
+1 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ import java.util.List;
*</dl>
*
*/
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public class ContentUris {

    /**
Loading