Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.os; |
| 18 | |
Jeff Sharkey | b8e8a91 | 2016-03-09 16:27:40 -0700 | [diff] [blame] | 19 | import android.content.Context; |
| 20 | import android.util.Log; |
| 21 | |
Dan Egnor | f18a01c | 2009-11-12 11:32:50 -0800 | [diff] [blame] | 22 | import com.android.internal.os.IDropBoxManagerService; |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 23 | |
| 24 | import java.io.ByteArrayInputStream; |
Brad Fitzpatrick | cc792c4 | 2010-10-08 09:50:30 -0700 | [diff] [blame] | 25 | import java.io.Closeable; |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 26 | import java.io.File; |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 27 | import java.io.IOException; |
| 28 | import java.io.InputStream; |
| 29 | import java.util.zip.GZIPInputStream; |
| 30 | |
| 31 | /** |
| 32 | * Enqueues chunks of data (from various sources -- application crashes, kernel |
| 33 | * log records, etc.). The queue is size bounded and will drop old data if the |
| 34 | * enqueued data exceeds the maximum size. You can think of this as a |
| 35 | * persistent, system-wide, blob-oriented "logcat". |
| 36 | * |
| 37 | * <p>You can obtain an instance of this class by calling |
| 38 | * {@link android.content.Context#getSystemService} |
| 39 | * with {@link android.content.Context#DROPBOX_SERVICE}. |
| 40 | * |
Dan Egnor | f18a01c | 2009-11-12 11:32:50 -0800 | [diff] [blame] | 41 | * <p>DropBoxManager entries are not sent anywhere directly, but other system |
| 42 | * services and debugging tools may scan and upload entries for processing. |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 43 | */ |
Dan Egnor | f18a01c | 2009-11-12 11:32:50 -0800 | [diff] [blame] | 44 | public class DropBoxManager { |
| 45 | private static final String TAG = "DropBoxManager"; |
Jeff Sharkey | b8e8a91 | 2016-03-09 16:27:40 -0700 | [diff] [blame] | 46 | |
| 47 | private final Context mContext; |
Dan Egnor | f18a01c | 2009-11-12 11:32:50 -0800 | [diff] [blame] | 48 | private final IDropBoxManagerService mService; |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 49 | |
| 50 | /** Flag value: Entry's content was deleted to save space. */ |
| 51 | public static final int IS_EMPTY = 1; |
| 52 | |
| 53 | /** Flag value: Content is human-readable UTF-8 text (can be combined with IS_GZIPPED). */ |
| 54 | public static final int IS_TEXT = 2; |
| 55 | |
Dan Egnor | e3cfe2d | 2009-11-14 16:20:04 -0800 | [diff] [blame] | 56 | /** Flag value: Content can be decompressed with {@link java.util.zip.GZIPOutputStream}. */ |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 57 | public static final int IS_GZIPPED = 4; |
| 58 | |
Dan Egnor | 6e6d60d | 2010-07-20 15:24:09 -0700 | [diff] [blame] | 59 | /** Flag value for serialization only: Value is a byte array, not a file descriptor */ |
| 60 | private static final int HAS_BYTE_ARRAY = 8; |
| 61 | |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 62 | /** |
Hakan Still | b247536 | 2010-12-07 14:05:55 +0100 | [diff] [blame] | 63 | * Broadcast Action: This is broadcast when a new entry is added in the dropbox. |
| 64 | * You must hold the {@link android.Manifest.permission#READ_LOGS} permission |
| 65 | * in order to receive this broadcast. |
| 66 | * |
| 67 | * <p class="note">This is a protected intent that can only be sent |
| 68 | * by the system. |
| 69 | */ |
| 70 | public static final String ACTION_DROPBOX_ENTRY_ADDED = |
| 71 | "android.intent.action.DROPBOX_ENTRY_ADDED"; |
| 72 | |
| 73 | /** |
| 74 | * Extra for {@link android.os.DropBoxManager#ACTION_DROPBOX_ENTRY_ADDED}: |
| 75 | * string containing the dropbox tag. |
| 76 | */ |
| 77 | public static final String EXTRA_TAG = "tag"; |
| 78 | |
| 79 | /** |
| 80 | * Extra for {@link android.os.DropBoxManager#ACTION_DROPBOX_ENTRY_ADDED}: |
| 81 | * long integer value containing time (in milliseconds since January 1, 1970 00:00:00 UTC) |
| 82 | * when the entry was created. |
| 83 | */ |
| 84 | public static final String EXTRA_TIME = "time"; |
| 85 | |
| 86 | /** |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 87 | * A single entry retrieved from the drop box. |
| 88 | * This may include a reference to a stream, so you must call |
| 89 | * {@link #close()} when you are done using it. |
| 90 | */ |
Brad Fitzpatrick | cc792c4 | 2010-10-08 09:50:30 -0700 | [diff] [blame] | 91 | public static class Entry implements Parcelable, Closeable { |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 92 | private final String mTag; |
| 93 | private final long mTimeMillis; |
| 94 | |
| 95 | private final byte[] mData; |
| 96 | private final ParcelFileDescriptor mFileDescriptor; |
| 97 | private final int mFlags; |
| 98 | |
| 99 | /** Create a new empty Entry with no contents. */ |
| 100 | public Entry(String tag, long millis) { |
Dan Egnor | 6e6d60d | 2010-07-20 15:24:09 -0700 | [diff] [blame] | 101 | if (tag == null) throw new NullPointerException("tag == null"); |
| 102 | |
| 103 | mTag = tag; |
| 104 | mTimeMillis = millis; |
| 105 | mData = null; |
| 106 | mFileDescriptor = null; |
| 107 | mFlags = IS_EMPTY; |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 108 | } |
| 109 | |
| 110 | /** Create a new Entry with plain text contents. */ |
| 111 | public Entry(String tag, long millis, String text) { |
Dan Egnor | 6e6d60d | 2010-07-20 15:24:09 -0700 | [diff] [blame] | 112 | if (tag == null) throw new NullPointerException("tag == null"); |
| 113 | if (text == null) throw new NullPointerException("text == null"); |
| 114 | |
| 115 | mTag = tag; |
| 116 | mTimeMillis = millis; |
| 117 | mData = text.getBytes(); |
| 118 | mFileDescriptor = null; |
| 119 | mFlags = IS_TEXT; |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | /** |
| 123 | * Create a new Entry with byte array contents. |
| 124 | * The data array must not be modified after creating this entry. |
| 125 | */ |
| 126 | public Entry(String tag, long millis, byte[] data, int flags) { |
Dan Egnor | 6e6d60d | 2010-07-20 15:24:09 -0700 | [diff] [blame] | 127 | if (tag == null) throw new NullPointerException("tag == null"); |
| 128 | if (((flags & IS_EMPTY) != 0) != (data == null)) { |
| 129 | throw new IllegalArgumentException("Bad flags: " + flags); |
| 130 | } |
| 131 | |
| 132 | mTag = tag; |
| 133 | mTimeMillis = millis; |
| 134 | mData = data; |
| 135 | mFileDescriptor = null; |
| 136 | mFlags = flags; |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | /** |
| 140 | * Create a new Entry with streaming data contents. |
| 141 | * Takes ownership of the ParcelFileDescriptor. |
| 142 | */ |
| 143 | public Entry(String tag, long millis, ParcelFileDescriptor data, int flags) { |
Dan Egnor | 6e6d60d | 2010-07-20 15:24:09 -0700 | [diff] [blame] | 144 | if (tag == null) throw new NullPointerException("tag == null"); |
| 145 | if (((flags & IS_EMPTY) != 0) != (data == null)) { |
| 146 | throw new IllegalArgumentException("Bad flags: " + flags); |
| 147 | } |
| 148 | |
| 149 | mTag = tag; |
| 150 | mTimeMillis = millis; |
| 151 | mData = null; |
| 152 | mFileDescriptor = data; |
| 153 | mFlags = flags; |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | /** |
| 157 | * Create a new Entry with the contents read from a file. |
| 158 | * The file will be read when the entry's contents are requested. |
| 159 | */ |
| 160 | public Entry(String tag, long millis, File data, int flags) throws IOException { |
Dan Egnor | 6e6d60d | 2010-07-20 15:24:09 -0700 | [diff] [blame] | 161 | if (tag == null) throw new NullPointerException("tag == null"); |
| 162 | if ((flags & IS_EMPTY) != 0) throw new IllegalArgumentException("Bad flags: " + flags); |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 163 | |
| 164 | mTag = tag; |
| 165 | mTimeMillis = millis; |
Dan Egnor | 6e6d60d | 2010-07-20 15:24:09 -0700 | [diff] [blame] | 166 | mData = null; |
| 167 | mFileDescriptor = ParcelFileDescriptor.open(data, ParcelFileDescriptor.MODE_READ_ONLY); |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 168 | mFlags = flags; |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 169 | } |
| 170 | |
| 171 | /** Close the input stream associated with this entry. */ |
| 172 | public void close() { |
| 173 | try { if (mFileDescriptor != null) mFileDescriptor.close(); } catch (IOException e) { } |
| 174 | } |
| 175 | |
| 176 | /** @return the tag originally attached to the entry. */ |
| 177 | public String getTag() { return mTag; } |
| 178 | |
| 179 | /** @return time when the entry was originally created. */ |
| 180 | public long getTimeMillis() { return mTimeMillis; } |
| 181 | |
Brad Fitzpatrick | 95173b1 | 2010-10-07 10:07:34 -0700 | [diff] [blame] | 182 | /** @return flags describing the content returned by {@link #getInputStream()}. */ |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 183 | public int getFlags() { return mFlags & ~IS_GZIPPED; } // getInputStream() decompresses. |
| 184 | |
| 185 | /** |
| 186 | * @param maxBytes of string to return (will truncate at this length). |
| 187 | * @return the uncompressed text contents of the entry, null if the entry is not text. |
| 188 | */ |
| 189 | public String getText(int maxBytes) { |
| 190 | if ((mFlags & IS_TEXT) == 0) return null; |
| 191 | if (mData != null) return new String(mData, 0, Math.min(maxBytes, mData.length)); |
| 192 | |
| 193 | InputStream is = null; |
| 194 | try { |
| 195 | is = getInputStream(); |
Dan Egnor | 6e6d60d | 2010-07-20 15:24:09 -0700 | [diff] [blame] | 196 | if (is == null) return null; |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 197 | byte[] buf = new byte[maxBytes]; |
Christian Lindeberg | e9f1881 | 2010-11-16 09:57:54 +0100 | [diff] [blame] | 198 | int readBytes = 0; |
| 199 | int n = 0; |
| 200 | while (n >= 0 && (readBytes += n) < maxBytes) { |
| 201 | n = is.read(buf, readBytes, maxBytes - readBytes); |
| 202 | } |
| 203 | return new String(buf, 0, readBytes); |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 204 | } catch (IOException e) { |
| 205 | return null; |
| 206 | } finally { |
| 207 | try { if (is != null) is.close(); } catch (IOException e) {} |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | /** @return the uncompressed contents of the entry, or null if the contents were lost */ |
| 212 | public InputStream getInputStream() throws IOException { |
| 213 | InputStream is; |
| 214 | if (mData != null) { |
| 215 | is = new ByteArrayInputStream(mData); |
| 216 | } else if (mFileDescriptor != null) { |
| 217 | is = new ParcelFileDescriptor.AutoCloseInputStream(mFileDescriptor); |
| 218 | } else { |
| 219 | return null; |
| 220 | } |
| 221 | return (mFlags & IS_GZIPPED) != 0 ? new GZIPInputStream(is) : is; |
| 222 | } |
| 223 | |
| 224 | public static final Parcelable.Creator<Entry> CREATOR = new Parcelable.Creator() { |
| 225 | public Entry[] newArray(int size) { return new Entry[size]; } |
| 226 | public Entry createFromParcel(Parcel in) { |
Dan Egnor | 6e6d60d | 2010-07-20 15:24:09 -0700 | [diff] [blame] | 227 | String tag = in.readString(); |
| 228 | long millis = in.readLong(); |
| 229 | int flags = in.readInt(); |
| 230 | if ((flags & HAS_BYTE_ARRAY) != 0) { |
| 231 | return new Entry(tag, millis, in.createByteArray(), flags & ~HAS_BYTE_ARRAY); |
| 232 | } else { |
Tim Kilbourn | ba95323 | 2015-06-02 15:57:45 -0700 | [diff] [blame] | 233 | ParcelFileDescriptor pfd = ParcelFileDescriptor.CREATOR.createFromParcel(in); |
| 234 | return new Entry(tag, millis, pfd, flags); |
Dan Egnor | 6e6d60d | 2010-07-20 15:24:09 -0700 | [diff] [blame] | 235 | } |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 236 | } |
| 237 | }; |
| 238 | |
| 239 | public int describeContents() { |
| 240 | return mFileDescriptor != null ? Parcelable.CONTENTS_FILE_DESCRIPTOR : 0; |
| 241 | } |
| 242 | |
| 243 | public void writeToParcel(Parcel out, int flags) { |
| 244 | out.writeString(mTag); |
| 245 | out.writeLong(mTimeMillis); |
| 246 | if (mFileDescriptor != null) { |
Dan Egnor | 6e6d60d | 2010-07-20 15:24:09 -0700 | [diff] [blame] | 247 | out.writeInt(mFlags & ~HAS_BYTE_ARRAY); // Clear bit just to be safe |
| 248 | mFileDescriptor.writeToParcel(out, flags); |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 249 | } else { |
Dan Egnor | 6e6d60d | 2010-07-20 15:24:09 -0700 | [diff] [blame] | 250 | out.writeInt(mFlags | HAS_BYTE_ARRAY); |
| 251 | out.writeByteArray(mData); |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 252 | } |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 253 | } |
| 254 | } |
| 255 | |
| 256 | /** {@hide} */ |
Jeff Sharkey | b8e8a91 | 2016-03-09 16:27:40 -0700 | [diff] [blame] | 257 | public DropBoxManager(Context context, IDropBoxManagerService service) { |
| 258 | mContext = context; |
| 259 | mService = service; |
| 260 | } |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 261 | |
| 262 | /** |
| 263 | * Create a dummy instance for testing. All methods will fail unless |
| 264 | * overridden with an appropriate mock implementation. To obtain a |
| 265 | * functional instance, use {@link android.content.Context#getSystemService}. |
| 266 | */ |
Jeff Sharkey | b8e8a91 | 2016-03-09 16:27:40 -0700 | [diff] [blame] | 267 | protected DropBoxManager() { |
| 268 | mContext = null; |
| 269 | mService = null; |
| 270 | } |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 271 | |
| 272 | /** |
| 273 | * Stores human-readable text. The data may be discarded eventually (or even |
| 274 | * immediately) if space is limited, or ignored entirely if the tag has been |
| 275 | * blocked (see {@link #isTagEnabled}). |
| 276 | * |
| 277 | * @param tag describing the type of entry being stored |
| 278 | * @param data value to store |
| 279 | */ |
| 280 | public void addText(String tag, String data) { |
Jeff Sharkey | f888056 | 2016-02-26 13:03:01 -0700 | [diff] [blame] | 281 | try { |
| 282 | mService.add(new Entry(tag, 0, data)); |
| 283 | } catch (RemoteException e) { |
Jeff Sharkey | b8e8a91 | 2016-03-09 16:27:40 -0700 | [diff] [blame] | 284 | if (e instanceof TransactionTooLargeException |
| 285 | && mContext.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.N) { |
| 286 | Log.e(TAG, "App sent too much data, so it was ignored", e); |
| 287 | return; |
| 288 | } |
Jeff Sharkey | f888056 | 2016-02-26 13:03:01 -0700 | [diff] [blame] | 289 | throw e.rethrowFromSystemServer(); |
| 290 | } |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 291 | } |
| 292 | |
| 293 | /** |
| 294 | * Stores binary data, which may be ignored or discarded as with {@link #addText}. |
| 295 | * |
| 296 | * @param tag describing the type of entry being stored |
| 297 | * @param data value to store |
| 298 | * @param flags describing the data |
| 299 | */ |
| 300 | public void addData(String tag, byte[] data, int flags) { |
Dan Egnor | 6e6d60d | 2010-07-20 15:24:09 -0700 | [diff] [blame] | 301 | if (data == null) throw new NullPointerException("data == null"); |
Jeff Sharkey | f888056 | 2016-02-26 13:03:01 -0700 | [diff] [blame] | 302 | try { |
| 303 | mService.add(new Entry(tag, 0, data, flags)); |
| 304 | } catch (RemoteException e) { |
Jeff Sharkey | b8e8a91 | 2016-03-09 16:27:40 -0700 | [diff] [blame] | 305 | if (e instanceof TransactionTooLargeException |
| 306 | && mContext.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.N) { |
| 307 | Log.e(TAG, "App sent too much data, so it was ignored", e); |
| 308 | return; |
| 309 | } |
Jeff Sharkey | f888056 | 2016-02-26 13:03:01 -0700 | [diff] [blame] | 310 | throw e.rethrowFromSystemServer(); |
| 311 | } |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 312 | } |
| 313 | |
| 314 | /** |
Dan Egnor | eb7a7d5 | 2009-11-25 12:38:00 -0800 | [diff] [blame] | 315 | * Stores the contents of a file, which may be ignored or discarded as with |
| 316 | * {@link #addText}. |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 317 | * |
| 318 | * @param tag describing the type of entry being stored |
Dan Egnor | eb7a7d5 | 2009-11-25 12:38:00 -0800 | [diff] [blame] | 319 | * @param file to read from |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 320 | * @param flags describing the data |
Dan Egnor | eb7a7d5 | 2009-11-25 12:38:00 -0800 | [diff] [blame] | 321 | * @throws IOException if the file can't be opened |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 322 | */ |
Dan Egnor | eb7a7d5 | 2009-11-25 12:38:00 -0800 | [diff] [blame] | 323 | public void addFile(String tag, File file, int flags) throws IOException { |
Dan Egnor | 6e6d60d | 2010-07-20 15:24:09 -0700 | [diff] [blame] | 324 | if (file == null) throw new NullPointerException("file == null"); |
Dan Egnor | eb7a7d5 | 2009-11-25 12:38:00 -0800 | [diff] [blame] | 325 | Entry entry = new Entry(tag, 0, file, flags); |
| 326 | try { |
Brad Fitzpatrick | 1441894 | 2010-06-14 08:58:26 -0700 | [diff] [blame] | 327 | mService.add(entry); |
Dan Egnor | eb7a7d5 | 2009-11-25 12:38:00 -0800 | [diff] [blame] | 328 | } catch (RemoteException e) { |
Jeff Sharkey | f888056 | 2016-02-26 13:03:01 -0700 | [diff] [blame] | 329 | throw e.rethrowFromSystemServer(); |
Dan Egnor | eb7a7d5 | 2009-11-25 12:38:00 -0800 | [diff] [blame] | 330 | } finally { |
| 331 | entry.close(); |
| 332 | } |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 333 | } |
| 334 | |
| 335 | /** |
| 336 | * Checks any blacklists (set in system settings) to see whether a certain |
| 337 | * tag is allowed. Entries with disabled tags will be dropped immediately, |
| 338 | * so you can save the work of actually constructing and sending the data. |
| 339 | * |
| 340 | * @param tag that would be used in {@link #addText} or {@link #addFile} |
| 341 | * @return whether events with that tag would be accepted |
| 342 | */ |
| 343 | public boolean isTagEnabled(String tag) { |
Jeff Sharkey | f888056 | 2016-02-26 13:03:01 -0700 | [diff] [blame] | 344 | try { |
| 345 | return mService.isTagEnabled(tag); |
| 346 | } catch (RemoteException e) { |
| 347 | throw e.rethrowFromSystemServer(); |
| 348 | } |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 349 | } |
| 350 | |
| 351 | /** |
Brad Fitzpatrick | 30f5c8f | 2010-10-07 10:48:20 -0700 | [diff] [blame] | 352 | * Gets the next entry from the drop box <em>after</em> the specified time. |
| 353 | * Requires <code>android.permission.READ_LOGS</code>. You must always call |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 354 | * {@link Entry#close()} on the return value! |
| 355 | * |
| 356 | * @param tag of entry to look for, null for all tags |
| 357 | * @param msec time of the last entry seen |
| 358 | * @return the next entry, or null if there are no more entries |
| 359 | */ |
| 360 | public Entry getNextEntry(String tag, long msec) { |
Jeff Sharkey | f888056 | 2016-02-26 13:03:01 -0700 | [diff] [blame] | 361 | try { |
| 362 | return mService.getNextEntry(tag, msec); |
| 363 | } catch (RemoteException e) { |
| 364 | throw e.rethrowFromSystemServer(); |
| 365 | } |
Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 366 | } |
| 367 | |
| 368 | // TODO: It may be useful to have some sort of notification mechanism |
| 369 | // when data is added to the dropbox, for demand-driven readers -- |
| 370 | // for now readers need to poll the dropbox to find new data. |
| 371 | } |