Merge "Tweaks to DragAndDropPermissions behavior" into nyc-dev
This commit is contained in:
@@ -40820,8 +40820,11 @@ package android.view {
|
|||||||
field public static final android.os.Parcelable.Creator<android.view.Display.Mode> CREATOR;
|
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 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 {
|
public class DragEvent implements android.os.Parcelable {
|
||||||
|
|||||||
@@ -43819,8 +43819,11 @@ package android.view {
|
|||||||
field public static final android.os.Parcelable.Creator<android.view.Display.Mode> CREATOR;
|
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 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 {
|
public class DragEvent implements android.os.Parcelable {
|
||||||
|
|||||||
@@ -40899,8 +40899,11 @@ package android.view {
|
|||||||
field public static final android.os.Parcelable.Creator<android.view.Display.Mode> CREATOR;
|
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 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 {
|
public class DragEvent implements android.os.Parcelable {
|
||||||
|
|||||||
@@ -16,12 +16,14 @@
|
|||||||
|
|
||||||
package android.view;
|
package android.view;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.ActivityManagerNative;
|
import android.app.ActivityManagerNative;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.os.RemoteException;
|
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
|
* {@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
|
* 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(android.content.ClipData, View.DragShadowBuilder, Object, int)
|
||||||
* View.startDragAndDrop} by the app that started the drag operation.
|
* View.startDragAndDrop} by the app that started the drag operation.
|
||||||
|
* </p>
|
||||||
* <p>
|
* <p>
|
||||||
* The life cycle of the permissions is bound to the activity used to call {@link
|
* The life cycle of the permissions is bound to the activity used to call {@link
|
||||||
* android.app.Activity#requestDragAndDropPermissions(DragEvent) requestDragAndDropPermissions}. The
|
* android.app.Activity#requestDragAndDropPermissions(DragEvent) requestDragAndDropPermissions}. The
|
||||||
* permissions are revoked when this activity is destroyed, or when {@link #release()} is called,
|
* permissions are revoked when this activity is destroyed, or when {@link #release()} is called,
|
||||||
* whichever occurs first.
|
* 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 final IDragAndDropPermissions mDragAndDropPermissions;
|
||||||
|
|
||||||
private IBinder mPermissionOwnerToken;
|
private IBinder mPermissionOwnerToken;
|
||||||
|
|
||||||
private final CloseGuard mCloseGuard = CloseGuard.get();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link DragAndDropPermissions} object to control the access permissions for
|
* Create a new {@link DragAndDropPermissions} object to control the access permissions for
|
||||||
* content URIs associated with {@link DragEvent}.
|
* content URIs associated with {@link DragEvent}.
|
||||||
@@ -79,7 +88,6 @@ public final class DragAndDropPermissions {
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
mCloseGuard.open("release");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +104,6 @@ public final class DragAndDropPermissions {
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
mCloseGuard.open("release");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,18 +116,34 @@ public final class DragAndDropPermissions {
|
|||||||
mPermissionOwnerToken = null;
|
mPermissionOwnerToken = null;
|
||||||
} catch (RemoteException e) {
|
} 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
|
@Override
|
||||||
protected void finalize() throws Throwable {
|
public DragAndDropPermissions[] newArray(int size) {
|
||||||
try {
|
return new DragAndDropPermissions[size];
|
||||||
if (mCloseGuard != null) {
|
|
||||||
mCloseGuard.warnIfOpen();
|
|
||||||
}
|
|
||||||
release();
|
|
||||||
} finally {
|
|
||||||
super.finalize();
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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