diff options
author | Jeff Sharkey <jsharkey@android.com> | 2014-09-06 12:20:37 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2014-09-08 09:31:49 -0700 |
commit | 77d218e1869e69c8d436b09cd11dcfe45e50b2cf (patch) | |
tree | 300bdb350c3927fea1651edea80b03b9535201d2 /core/java/android/os | |
parent | 5341f94a191ae57b138f97cd516842bcf04c0609 (diff) | |
download | frameworks_base-77d218e1869e69c8d436b09cd11dcfe45e50b2cf.zip frameworks_base-77d218e1869e69c8d436b09cd11dcfe45e50b2cf.tar.gz frameworks_base-77d218e1869e69c8d436b09cd11dcfe45e50b2cf.tar.bz2 |
Delayed ASEC allocation, refine progress handling.
For restore use-case, session creation needs to complete quickly, so
delay ASEC allocation until session is opened. When preflighting
size checks, only consider external when we have a known size for the
container. Also relax size checks when using MODE_INHERIT_EXISTING
on external, since we don't know how much of existing app will be
copied over.
Consider session as "active" while commit is ongoing, until we're
either finished or pending user interaction.
Always publish first client needle movement away from 0. Use 25% of
internal progress to reflect ASEC allocation.
Avoid CloseGuard messages about leaking PFDs.
Bug: 17405741, 17402982
Change-Id: I6247a1d335d26621549c701c4c4575a8d16ef8c2
Diffstat (limited to 'core/java/android/os')
-rw-r--r-- | core/java/android/os/FileBridge.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/core/java/android/os/FileBridge.java b/core/java/android/os/FileBridge.java index 022a106..0acf24b 100644 --- a/core/java/android/os/FileBridge.java +++ b/core/java/android/os/FileBridge.java @@ -75,6 +75,13 @@ public class FileBridge extends Thread { return mClosed; } + public void forceClose() { + IoUtils.closeQuietly(mTarget); + IoUtils.closeQuietly(mServer); + IoUtils.closeQuietly(mClient); + mClosed = true; + } + public void setTargetFile(FileDescriptor target) { mTarget = target; } @@ -89,7 +96,6 @@ public class FileBridge extends Thread { try { while (IoBridge.read(mServer, temp, 0, MSG_LENGTH) == MSG_LENGTH) { final int cmd = Memory.peekInt(temp, 0, ByteOrder.BIG_ENDIAN); - if (cmd == CMD_WRITE) { // Shuttle data into local file int len = Memory.peekInt(temp, 4, ByteOrder.BIG_ENDIAN); @@ -118,15 +124,10 @@ public class FileBridge extends Thread { } } - } catch (ErrnoException e) { - Log.wtf(TAG, "Failed during bridge", e); - } catch (IOException e) { + } catch (ErrnoException | IOException e) { Log.wtf(TAG, "Failed during bridge", e); } finally { - IoUtils.closeQuietly(mTarget); - IoUtils.closeQuietly(mServer); - IoUtils.closeQuietly(mClient); - mClosed = true; + forceClose(); } } @@ -151,6 +152,7 @@ public class FileBridge extends Thread { writeCommandAndBlock(CMD_CLOSE, "close()"); } finally { IoBridge.closeAndSignalBlockedThreads(mClient); + IoUtils.closeQuietly(mClientPfd); } } |