Saturday, 31 October 2015

How to mod any(?) app for multiwindow



While Wanam does a good job of allowing any app to float it does not allow the app to appear in the multiwindow tool bar (at least for me) and the side by side view that is native to the feature is what I am after.

You will need to know what decompiling an apk means and probably a non android device. Haven't tried on-board apk decompilers since they are lame.

So just as a synopsis of info easily found anyway here is my method -

Copy the app from /data/app/whatever. This will be called base.apk for all non-system apps. I rename it to something sane for the next step, helpful if doing several at a time.

Copy/move to PC

Using your preferred apk decompiler extract the apk. Open AndroidManifest.xml and within the <application> tag add the following:
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow"> </uses-library>
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_ SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_ SIZE_H" android:value="598.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_ SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_ SIZE_H" android:value="598.0dip" />


Then in the main intent filter add
<category android:name="android.intent.category.MULTIWINDOW_ LAUNCHER"/>

So the xml will look similar to this

<application android:icon="@drawable/icon" android:label="@string/app_name" .... OMITTED>
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow"> </uses-library>
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_ SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_ SIZE_H" android:value="598.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_ SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_ SIZE_H" android:value="598.0dip" />
.... OMITTED
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_ LAUNCHER"/>
</intent-filter>
.... OMITTED
</application>

Re-compile, rename to base.apk, replace source base.apk in /data/app/whatever/ with modded version, set permissions (solid explorer does this automagically), reboot.

The app can now be added to the multiwindow bar and used to create a side by side view with other multiwindow aware apps. I've done around 10, Sygic is the only one that won't recompile due to its own issues :p

For me it is useful to have browser/dictionary, file explorer/text editor and other pairs predefined in the multi window panel.



No comments:

Post a Comment