Merge \\"Tweaks to DragAndDropPermissions behavior\\" into nyc-dev am: 22faa5ddb1
am: 072ce0c29c
Change-Id: Iee2afec7bd3b6d6a81ce179df9e52a9e20bc1b72
This commit is contained in:
@@ -40999,8 +40999,11 @@ package android.view {
|
||||
field public static final android.os.Parcelable.Creator<android.view.Display.Mode> CREATOR;
|
||||
}
|
||||
|
||||
public final class DragAndDropPermissions {
|
||||
public final class DragAndDropPermissions implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public void release();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.view.DragAndDropPermissions> CREATOR;
|
||||
}
|
||||
|
||||
public class DragEvent implements android.os.Parcelable {
|
||||
|
||||
@@ -44103,8 +44103,11 @@ package android.view {
|
||||
field public static final android.os.Parcelable.Creator<android.view.Display.Mode> CREATOR;
|
||||
}
|
||||
|
||||
public final class DragAndDropPermissions {
|
||||
public final class DragAndDropPermissions implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public void release();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.view.DragAndDropPermissions> CREATOR;
|
||||
}
|
||||
|
||||
public class DragEvent implements android.os.Parcelable {
|
||||
|
||||
@@ -41079,8 +41079,11 @@ package android.view {
|
||||
field public static final android.os.Parcelable.Creator<android.view.Display.Mode> CREATOR;
|
||||
}
|
||||
|
||||
public final class DragAndDropPermissions {
|
||||
public final class DragAndDropPermissions implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public void release();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.view.DragAndDropPermissions> CREATOR;
|
||||
}
|
||||
|
||||
public class DragEvent implements android.os.Parcelable {
|
||||
|
||||
@@ -16,12 +16,14 @@
|
||||
|
||||
package android.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.os.IBinder;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.os.RemoteException;
|
||||
import com.android.internal.view.IDragAndDropPermissions;
|
||||
import dalvik.system.CloseGuard;
|
||||
|
||||
import com.android.internal.view.IDragAndDropPermissions;
|
||||
|
||||
/**
|
||||
* {@link DragAndDropPermissions} controls the access permissions for the content URIs associated
|
||||
@@ -33,20 +35,27 @@ import dalvik.system.CloseGuard;
|
||||
* Which permissions are granted is defined by the set of flags passed to {@link
|
||||
* View#startDragAndDrop(android.content.ClipData, View.DragShadowBuilder, Object, int)
|
||||
* View.startDragAndDrop} by the app that started the drag operation.
|
||||
* </p>
|
||||
* <p>
|
||||
* The life cycle of the permissions is bound to the activity used to call {@link
|
||||
* android.app.Activity#requestDragAndDropPermissions(DragEvent) requestDragAndDropPermissions}. The
|
||||
* permissions are revoked when this activity is destroyed, or when {@link #release()} is called,
|
||||
* whichever occurs first.
|
||||
* </p>
|
||||
* <p>
|
||||
* If you anticipate that your application will receive a large number of drops (e.g. document
|
||||
* editor), you should try to call {@link #release()} on the obtained permissions as soon as they
|
||||
* are no longer required. Permissions can be added to your activity's
|
||||
* {@link Activity#onSaveInstanceState} bundle and later retrieved in order to manually release
|
||||
* the permissions once they are no longer needed.
|
||||
* </p>
|
||||
*/
|
||||
public final class DragAndDropPermissions {
|
||||
public final class DragAndDropPermissions implements Parcelable {
|
||||
|
||||
private final IDragAndDropPermissions mDragAndDropPermissions;
|
||||
|
||||
private IBinder mPermissionOwnerToken;
|
||||
|
||||
private final CloseGuard mCloseGuard = CloseGuard.get();
|
||||
|
||||
/**
|
||||
* Create a new {@link DragAndDropPermissions} object to control the access permissions for
|
||||
* content URIs associated with {@link DragEvent}.
|
||||
@@ -79,7 +88,6 @@ public final class DragAndDropPermissions {
|
||||
} catch (RemoteException e) {
|
||||
return false;
|
||||
}
|
||||
mCloseGuard.open("release");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -96,7 +104,6 @@ public final class DragAndDropPermissions {
|
||||
} catch (RemoteException e) {
|
||||
return false;
|
||||
}
|
||||
mCloseGuard.open("release");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -109,18 +116,34 @@ public final class DragAndDropPermissions {
|
||||
mPermissionOwnerToken = null;
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
mCloseGuard.close();
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<DragAndDropPermissions> CREATOR =
|
||||
new Parcelable.Creator<DragAndDropPermissions> () {
|
||||
@Override
|
||||
public DragAndDropPermissions createFromParcel(Parcel source) {
|
||||
return new DragAndDropPermissions(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DragAndDropPermissions[] newArray(int size) {
|
||||
return new DragAndDropPermissions[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
if (mCloseGuard != null) {
|
||||
mCloseGuard.warnIfOpen();
|
||||
}
|
||||
release();
|
||||
} finally {
|
||||
super.finalize();
|
||||
}
|
||||
public void writeToParcel(Parcel destination, int flags) {
|
||||
destination.writeStrongInterface(mDragAndDropPermissions);
|
||||
destination.writeStrongBinder(mPermissionOwnerToken);
|
||||
}
|
||||
|
||||
private DragAndDropPermissions(Parcel in) {
|
||||
mDragAndDropPermissions = IDragAndDropPermissions.Stub.asInterface(in.readStrongBinder());
|
||||
mPermissionOwnerToken = in.readStrongBinder();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user