summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2013-09-25 21:43:43 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-09-25 21:43:44 +0000
commit82b05f599bf3c84e53d42599ef257b3e9642855d (patch)
tree0c070ef2c7af23031f9ad0ea2e45f4688ebe4826
parente7d6bbd67fbf50fdff87d1bee67e3410904867c5 (diff)
parent6a20e574116af1072782c1e87cb03eb33f05ec50 (diff)
downloadframeworks_base-82b05f599bf3c84e53d42599ef257b3e9642855d.zip
frameworks_base-82b05f599bf3c84e53d42599ef257b3e9642855d.tar.gz
frameworks_base-82b05f599bf3c84e53d42599ef257b3e9642855d.tar.bz2
Merge "Handle null stacks gracefully." into klp-dev
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java4
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/RecentsCreateFragment.java3
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/model/DurableUtils.java1
3 files changed, 5 insertions, 3 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java b/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java
index 8d55ec4..ca9bea4 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java
@@ -295,14 +295,14 @@ public class DocumentsActivity extends Activity {
.query(RecentsProvider.buildResume(packageName), null, null, null, null);
try {
if (cursor.moveToFirst()) {
+ mExternal = cursor.getInt(cursor.getColumnIndex(ResumeColumns.EXTERNAL)) != 0;
final byte[] rawStack = cursor.getBlob(
cursor.getColumnIndex(ResumeColumns.STACK));
DurableUtils.readFromArray(rawStack, mState.stack);
mRestoredStack = true;
- mExternal = cursor.getInt(cursor.getColumnIndex(ResumeColumns.EXTERNAL)) != 0;
}
} catch (IOException e) {
- Log.w(TAG, "Failed to resume", e);
+ Log.w(TAG, "Failed to resume: " + e);
} finally {
IoUtils.closeQuietly(cursor);
}
diff --git a/packages/DocumentsUI/src/com/android/documentsui/RecentsCreateFragment.java b/packages/DocumentsUI/src/com/android/documentsui/RecentsCreateFragment.java
index 670d5c0..c975382 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/RecentsCreateFragment.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/RecentsCreateFragment.java
@@ -48,6 +48,7 @@ import android.widget.TextView;
import com.android.documentsui.DocumentsActivity.State;
import com.android.documentsui.RecentsProvider.RecentColumns;
import com.android.documentsui.model.DocumentStack;
+import com.android.documentsui.model.DurableUtils;
import com.android.documentsui.model.RootInfo;
import com.google.android.collect.Lists;
@@ -160,7 +161,7 @@ public class RecentsCreateFragment extends Fragment {
cursor.getColumnIndex(RecentColumns.STACK));
try {
final DocumentStack stack = new DocumentStack();
- stack.read(new DataInputStream(new ByteArrayInputStream(rawStack)));
+ DurableUtils.readFromArray(rawStack, stack);
// Only update root here to avoid spinning up all
// providers; we update the stack during the actual
diff --git a/packages/DocumentsUI/src/com/android/documentsui/model/DurableUtils.java b/packages/DocumentsUI/src/com/android/documentsui/model/DurableUtils.java
index 214fb14..2a29cbc 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/model/DurableUtils.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/model/DurableUtils.java
@@ -36,6 +36,7 @@ public class DurableUtils {
}
public static <D extends Durable> D readFromArray(byte[] data, D d) throws IOException {
+ if (data == null) throw new IOException("Missing data");
final ByteArrayInputStream in = new ByteArrayInputStream(data);
d.reset();
try {