am cb1236be: am 7cb28e7b: Merge "Define EXTRA_SIZE for ContentProviders." into lmp-dev
* commit 'cb1236be15023152535cedfb9ed20a0c8b94ada1': Define EXTRA_SIZE for ContentProviders.
This commit is contained in:
@@ -7148,6 +7148,7 @@ package android.content {
|
||||
field public static final java.lang.String ANY_CURSOR_ITEM_TYPE = "vnd.android.cursor.item/*";
|
||||
field public static final java.lang.String CURSOR_DIR_BASE_TYPE = "vnd.android.cursor.dir";
|
||||
field public static final java.lang.String CURSOR_ITEM_BASE_TYPE = "vnd.android.cursor.item";
|
||||
field public static final java.lang.String EXTRA_SIZE = "android.content.extra.SIZE";
|
||||
field public static final java.lang.String SCHEME_ANDROID_RESOURCE = "android.resource";
|
||||
field public static final java.lang.String SCHEME_CONTENT = "content";
|
||||
field public static final java.lang.String SCHEME_FILE = "file";
|
||||
@@ -32234,17 +32235,23 @@ package android.util {
|
||||
field public static final android.util.Rational ZERO;
|
||||
}
|
||||
|
||||
public final class Size {
|
||||
public final class Size implements android.os.Parcelable {
|
||||
ctor public Size(int, int);
|
||||
method public int describeContents();
|
||||
method public int getHeight();
|
||||
method public int getWidth();
|
||||
method public static android.util.Size parseSize(java.lang.String) throws java.lang.NumberFormatException;
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator CREATOR;
|
||||
}
|
||||
|
||||
public final class SizeF {
|
||||
public final class SizeF implements android.os.Parcelable {
|
||||
ctor public SizeF(float, float);
|
||||
method public int describeContents();
|
||||
method public float getHeight();
|
||||
method public float getWidth();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator CREATOR;
|
||||
}
|
||||
|
||||
public class SparseArray implements java.lang.Cloneable {
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.database.ContentObserver;
|
||||
import android.database.CrossProcessCursorWrapper;
|
||||
import android.database.Cursor;
|
||||
import android.database.IContentObserver;
|
||||
import android.graphics.Point;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.CancellationSignal;
|
||||
@@ -160,6 +161,17 @@ public abstract class ContentResolver {
|
||||
public static final String SCHEME_ANDROID_RESOURCE = "android.resource";
|
||||
public static final String SCHEME_FILE = "file";
|
||||
|
||||
/**
|
||||
* An extra {@link Point} describing the optimal size for a requested image
|
||||
* resource, in pixels. If a provider has multiple sizes of the image, it
|
||||
* should return the image closest to this size.
|
||||
*
|
||||
* @see #openTypedAssetFileDescriptor(Uri, String, Bundle)
|
||||
* @see #openTypedAssetFileDescriptor(Uri, String, Bundle,
|
||||
* CancellationSignal)
|
||||
*/
|
||||
public static final String EXTRA_SIZE = "android.content.extra.SIZE";
|
||||
|
||||
/**
|
||||
* This is the Android platform's base MIME type for a content: URI
|
||||
* containing a Cursor of a single item. Applications should use this
|
||||
|
||||
@@ -510,8 +510,6 @@ public final class DocumentsContract {
|
||||
/** {@hide} */
|
||||
public static final String METHOD_DELETE_DOCUMENT = "android:deleteDocument";
|
||||
|
||||
/** {@hide} */
|
||||
public static final String EXTRA_THUMBNAIL_SIZE = "thumbnail_size";
|
||||
/** {@hide} */
|
||||
public static final String EXTRA_URI = "uri";
|
||||
|
||||
@@ -819,7 +817,7 @@ public final class DocumentsContract {
|
||||
ContentProviderClient client, Uri documentUri, Point size, CancellationSignal signal)
|
||||
throws RemoteException, IOException {
|
||||
final Bundle openOpts = new Bundle();
|
||||
openOpts.putParcelable(DocumentsContract.EXTRA_THUMBNAIL_SIZE, size);
|
||||
openOpts.putParcelable(ContentResolver.EXTRA_SIZE, size);
|
||||
|
||||
AssetFileDescriptor afd = null;
|
||||
Bitmap bitmap = null;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package android.provider;
|
||||
|
||||
import static android.provider.DocumentsContract.EXTRA_THUMBNAIL_SIZE;
|
||||
import static android.provider.DocumentsContract.METHOD_CREATE_DOCUMENT;
|
||||
import static android.provider.DocumentsContract.METHOD_DELETE_DOCUMENT;
|
||||
import static android.provider.DocumentsContract.METHOD_RENAME_DOCUMENT;
|
||||
@@ -763,8 +762,8 @@ public abstract class DocumentsProvider extends ContentProvider {
|
||||
public final AssetFileDescriptor openTypedAssetFile(Uri uri, String mimeTypeFilter, Bundle opts)
|
||||
throws FileNotFoundException {
|
||||
enforceTree(uri);
|
||||
if (opts != null && opts.containsKey(EXTRA_THUMBNAIL_SIZE)) {
|
||||
final Point sizeHint = opts.getParcelable(EXTRA_THUMBNAIL_SIZE);
|
||||
if (opts != null && opts.containsKey(ContentResolver.EXTRA_SIZE)) {
|
||||
final Point sizeHint = opts.getParcelable(ContentResolver.EXTRA_SIZE);
|
||||
return openDocumentThumbnail(getDocumentId(uri), sizeHint, null);
|
||||
} else {
|
||||
return super.openTypedAssetFile(uri, mimeTypeFilter, opts);
|
||||
@@ -781,8 +780,8 @@ public abstract class DocumentsProvider extends ContentProvider {
|
||||
Uri uri, String mimeTypeFilter, Bundle opts, CancellationSignal signal)
|
||||
throws FileNotFoundException {
|
||||
enforceTree(uri);
|
||||
if (opts != null && opts.containsKey(EXTRA_THUMBNAIL_SIZE)) {
|
||||
final Point sizeHint = opts.getParcelable(EXTRA_THUMBNAIL_SIZE);
|
||||
if (opts != null && opts.containsKey(ContentResolver.EXTRA_SIZE)) {
|
||||
final Point sizeHint = opts.getParcelable(ContentResolver.EXTRA_SIZE);
|
||||
return openDocumentThumbnail(getDocumentId(uri), sizeHint, signal);
|
||||
} else {
|
||||
return super.openTypedAssetFile(uri, mimeTypeFilter, opts, signal);
|
||||
|
||||
@@ -16,12 +16,15 @@
|
||||
|
||||
package android.util;
|
||||
|
||||
import static com.android.internal.util.Preconditions.*;
|
||||
import static com.android.internal.util.Preconditions.checkNotNull;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* Immutable class for describing width and height dimensions in pixels.
|
||||
*/
|
||||
public final class Size {
|
||||
public final class Size implements Parcelable {
|
||||
/**
|
||||
* Create a new immutable Size instance.
|
||||
*
|
||||
@@ -33,6 +36,11 @@ public final class Size {
|
||||
mHeight = height;
|
||||
}
|
||||
|
||||
private Size(Parcel in) {
|
||||
mWidth = in.readInt();
|
||||
mHeight = in.readInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the width of the size (in pixels).
|
||||
* @return width
|
||||
@@ -147,6 +155,29 @@ public final class Size {
|
||||
return mHeight ^ ((mWidth << (Integer.SIZE / 2)) | (mWidth >>> (Integer.SIZE / 2)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
out.writeInt(mWidth);
|
||||
out.writeInt(mHeight);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<Size> CREATOR = new Parcelable.Creator<Size>() {
|
||||
@Override
|
||||
public Size createFromParcel(Parcel in) {
|
||||
return new Size(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Size[] newArray(int size) {
|
||||
return new Size[size];
|
||||
}
|
||||
};
|
||||
|
||||
private final int mWidth;
|
||||
private final int mHeight;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
|
||||
package android.util;
|
||||
|
||||
import static com.android.internal.util.Preconditions.*;
|
||||
import static com.android.internal.util.Preconditions.checkArgumentFinite;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* Immutable class for describing width and height dimensions in some arbitrary
|
||||
@@ -25,7 +28,7 @@ import static com.android.internal.util.Preconditions.*;
|
||||
* Width and height are finite values stored as a floating point representation.
|
||||
* </p>
|
||||
*/
|
||||
public final class SizeF {
|
||||
public final class SizeF implements Parcelable {
|
||||
/**
|
||||
* Create a new immutable SizeF instance.
|
||||
*
|
||||
@@ -43,6 +46,11 @@ public final class SizeF {
|
||||
mHeight = checkArgumentFinite(height, "height");
|
||||
}
|
||||
|
||||
private SizeF(Parcel in) {
|
||||
mWidth = in.readFloat();
|
||||
mHeight = in.readFloat();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the width of the size (as an arbitrary unit).
|
||||
* @return width
|
||||
@@ -103,6 +111,29 @@ public final class SizeF {
|
||||
return Float.floatToIntBits(mWidth) ^ Float.floatToIntBits(mHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
out.writeFloat(mWidth);
|
||||
out.writeFloat(mHeight);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<SizeF> CREATOR = new Parcelable.Creator<SizeF>() {
|
||||
@Override
|
||||
public SizeF createFromParcel(Parcel in) {
|
||||
return new SizeF(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SizeF[] newArray(int size) {
|
||||
return new SizeF[size];
|
||||
}
|
||||
};
|
||||
|
||||
private final float mWidth;
|
||||
private final float mHeight;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user