fredag den 16. oktober 2015

FreeOTP icon fix on Android

This guide is a workaround for:
https://fedorahosted.org/freeotp/ticket/51

How to backup your FreeOTP tokens is described in this ticket.
To backup your tokens run:
adb backup -f freeotp.bak org.fedorahosted.freeotp

Next we need to extract the backup to edit it. (How to extract the backup)

First run this command:
dd if=freeotp.bak bs=24 skip=1 | openssl zlib -d > freeotp.tar
OR
java -jar abe.jar unpack freeotp.bak freeotp.tar <password>

Then extract the tar archive and the list of files in the tar archive:
tar -tf freeotp.tar > freeotp.list
tar -xvf freeotp.tar

Now edit apps/org.fedorahosted.freeotp/sp/tokens.xml
Look for a string like this:
content://com.google.android.apps.photos.contentprovider/-1/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F<unique number>/ACTUAL/<SOME NUMBER>

Change it to:
content://media/external/images/media/<unique number>
The number <unique number> should be replaced with the actual number in your string.

Now pack the updated file:
cat freeotp.list | pax -wd > freeotp.tar
java -jar abe.jar pack freeotp.tar freeotp2.bak

Then restore the backup
adb restore freeotp2.bak