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

Commit 1a932852 authored by Yohei Yukawa's avatar Yohei Yukawa Committed by android-build-merger
Browse files

Merge \"Automatically grant URI permission as needed.\" into nyc-mr1-dev

am: d2e046a7

Change-Id: I376fdeddb57a923fd3a71086ef6f8e6021347cbb
parents 1b24ab8d d2e046a7
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -191,8 +191,6 @@ public final class InputContentInfo implements Parcelable {
            mUriToken.release();
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        } finally {
            mUriToken = null;
        }
    }

+13 −3
Original line number Diff line number Diff line
@@ -562,6 +562,8 @@ public abstract class IInputConnectionWrapper extends IInputContext.Stub {
            }
            case DO_COMMIT_CONTENT: {
                final int flags = msg.arg1;
                final boolean grantUriPermission =
                        (flags & InputConnection.INPUT_CONTENT_GRANT_READ_URI_PERMISSION) != 0;
                SomeArgs args = (SomeArgs) msg.obj;
                try {
                    InputConnection ic = getInputConnection();
@@ -577,9 +579,17 @@ public abstract class IInputConnectionWrapper extends IInputContext.Stub {
                        args.callback.setCommitContentResult(false, args.seq);
                        return;
                    }
                    args.callback.setCommitContentResult(
                            ic.commitContent(inputContentInfo, flags, (Bundle) args.arg2),
                            args.seq);
                    if (grantUriPermission) {
                        inputContentInfo.requestPermission();
                    }
                    final boolean result =
                            ic.commitContent(inputContentInfo, flags, (Bundle) args.arg2);
                    // If this request is not handled, then there is no reason to keep the URI
                    // permission.
                    if (grantUriPermission && !result) {
                        inputContentInfo.releasePermission();
                    }
                    args.callback.setCommitContentResult(result, args.seq);
                } catch (RemoteException e) {
                    Log.w(TAG, "Got RemoteException calling commitContent", e);
                }