| 1 | package net.paperclover.snowbound.providerlab; |
| 2 | |
| 3 | import android.app.Activity; |
| 4 | import android.content.Intent; |
| 5 | import android.os.Bundle; |
| 6 | import android.provider.DocumentsContract; |
| 7 | |
| 8 | public final class Pick extends Activity { |
| 9 | @Override public void onCreate(Bundle state) { |
| 10 | super.onCreate(state); |
| 11 | setResult(RESULT_OK, new Intent() |
| 12 | .setData(DocumentsContract.buildTreeDocumentUri(LabProvider.AUTHORITY, LabProvider.ROOT)) |
| 13 | .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION |
| 14 | | (getIntent().getBooleanExtra("write", false) ? Intent.FLAG_GRANT_WRITE_URI_PERMISSION : 0) |
| 15 | | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION | Intent.FLAG_GRANT_PREFIX_URI_PERMISSION) |
| 16 | .putExtra("providerUid", android.os.Process.myUid()).putExtra("providerPid", android.os.Process.myPid())); |
| 17 | finish(); |
| 18 | } |
| 19 | } |