History log of /frameworks/base/core/java/android/os/FileUtils.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
0cce5355b45d835f95a8918b8b803fd977d374e4 26-Nov-2014 Jeff Sharkey <jsharkey@android.com> Sanitize display names, keep extensions intact.

When creating or renaming files on external storage, sanitize the
requested display names to be valid FAT filenames. This also fixes
a handful of directory traversal bugs.

Also relax logic around generating display names to allow any
extension which maps to the requested MIME type. Tests to verify.

Bug: 18512473, 18504132
Change-Id: I89e632019ee145f53d9d9d2050932f8939a756af
/frameworks/base/core/java/android/os/FileUtils.java
d746057f2414cba2bdc69257cc5be8cb681bb592 07-Jul-2014 Jeff Sharkey <jsharkey@android.com> Change new file installs to be cluster-based!

Now that all the other pieces are in place, we're ready to start
installing new file-based packages as a cluster (the new unified
directory-based layout). This greatly simplifies the renaming
process.

Also add helper methods to ApplicationInfo to give a much clearer
mapping between it and internal field names, since we can't change
the public API.

Add recursive restorecon().

Bug: 14975160
Change-Id: I72a63c5ddbc594c2fec4a91dd59f73ef253fbfd7
/frameworks/base/core/java/android/os/FileUtils.java
73767b9d607d99b3a027619b5c6b7f1a09b7673d 05-Jul-2014 Jeff Sharkey <jsharkey@android.com> Extract native code from split APKs.

In the new split APK world, multiple APKs work together to define a
single package. This means that native code may be split among those
APKs. To handle this, extend NativeLibraryHelper to examine all
APKs in a package ordered by splitName.

A package has valid native code as long as one matching ABI is found
inside. The "best" ABI found across all APKs is picked for the
entire package. No attempt is made to ensure that every native
library defined is available for the picked ABI; that's the
responsibility of the installer.

Re-introduce PackageLite to represent a lightweight parsing of an
entire package, which may be a single monolithic APK or a cluster
of one or more APKs.

Remove native code extraction from InstallerSession, since it'll be
handled inside PMS for this release.

Bug: 14975160
Change-Id: I4f4db0f82e88a46101c7777499ebc0a11fd911f9
/frameworks/base/core/java/android/os/FileUtils.java
57dcf5b177b56195421535938544f32d8b591b42 19-Jun-2014 Jeff Sharkey <jsharkey@android.com> Slow progress towards APK clusters.

Differentiate between "split APKs" and "cluster packages". A cluster
package is a directory containing zero or more APKs (base+splits),
and a monolithic package is a single APK (base).

PackageSetting will use the directory name as its codePath, so track
the baseCodePath separately. Clarify documentation in several
places.

Require that all installers provide file:// URIs through existing
hidden APIs; PackageInstaller hasn't been able to read content://
URIs for a long time.

Bug: 14975160
Change-Id: I1c6fed1b55205c2474b09871161a98a26669d22e
/frameworks/base/core/java/android/os/FileUtils.java
3a44f3f1b446315ef894e01d2ab9b5388c2bd8c4 29-Apr-2014 Jeff Sharkey <jsharkey@android.com> Initial support for split APKs, PackageInstaller.

Defines a new PackageInstaller class that will be used for installing
and upgrading packages. An application desiring to install an
application creates a session, stages one or more package files in
that session, and then kicks off the install.

Previously, PackageManager would always make its own copy of a package
before inspecting it, to ensure the data could be trusted. This new
session concept allows the installer to write package data directly to
its final resting place on disk, reducing disk I/O and footprint
requirements. Writes are directed through an intermediate pipe
to ensure we can prevent mutations once an install has been initiated.
Also uses fallocate() internally to support optimal ext4 block
allocation using extents to reduce fragmentation.

Sessions are also the way we support installing multiple "split" APKs
in a single atomic operation. For a set of packages to form a valid
application, they must have exactly the same package name, version
code, and certificates. A session can also be used to add a small
handful of splits to an application by inheriting existing packages
when not performing a full install.

Add PackageParser support for extracting split names and certificates.

Bug: 14975160
Change-Id: I23d1bf4fbeb9f99a8c83be0c458900a0f0d1bccc
/frameworks/base/core/java/android/os/FileUtils.java
4948f0eee8789c85e793965315514975fc07403f 01-May-2014 Narayan Kamath <narayan@google.com> Fix build.

Bad automatic merge by git resulted in a dup. of a function.

Change-Id: Idb8fd8a48e1a9f6aeac98a199d6b8c661efaab16
/frameworks/base/core/java/android/os/FileUtils.java
2e2c7d2325958166eba28499f7bd740ba319f840 01-May-2014 Narayan Kamath <narayan@google.com> am 6af42aea: am 9f34234f: am b916d8ad: Merge "Implement FileUtils#contains."

* commit '6af42aea725c2afd8e5fbff9bc33ba353c05e1a9':
Implement FileUtils#contains.
d6d1dbac3f71a292e071dd3108d8333cb5dae44d 01-May-2014 Narayan Kamath <narayan@google.com> Implement FileUtils#contains.

Partial cherry-pick of changes 4ca728c0 and 21de56a9, which
can't be cherry-picked due to their large surface area.

Change-Id: Ife46e150d360cd5241dea93863141749233c1805
/frameworks/base/core/java/android/os/FileUtils.java
10596fbcce710a76ffc7e917400df13af5c2ebcb 28-Apr-2014 Elliott Hughes <enh@google.com> resolved conflicts for merge of 3ce4f3d0 to master

Change-Id: Id5c5997ad8f801b32e1dbd97413ea42e38c27210
34385d352da19805ae948215e2edbeedd16b7941 28-Apr-2014 Elliott Hughes <enh@google.com> Track libcore.os' move to android.system.

(This is partial, but should cover everything in AOSP master except
for the zygote.)

Change-Id: I1042c99245765746a744c44e714095cb2c6cb75d
/frameworks/base/core/java/android/os/FileUtils.java
21de56a94668e0fda1b8bb4ee4f99a09b40d28fd 06-Apr-2014 Jeff Sharkey <jsharkey@android.com> Add directory selection to DocumentsProvider.

Introduce new ACTION_PICK_DIRECTORY that allows users to grant access
to an entire document subtree. Instead of requiring grants for each
individual document, this leverages new prefix URI permission grants
by defining new "via"-style URIs:

content://com.example/via/12/document/24/

This references document 24 by using a prefix grant given for
document 12. Internally, we use isChildDocument() to enforce that
24 is actually a descendant (child, grandchild, etc) of 12. Since
this is an optional API, providers indicate support with
Root.FLAG_SUPPORTS_DIR_SELECTION.

Extend DocumentsUI to support picking directories. Expose
createDocument() API to work with returned directories.

Offer to canonicalize via-style URIs into direct URIs, generating
exact permission grants along the way. Override openAssetFile()
to pass through CancellationSignal. Move testing code into ApiDemos.

Bug: 10607375
Change-Id: Ifffc1cff878870f8152eb6ca0199c5d014b9cb07
/frameworks/base/core/java/android/os/FileUtils.java
ebf8ad5d91b22eb4359c75711a5b70ddcce0723d 31-Jan-2014 Jeff Sharkey <jsharkey@android.com> Update DrmOutputStream to use raw FileDescriptor.

This allows DownloadManager to use FDs, paving the way for downloading
directly to content:// Uris.

Also return flag indicating if deleteOlderFiles() actually deleted
anything. Update tests to verify.

Bug: 5287571
Change-Id: I2579e5e2113f31b2860d7b021bd61c91b6310963
/frameworks/base/core/java/android/os/FileUtils.java
4ca728c064aeab644f6d044e0285eaa056818b8a 11-Jan-2014 Jeff Sharkey <jsharkey@android.com> Detect removable and emulated secondary storage.

Also rename existing secondary storage API to match naming
convention in rest of class.

Bug: 11536709
Change-Id: I2684c817de4982b414893d2d9927a21e3f171d53
/frameworks/base/core/java/android/os/FileUtils.java
6090995951c6e2e4dcf38102f01793f8a94166e1 19-Nov-2013 John Spurlock <jspurlock@google.com> Remove unused imports from frameworks/base.

Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
/frameworks/base/core/java/android/os/FileUtils.java
5aca2b8dc4f4ff2d466a64587d06666c7bbd9749 17-Oct-2013 Jeff Sharkey <jsharkey@android.com> Plumb through physical device UUID and label.

vold now parse out UUID and label for inserted physical devices,
and reports them to framework. Add these to hidden StorageVolume
class for use by DocumentsUI and MediaProvider.

Remove last JNI method in FileUtils!

Bug: 11175082
Change-Id: I1cfcd1ade61767b103f693319ea2600008ee2e3c
/frameworks/base/core/java/android/os/FileUtils.java
184a0100abc431fc3d6d8dd1b20212b84958cada 11-Jul-2013 Jeff Sharkey <jsharkey@android.com> Allow packages.list access with new GID.

The FUSE daemon is using packages.list to map from package name to
appId after it drops permissions, so create a new "package_info" GID
to grant read access.

Also switches FileUtils to use Libcore.os.

Change-Id: I9451ca4e90e8a985526805c6df0888a244a1db36
/frameworks/base/core/java/android/os/FileUtils.java
053f61d6a6e23825e680dc49982e55c5b4299d61 27-Jun-2013 Dianne Hackborn <hackbod@google.com> Work on issue #9586838: Crash after waking up Hammerhead device

I made the power manager more rigid, not allowing different uids
to use the same wake lock. This never should happen. I would
guess there is somewhere that the activity manager is acquiring
the wake lock without clearing the calling identity... but it is
hard to follow all the paths this may happen in. So here we add
some checks when acquiring/releasing the wake lock to make sure
it is being done as the system uid.

Also:

- Protect the new activity stack calls with a permission, and
make sure to clear the calling uid once past that.
- Collect uid data from process stats so we can correctly
associate CPU use with a uid even if we don't know about the
pid for some reason.
- Fix battery stats dump commands to clear calling uid before
executing so they aren't broken.

Change-Id: I0030d4f7b614e3270d794ecfc3669139a5703ce9
/frameworks/base/core/java/android/os/FileUtils.java
d9526907d1a51ef0b35bfbbeee43fa209d8b5bbf 14-Mar-2013 Jeff Sharkey <jsharkey@android.com> Move deleteOlderFiles() to framework, tests.

Supports both age and count based constraints. Added light docs and
tests to verify behavior.

Bug: 8387555
Change-Id: If4d0dac8bc54ce705c2a339bc09a60ea748728b8
/frameworks/base/core/java/android/os/FileUtils.java
90619816d99154d504a14774c6f2d5f4254ff780 13-Oct-2012 Guang Zhu <guangzhu@google.com> use BufferedInputStream in readTextFile

With FileInputStream, using assumption of bytes read (as
returned by read function) not matching buffer size as EOF is
not correct, we hit this when reading from /proc in some cases.

BufferedInputStream's behavior matches that assumption due to
its implementation.

Bug: 7342759
Change-Id: Ibb06dbe1fbe33f6f880524f7555ff5542889ea50
/frameworks/base/core/java/android/os/FileUtils.java
4c74f8c1713fa82904b10beec4da9ad8ebb97375 17-Aug-2012 Kenny Root <kroot@google.com> Use Libcore.os.umask for setting umask

Libcore.os now provides a umask method call, so just use that since it's
available.

Change-Id: I8826fa40bcab3d61a424ff98a8050d3e44f7ec34
/frameworks/base/core/java/android/os/FileUtils.java
98e15e78934a00cf46f2be55472b7fd7a39ac0de 16-Aug-2012 Kenny Root <kroot@google.com> Use Libcore's stat instead of FileUtils#getFileStatus

Remove the last user of FileUtils#getFileStatus and move it to
Libcore.os.stat instead. Then we can remove the JNI code that does the
equivalent of a stat.

Change-Id: Ieb566a2a8a17c2dd0150724b4eb3ac1cc41c823d
/frameworks/base/core/java/android/os/FileUtils.java
786cbcacd2efbd94476eb05a4d5b77211f20d434 16-Aug-2012 Kenny Root <kroot@google.com> Use Libcore.os.stat instead of FileUtils

PackageManagerService just needed to know the owner for this file, so
just use stat instead so we can remove the old JNI code.

This is the last user of FileUtils#getPermissions so just remove the
FileUtils method as well.

Change-Id: I953057cd6b9de4410f33b6f22e4bddff02fe2988
/frameworks/base/core/java/android/os/FileUtils.java
929b5899a348d2d43f67902f7a807d6660226a64 08-Mar-2012 Jeff Sharkey <jsharkey@android.com> Deprecate some FileUtils, pointing to Os instead.

Change-Id: I5d306784ea924ffd8c32c4768f975190445932a4
/frameworks/base/core/java/android/os/FileUtils.java
1b9a6a6e58fd73b5d1b6a434d17f0a69806858ec 04-Jun-2011 Wink Saville <wink@google.com> resolved conflict for merge of fc51aaec to master

Change-Id: Iee4d9ecc946dd1bbf114a70ad32db0fe47a027df
6d25a990afffd5eb385aba3043d5dfad36f1539a 04-Jun-2011 Wink Saville <wink@google.com> Add FileUtils.checksumCrc32

Change-Id: Ic6bffcb66554d7af38cea68648d9431fda8ef10d
/frameworks/base/core/java/android/os/FileUtils.java
da8bb74b9d9ffcb095815db800d0816c411f1fba 28-May-2011 Mike Lockwood <lockwood@android.com> Move stringToFile utility from ConnectivityService to FileUtils

Change-Id: I59a2dc649d59677f6b5e7ade252587c7c151ec06
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/core/java/android/os/FileUtils.java
4e920f70f38d52d3a74c6a3133388a2e2cb6c175 14-Dec-2010 Brad Fitzpatrick <bradfitz@android.com> Add MODE_MULTI_PROCESS flag to Context.getSharedPreferences()

Also, changes to make this testable with CTS:

-- special PENALTY_DEATH StrictMode fast path that doesn't use
the Looper idling to "time" the violation. Only used when
death is the only violation,

-- make PENALTY_DEATH throw a RuntimeException instead of
killing its process with a signal. this means we can catch
it in CTS tests, but it's also more consistent with
PENALTY_NETWORK_DEATH in Honeycomb.

-- make FileUtils.getFileStatus() invoke StrictMode, which isn't
(yet?) aware of I/O in native code. so help it out.

CTS test for MODE_MULTI_PROCESS is in I6154edab

Change-Id: Icf93f9dfb0ece06b16781e4803dd2c17df3cf1b3
/frameworks/base/core/java/android/os/FileUtils.java
875ecaa511ce36c8044ccdf48ee2a3e69dd633fe 18-Oct-2010 Dianne Hackborn <hackbod@google.com> am 13e46665: am 736f5ec4: Merge "Work on issue #3101415: Crespo apps seem to have their UID changed over time." into gingerbread

Merge commit '13e46665ff69c1a37880762d7d611aacdf02dac7'

* commit '13e46665ff69c1a37880762d7d611aacdf02dac7':
Work on issue #3101415: Crespo apps seem to have their UID changed over time.
8bdf5935c0db4a66ab33a10b43398d2523cfa15d 15-Oct-2010 Dianne Hackborn <hackbod@google.com> Work on issue #3101415: Crespo apps seem to have their UID changed over time.

fsync!

Change-Id: Ie6c5397202579935ac69bf61d3e7b3081ecf269c
/frameworks/base/core/java/android/os/FileUtils.java
90960e87ecae696f73ae18e46c2f003fc3f592cc 06-Aug-2010 Mike Lockwood <lockwood@android.com> Set umask of system server to 0077

This matches the previous behavior of java.io.File file and directory creation.

BUG: 2898660

Change-Id: Ie8978a3fc44abfd22f8046e66742e715354220a8
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/core/java/android/os/FileUtils.java
1afd1c90ebe789b8d3a137004127a50d2db7e3b5 19-Mar-2010 Dianne Hackborn <hackbod@google.com> Maybe fix issue #2457218: Corrupt batterystats.bin file preventing phone boot - LIBtt68127

No steps to repro, but makes the code more robust by using the standard
JournaledFile class and doing sanity checks on the input it reads.

This required moving the JournaledFile class in to the framework (and
we really should get rid of either it or AtomicFile, but they have
different recovery semantics so that is tough). Also went through and
cleaned up the file management in various places.

Change-Id: Ieb7268d8435e77dff66b6e67bb63b62e5dea572e
/frameworks/base/core/java/android/os/FileUtils.java
42471dd5552a346dd82a58a663159875ccc4fb79 08-Jan-2010 Dan Egnor <egnor@google.com> Simplify & update ANR logging; report ANR data into the dropbox.
Eliminate the per-process 200ms timeout during ANR thread-dumping.
Dump all the threads at once, then wait for the file to stabilize.
Seems to work great and is much, much, much faster.

Don't dump stack traces to traces.txt on app crashes (it isn't very
useful and mostly just clutters up the file).

Tweak the formatting of the dropbox dumpsys a bit, for readability,
and avoid running out of memory when dumping large log files.

Report build & kernel version with kernel log dropbox entries.
/frameworks/base/core/java/android/os/FileUtils.java
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/os/FileUtils.java
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/os/FileUtils.java
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/core/java/android/os/FileUtils.java