Commit graph

788 commits

Author SHA1 Message Date
Paul Lawrence
6bfed20c77 When encryption fails, reboot into recovery
Set flag on starting encryption to say it failed, and only clear
when we get into a recoverable state (partially or fully encrypted.)

Go to recovery on seeing this flag on boot

Bug: 16552363
Change-Id: I7e452b653edf3a087ecfaba8f81f41765a1c8daf
2014-08-07 13:14:35 -07:00
JP Abgrall
422bdb7e49 fstrim: prep for supporting a deep trim ioctl
This adds an "fstrim dodtrim" command which will attempt to use
the FIDTRIM ioctl() if FIDTRIM is defined in the uapi/linux/fs.h.
If not, it will fail with EINVAL.

If no FIDTRIM is defined, it does not affect the "fstrim dotrim".

Change-Id: Icbfd621abb592b170db06f749e5eedfd1175f723
2014-07-29 15:39:06 -07:00
Cylen Yao
33c29d6ede Fix failure erasing SD in Factory reset
Initialize mIsDecrypted to prevent from formatting SD failure

Change-Id: I30851e6b01b0999bf0b8c1e4b8e3f3a976a41ad1
Signed-off-by: Cylen Yao <cylen.yao@mediatek.com>
(cherry picked from commit 5dbcbd03149af50db42dadeebf565333ce399182)
2014-07-25 20:30:53 +00:00
JP Abgrall
40b64a6841 vold: support "volume list [broadcast]" command
Sometimes when an sdcard is already mounted,
some info like uuid and label are not re-broadcast to new listeners.
The extra argument to list allows late listeners to catch up by asking
volume list to broadcast that info again.

Bug: 16253597
Bug: 16306775
Change-Id: Ie7d0c1132c22d307a5b2a0e50075a3716138d00b
Signed-off-by: Benson Huang <benson.huang@mediatek.com>
(cherry picked from commit 85f4700f44170b772697e627b3075dcb9137e1b7)
2014-07-25 01:46:26 +00:00
Daniel Rosenberg
e068a491c2 Fat.cpp: Tuned FAT parameters according to SD Association recommendations.
Updated cluster size to be 32k, and aligned the starting cluster of the root
directory to be cluster aligned.

Change-Id: I759997569f7a0263a076cc462b235a6cf54e0c5f
Signed-off-by: Daniel Rosenberg <drosen@google.com>
2014-07-15 17:07:55 -07:00
Bogdan George Stefan
1a89e8b60e Enable SD card format
When an SD card has no MBR it cannot be formatted
and then mounted by Android. This is because
the device node was incremented by one by mistake
when building the device path

Change-Id: I8533c6028151fe28246e74f89a294c1e58e79438
Signed-off-by: Bogdan George Stefan <bogdan.g.stefan@intel.com>
2014-06-30 15:53:31 +03:00
Elliott Hughes
231bdba012 Fix an accidental PRId64 to PRIx64.
Change-Id: Ic5313289d826bac74c3466b33f1f167a8f0955ad
2014-06-25 18:36:19 -07:00
Elliott Hughes
cb33f5741c resolved conflicts for merge of afa60cee to master
Change-Id: I1568def8839bed4d4d2dadbd97194d5603edc627
2014-06-25 18:31:47 -07:00
Elliott Hughes
afa60cee41 am c0c28675: Merge "Fix vold %lld to PRId64."
* commit 'c0c2867518eed4539444434c95fad8185a6ac08e':
  Fix vold %lld to PRId64.
2014-06-26 00:37:45 +00:00
Elliott Hughes
c0c2867518 Merge "Fix vold %lld to PRId64." 2014-06-25 17:34:34 +00:00
Elliott Hughes
7373716c6d Fix vold %lld to PRId64.
Change-Id: I6eb9f21fff124b8b22f4fae2ac74c2b41d93b384
2014-06-25 17:27:42 -07:00
JP Abgrall
62c7af38f2 cryptfs: makefs F2FS if the partition type is F2FS.
When a crypto is enabled with a wipe flag (obsolete?),
it will correctly handle the fstab's choice for the fs type.

Remove the dead code for FAT_FS which was un-invocable.

Change-Id: I8d141a0d4d14df9fe84d3b131484e9696fcd8870
Signed-off-by: JP Abgrall <jpa@google.com>
2014-06-16 13:01:23 -07:00
Daniel Rosenberg
e9196fecbb Increase asec image size for reflecting ext4 reserved clusters
From Shawn Heo's patch:

Ext4 introduced reserved clusters to prevent costly zeroout, or
unexpected ENOSPC. The size is 2% or 4096 clusters, whichever
is smaller (http://lwn.net/Articles/546473/).

So, we need to allocate additionally this amount of free space
to asecs when vold create asec images. This is required when
Android runs on Linux kernel 3.10 or later.

see: https://android-review.git.corp.google.com/#/c/96160

Change-Id: Iacff16b8cf0314493c355fa741bcfa519f744d6c
Signed-off-by: Daniel Rosenberg <drosen@google.com>
2014-06-11 00:50:53 +00:00
Daniel Rosenberg
fcd34a0ddd Added support for ext4 ASEC resizing.
ASECs formatted as ext4 can now be resized using vdc asec resize.
Refactored some common code.
Requires resize2fs.

Change-Id: Ie78bb6015114a7bc4af42b16d1f299322ffc1e2a
Signed-off-by: Daniel Rosenberg <drosen@google.com>
2014-06-10 22:15:33 +00:00
Paul Lawrence
73d7a02dc6 On low power turn off rather than rebooting to allow device to charge
The code was using encrypted_upto == 0 as an indicator that encryption
has succeeded. This meant that if no encryption happened, we would reboot
continually.

We now set encrypted_upto to fs_size when encryption is complete.

Also don't start to encrypt unless we are at 10% power. Stop when we
get to 5% power. This should lead to partial encryptions only very
rarely.

Bug: 15513202
Change-Id: I6214d78579d1fbbe2f63ee8862473d86a89d29b3
2014-06-09 15:15:32 -07:00
The Android Automerger
cba4ab2aeb am df293f14: merge in master-release history after reset to b31f33b5e4
* commit 'df293f14f5bdb4f572c7f836ebb0802a177836ff':
  Fix encryption on Nakasi
2014-06-06 15:42:06 +00:00
Dan Albert
9c7a5826ec am ea256025: am 45faade2: Merge "Replaces uses of index() with strchr()."
* commit 'ea256025669f4a5dd8c59e4c70ec7154a198be48':
  Replaces uses of index() with strchr().
2014-06-05 20:33:07 +00:00
Dan Albert
ea25602566 am 45faade2: Merge "Replaces uses of index() with strchr()."
* commit '45faade28ae9e245e7c611c26990254aba006d2a':
  Replaces uses of index() with strchr().
2014-06-05 20:29:33 +00:00
Dan Albert
45faade28a Merge "Replaces uses of index() with strchr()." 2014-06-05 19:56:04 +00:00
Paul Lawrence
a96d9c9b38 Calculate time to go while encrypting
@bug 15159008

Change-Id: I6a96eeab180dceb0613202ba5d252036a0d5376f
2014-06-05 19:44:57 +00:00
Paul Lawrence
58c58cf7ef Show correct percentage when encrypting used blocks only
Bug: 12975202
Change-Id: I7e4adfa2c4951055bbb2c11986a7784f465f586f
2014-06-05 19:44:07 +00:00
Dan Albert
dd58c430b3 Replaces uses of index() with strchr().
Bionic is removing index() because it was removed from POSIX 2008.

Change-Id: I704fb8962ff2c08b8f12245d2db2118d410826b0
2014-06-05 11:44:40 -07:00
Daniel Rosenberg
6a74dcaa6e Fixed bugs with ASEC filesystem.
Changed ext4 to be 4kb aligned, and fat to be 32kb aligned.
Fixed issue that could potentially cause unencrypted ext4
ASECS to overwrite the ASEC super block when filled.

Change-Id: I890426c82ac9cbc65add85a8e3f5063504193c31
Signed-off-by: Daniel Rosenberg <drosen@google.com>
2014-05-28 23:23:47 +00:00
JP Abgrall
12e36398b5 am 099b20f3: am 1881395b: am c6752b06: Merge "vold: wildcard support for device path matching"
* commit '099b20f3ce42a49ba49a1a70a818047ea59612ad':
  vold: wildcard support for device path matching
2014-05-27 19:28:07 +00:00
JP Abgrall
099b20f3ce am 1881395b: am c6752b06: Merge "vold: wildcard support for device path matching"
* commit '1881395b696017dfb40a01e718cc8dc2ea7a38e9':
  vold: wildcard support for device path matching
2014-05-27 19:24:03 +00:00
JP Abgrall
1881395b69 am c6752b06: Merge "vold: wildcard support for device path matching"
* commit 'c6752b06987207bd69b12ad1feadd358e296d52e':
  vold: wildcard support for device path matching
2014-05-27 19:21:48 +00:00
JP Abgrall
c6752b0698 Merge "vold: wildcard support for device path matching" 2014-05-27 19:19:32 +00:00
The Android Automerger
df293f14f5 merge in master-release history after reset to b31f33b5e4 2014-05-22 07:22:42 -07:00
The Android Automerger
be320c8db9 merge in master-release history after reset to b31f33b5e4 2014-05-22 05:51:14 -07:00
The Android Automerger
da0b1a9f63 merge in master-release history after reset to b31f33b5e4 2014-05-21 05:51:09 -07:00
The Android Automerger
88c25e48da merge in master-release history after reset to b31f33b5e4 2014-05-20 05:51:25 -07:00
The Android Automerger
dee8b2372f merge in master-release history after reset to b31f33b5e4 2014-05-19 05:50:25 -07:00
The Android Automerger
6b6bc5f2e8 merge in master-release history after reset to b31f33b5e4 2014-05-18 05:50:13 -07:00
The Android Automerger
5b1d492d26 merge in master-release history after reset to b31f33b5e4 2014-05-17 05:51:52 -07:00
Cylen Yao
b31f33b5e4 Support non-sequential partition index
Add support for the storage with non-sequential partition index
Ex: if using  extended partition, the index of the partition will be greater than 5

[toddpoynor@google.com: fixup mPendingPartCount data type]
Change-Id: I5dbc870fbaac24045f5b994fcb899d5df73c6a55
2014-05-16 13:15:27 -07:00
Todd Poynor
89ec37fcdd Updates for BatteryProperty 64-bit property values
Change-Id: I4838d384e14a7c2c0b607c0bd693e9c7bef75fb7
2014-05-16 03:06:10 +00:00
The Android Automerger
92bd5a7fd1 merge in master-release history after reset to 8c00839714 2014-05-15 05:51:29 -07:00
Cylen Yao
27cfee3fa4 avoid fs_mkdirs when SD card removed
Must limit vold calls to fs_mkdirs() only when the volume is mounted.
If NOT, it will trigger selinux warning as follows.
audit(1398835637.785:8): avc:  denied  { write } for  pid=137 comm="vold" name="sdcard0" dev="rootfs" ino=3191 scontext=u:r:vold:s0 tcontext=u:object_r:rootfs:s0 tclass=dir

Change-Id: I1113fc961cbdd8bbd2fcbf740c2f504628c8399d
Signed-off-by: Cylen Yao <cylen.yao@mediatek.com>
2014-05-14 20:42:13 -07:00
The Android Automerger
c53713bc5d merge in master-release history after reset to 8c00839714 2014-05-14 05:51:48 -07:00
The Android Automerger
e630fcdf93 merge in master-release history after reset to 8c00839714 2014-05-13 05:51:16 -07:00
The Android Automerger
e619817e83 merge in master-release history after reset to 8c00839714 2014-05-12 05:50:20 -07:00
The Android Automerger
ddf384dae6 merge in master-release history after reset to 8c00839714 2014-05-11 05:50:08 -07:00
The Android Automerger
d80416001c merge in master-release history after reset to 8c00839714 2014-05-10 05:51:27 -07:00
The Android Automerger
a62481c8c7 merge in master-release history after reset to 8c00839714 2014-05-08 05:51:02 -07:00
Paul Lawrence
a8014507b0 Fix encryption on Nakasi
We need to make sure we don't try to read the flags on keymaster
version 2 or below, or we get random junk.

Requires
  https://googleplex-android-review.git.corp.google.com/#/c/460689/

Bug: 14384714
Change-Id: I5a4ede1bec0347b8319cedaae6535201c122cf48
2014-05-07 11:47:02 -07:00
Paul Lawrence
8c00839714 Fix encryption on Nakasi
We need to make sure we don't try to read the flags on keymaster
version 2 or below, or we get random junk.

Requires
  https://googleplex-android-review.git.corp.google.com/#/c/460689/

Bug: 14384714
Change-Id: I5a4ede1bec0347b8319cedaae6535201c122cf48
2014-05-06 22:16:16 +00:00
Octavian Purdila
46c301c03e vold: wildcard support for device path matching
Switching the kernel to the new sysfs layout (unselecting
CONFIG_SYSFS_DEPRECATED) complicates VolD block device recognition.

The uevents are reporting full specific paths, such as:

/devices/pci0000:0e/0000:0e:18.0/mmc_host/mmc0/mmc0:1234/block/mmcblk0

Because the full device path may contain variable IDs (in this MMC
case "1234") using full path entries in fstab does not work. Android
supports partial matches but only as a prefix at the beginning of the
path.

This patch adds support for matching shell wildcard patterns via
fnmatch(). The prefix matching rule is preserved, but if it is
detected a warning is issued.

Change-Id: Ia0c5eddec06bd71bec6ce838be3b5345278e0bab
Author:    Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: Radu Moisan <radu.moisan@intel.com>
Signed-off-by: Jim Bride <jim.bride@intel.com>
Reviewed-by: Bergeron, Michael <michael.bergeron@intel.com>
Tested-by: Uyyala, Sridhar <sridhar.uyyala@intel.com>
Reviewed-by: Leung, Daniel <daniel.leung@intel.com>
Reviewed-by: Uyyala, Sridhar <sridhar.uyyala@intel.com>
2014-05-05 18:23:27 +03:00
JP Abgrall
8ee0410a4d am 2d3c0c05: am a821d50b: am 470f0b3f: Merge "Avoid segv by checking argc in "storage user <mountpoint>""
* commit '2d3c0c05e9cce7bad6afd3ceacca85b297367894':
2014-04-30 12:50:51 +00:00
Nick Kralevich
2c4963a816 am a7a612bf: am 15c3e01e: am 3c0d02aa: Merge "Convert all selinux_android_restorecon and _setfilecon calls to new API."
* commit 'a7a612bf9b302962908f709ccc27a781356ac73b':
2014-04-30 12:50:50 +00:00
Mark Salyzyn
86abdc4c8c am 598fdf7a: am 3d9b98cc: am 1dc1fb4a: Merge "vold: suppress unused argument warning messages"
* commit '598fdf7abe087a3f45b5ab0c932ad339b2e5bb4a':
2014-04-30 12:50:50 +00:00