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

Commit 6779b120 authored by Chris Poultney's avatar Chris Poultney
Browse files

Removes WallpaperDescription stream read/write methods

The Parcelable implementation is sufficient for the data transfer that
needs to be done.

Fix: 376899963
Flag: android.app.live_wallpaper_content_handling
Test: manually verified sending WallpaperDescription AI -> picker
Change-Id: I8e5e2f62b40eec633ae3cc0b2079f222456cd3a6
parent cd48e7c1
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -9687,10 +9687,8 @@ package android.app.wallpaper {
    method @Nullable public String getId();
    method @Nullable public android.net.Uri getThumbnail();
    method @Nullable public CharSequence getTitle();
    method @NonNull public static android.app.wallpaper.WallpaperDescription readFromStream(@NonNull java.io.InputStream) throws java.io.IOException;
    method @NonNull public android.app.wallpaper.WallpaperDescription.Builder toBuilder();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    method public void writeToStream(@NonNull java.io.OutputStream) throws java.io.IOException;
    field @NonNull public static final android.os.Parcelable.Creator<android.app.wallpaper.WallpaperDescription> CREATOR;
  }
+0 −45
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@ package android.app.wallpaper;

import static android.app.Flags.FLAG_LIVE_WALLPAPER_CONTENT_HANDLING;

import static java.nio.charset.StandardCharsets.UTF_8;

import android.annotation.FlaggedApi;
import android.app.WallpaperInfo;
import android.content.ComponentName;
@@ -31,7 +29,6 @@ import android.text.Html;
import android.text.Spanned;
import android.text.SpannedString;
import android.util.Log;
import android.util.Xml;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -43,8 +40,6 @@ import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -154,46 +149,6 @@ public final class WallpaperDescription implements Parcelable {
        return Objects.hash(mComponent, mId);
    }

    ////// Stream read/write

    /**
     * Writes the content of the {@link WallpaperDescription} to a {@link OutputStream}.
     *
     * <p>The content can be read by {@link #readFromStream}. This method is intended for use by
     * trusted apps only, and the format is not guaranteed to be stable.</p>
     */
    public void writeToStream(@NonNull OutputStream outputStream) throws IOException {
        TypedXmlSerializer serializer = Xml.newFastSerializer();
        serializer.setOutput(outputStream, UTF_8.name());
        serializer.startTag(null, "description");
        try {
            saveToXml(serializer);
        } catch (XmlPullParserException e) {
            throw new IOException(e);
        }
        serializer.endTag(null, "description");
        serializer.flush();
    }

    /**
     * Reads a {@link PersistableBundle} from an {@link InputStream}.
     *
     * <p>The stream must be generated by {@link #writeToStream}. This method is intended for use by
     * trusted apps only, and the format is not guaranteed to be stable.</p>
     */
    @NonNull
    public static WallpaperDescription readFromStream(@NonNull InputStream inputStream)
            throws IOException {
        try {
            TypedXmlPullParser parser = Xml.newFastPullParser();
            parser.setInput(inputStream, UTF_8.name());
            parser.next();
            return WallpaperDescription.restoreFromXml(parser);
        } catch (XmlPullParserException e) {
            throw new IOException(e);
        }
    }

    ////// XML storage

    /** @hide */