<div dir="ltr">I needed unmounting because if I started service again previous container was still mounted. I found that the problem was content provider, which held process and mounted container alive.<div>Now I just kill process on service onDestroy method and everything is fine... no need to unmount. Thanks for helping me ;)</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Mar 6, 2017 at 11:51 AM Hans-Christoph Steiner <<a href="mailto:hans@guardianproject.info">hans@guardianproject.info</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="gmail_msg">
If your Services are indeed totally separate processes then the<br class="gmail_msg">
unmounting shouldn't be needed really.  Unmounting is really only needed<br class="gmail_msg">
to zero the password from memory.  A regular Android Service is not in a<br class="gmail_msg">
separate process, you have to have `android:process=":service"` in the<br class="gmail_msg">
<service> block in AndroidManifest.xml<br class="gmail_msg">
<br class="gmail_msg">
.hc<br class="gmail_msg">
<br class="gmail_msg">
zoki:<br class="gmail_msg">
> I tried that (discussion above) but I have a problem:<br class="gmail_msg">
> <a href="https://www.pastiebin.com/58b942a5c304b" rel="noreferrer" class="gmail_msg" target="_blank">https://www.pastiebin.com/58b942a5c304b</a><br class="gmail_msg">
><br class="gmail_msg">
> - I start a service (in different process than app) where I create or mount<br class="gmail_msg">
> an iocipher container. I'm playing files from it and when I'm done I detach<br class="gmail_msg">
> all threads and unmount container (snippet below) and stop service<br class="gmail_msg">
> (stopSelf; onDestroy on service is called).<br class="gmail_msg">
> - When I start again I see that service is created again (onCreate in<br class="gmail_msg">
> service is called) and I repeat a process same as before (iocipher<br class="gmail_msg">
> container is mounted, reading from container for playing, when done detach<br class="gmail_msg">
> all threads and unmount and stopService....)<br class="gmail_msg">
> - After repeating that 4 or 5 times I get a crash (log is above)<br class="gmail_msg">
><br class="gmail_msg">
> I have more thread because I two schedulers.<br class="gmail_msg">
><br class="gmail_msg">
> I detach threads like this (there are always 3 or 4 active threads):<br class="gmail_msg">
><br class="gmail_msg">
> int i = 8;<br class="gmail_msg">
> VirtualFileSystem vfs = VirtualFileSystem.get();<br class="gmail_msg">
> while (i > 0 && vfs.isMounted()) {<br class="gmail_msg">
>     try {<br class="gmail_msg">
>         vfs.unmount();<br class="gmail_msg">
>     } catch (IllegalStateException e) {<br class="gmail_msg">
>         vfs.detachThread();<br class="gmail_msg">
>     }<br class="gmail_msg">
>     i--;<br class="gmail_msg">
> }<br class="gmail_msg">
><br class="gmail_msg">
> Unmount on the end is always successful, but is this the correct way of<br class="gmail_msg">
> unmounting container? Can be problem here?<br class="gmail_msg">
><br class="gmail_msg">
> For playback I'm using custom content provider (<br class="gmail_msg">
> <a href="https://github.com/n8fr8/CameraCipher/blob/master/src/info/guardianproject/iocipher/camera/io/IOCipherContentProvider.java" rel="noreferrer" class="gmail_msg" target="_blank">https://github.com/n8fr8/CameraCipher/blob/master/src/info/guardianproject/iocipher/camera/io/IOCipherContentProvider.java</a>).<br class="gmail_msg">
> Can be problem somewhere here that pipe is not closed? How could I check<br class="gmail_msg">
> this?<br class="gmail_msg">
><br class="gmail_msg">
> I would be very glad if someone could point me to any direction where to<br class="gmail_msg">
> check for errors why is this crashing. Thanks!<br class="gmail_msg">
><br class="gmail_msg">
> On Fri, Feb 10, 2017 at 12:21 PM zoki <<a href="mailto:zoran.smilevski@gmail.com" class="gmail_msg" target="_blank">zoran.smilevski@gmail.com</a>> wrote:<br class="gmail_msg">
><br class="gmail_msg">
>> Thanks.<br class="gmail_msg">
>> Service and provider in another process looks like a way to go. Will try<br class="gmail_msg">
>> that.<br class="gmail_msg">
>><br class="gmail_msg">
>> On Fri, 10 Feb 2017, 11:16 Hans-Christoph Steiner, <<br class="gmail_msg">
>> <a href="mailto:hans@guardianproject.info" class="gmail_msg" target="_blank">hans@guardianproject.info</a>> wrote:<br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
>> hey Zoki,<br class="gmail_msg">
>><br class="gmail_msg">
>> It is theoretically possible to use multiple containers, but it is not<br class="gmail_msg">
>> well tested and it is not the use case we have in mind for it.  IOCipher<br class="gmail_msg">
>> is designed around the idea of having a single file system that is<br class="gmail_msg">
>> dedicated to the app.  It was not really designed to be general purpose<br class="gmail_msg">
>> "containers".  That said, there is no technical limitation that would<br class="gmail_msg">
>> prevent IOCipher from handling multiple containers.  Its mostly a<br class="gmail_msg">
>> question of how to design a good API for that.  IOCipher uses<br class="gmail_msg">
>> java.io.File as the API, there is no way to specify which container to<br class="gmail_msg">
>> use in that API.  Having a global "switch container" method seems like a<br class="gmail_msg">
>> recipe for many super confusing bugs.<br class="gmail_msg">
>><br class="gmail_msg">
>> I think starting a Service in its own process for each container would<br class="gmail_msg">
>> be the best way to do that with IOCipher as it is now.<br class="gmail_msg">
>><br class="gmail_msg">
>> .hc<br class="gmail_msg">
>><br class="gmail_msg">
>> zoki:<br class="gmail_msg">
>>> Hello, I have few questions regarding using multiple iocipher containers.<br class="gmail_msg">
>>> Is it possible to use multiple containers at the same time? Or at least<br class="gmail_msg">
>>> easy switching between them?<br class="gmail_msg">
>>> I don't know how to use them because VirtualFileSystem is singleton. I<br class="gmail_msg">
>>> guess that has some purpose, can someone please explain why?<br class="gmail_msg">
>>><br class="gmail_msg">
>>> Now with new ExoPlayer which has support for playing from content<br class="gmail_msg">
>> provider<br class="gmail_msg">
>>> is very easy to play videos from secure container. I'm thinking to use<br class="gmail_msg">
>>> another container for caching video files, because it's easier to delete<br class="gmail_msg">
>>> container files and free storage rather than doing container shrinking.<br class="gmail_msg">
>>> Would I need to start new process for that?<br class="gmail_msg">
>>><br class="gmail_msg">
>>> Thanks for any help :)<br class="gmail_msg">
>>><br class="gmail_msg">
>>><br class="gmail_msg">
>>><br class="gmail_msg">
>>> _______________________________________________<br class="gmail_msg">
>>> List info: <a href="https://lists.mayfirst.org/mailman/listinfo/guardian-dev" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.mayfirst.org/mailman/listinfo/guardian-dev</a><br class="gmail_msg">
>>> To unsubscribe, email:  <a href="mailto:guardian-dev-unsubscribe@lists.mayfirst.org" class="gmail_msg" target="_blank">guardian-dev-unsubscribe@lists.mayfirst.org</a><br class="gmail_msg">
>>><br class="gmail_msg">
>><br class="gmail_msg">
>> --<br class="gmail_msg">
>> PGP fingerprint: EE66 20C7 136B 0D2C 456C  0A4D E9E2 8DEA 00AA 5556<br class="gmail_msg">
>> <a href="https://pgp.mit.edu/pks/lookup?op=vindex&search=0xE9E28DEA00AA5556" rel="noreferrer" class="gmail_msg" target="_blank">https://pgp.mit.edu/pks/lookup?op=vindex&search=0xE9E28DEA00AA5556</a><br class="gmail_msg">
>> _______________________________________________<br class="gmail_msg">
>> List info: <a href="https://lists.mayfirst.org/mailman/listinfo/guardian-dev" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.mayfirst.org/mailman/listinfo/guardian-dev</a><br class="gmail_msg">
>> To unsubscribe, email:  <a href="mailto:guardian-dev-unsubscribe@lists.mayfirst.org" class="gmail_msg" target="_blank">guardian-dev-unsubscribe@lists.mayfirst.org</a><br class="gmail_msg">
>><br class="gmail_msg">
>><br class="gmail_msg">
><br class="gmail_msg">
<br class="gmail_msg">
--<br class="gmail_msg">
PGP fingerprint: EE66 20C7 136B 0D2C 456C  0A4D E9E2 8DEA 00AA 5556<br class="gmail_msg">
<a href="https://pgp.mit.edu/pks/lookup?op=vindex&search=0xE9E28DEA00AA5556" rel="noreferrer" class="gmail_msg" target="_blank">https://pgp.mit.edu/pks/lookup?op=vindex&search=0xE9E28DEA00AA5556</a><br class="gmail_msg">
</blockquote></div>