Create your own MULTI DPI apks

Toss3

Senior Member
May 13, 2008
2,311
699
0
Stockholm
So thanks goes out to @dagrim1 for his guide on how to create multiDPI apks for Samsung devices (please remember to thank him for his guide and work; this is just a copy and paste job to let people know!):

dagrim1 said:
*** Make samsung system apk multidpi compatible ***
Install APKTool v2
https://ibotpeaches.github.io/Apktool/
Copy Framework-res.apk and twframework-res.apk from framework folder to computer
Install frameworks in apktool using the following commands:
apktool if Framework-res.apk
apktool if twframework-res.apk
Copy relevant apk to folder
Decompile using apktool with the following command:
apktool d <name>.apk -o <name_output_folder>
Edit the dimens.xml file in <name_output_folder>\res\values\ folder (And also the dimens.xml file in <name_output_folder>\res\values-land\ folder if that exists, this contains the landscape mode values)
Change all the values "xxxdip", where xxx is a number, to "yyypx" where yyy is 4 times xxx. So "640dip" would become "2560px"

I created an awk script for this, which uses gawk on windows: replace_xml.awk. First copy the xml file to be edited (%xml_file%) to another location (%xml_copy%)
Next call the awk script on the copy, outputting to the xml file:

gawk -f replace_xml.awk %xml_copy% > %xml_file%
Recompile the apk, keeping the original META-INF content (which can be done because we don't change the manifest.xml file) using the following command:
apktool b <name_output_folder> -o <name_output_apk>

*** Contacts/Dialer & Patching Services.jar***
For the contacts/dialer an extra step has to be taken, that is patching services.jar to skip checks for properly signed files

Copy services.jar from system\framework to computer
Decompile it:
apktool d services.jar -o services_jar
Open services_jar\smali\com\android\server\pm\PackageMa nagerService.smali ( I used notepad++ )
Change the following part (might not be the exact same):
Code:
Code:
.method static compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
			.locals 7
			.parameter "s1"
			.parameter "s2"

			.prologue
			.line 2160
			if-nez p0, :cond_8

			.line 2161
			if-nez p1, :cond_6

			const/4 v6, 0x1

			.line 2180
			:goto_5
			return v6

			.line 2161
			:cond_6
			const/4 v6, -0x1

			goto :goto_5

			.line 2165
			:cond_8
			if-nez p1, :cond_c

			.line 2166
			const/4 v6, -0x2

			goto :goto_5

			.line 2168
			:cond_c
			new-instance v3, Ljava/util/HashSet;

			invoke-direct {v3}, Ljava/util/HashSet;-><init>()V

			.line 2169
			.local v3, set1:Ljava/util/HashSet;,"Ljava/util/HashSet<Landroid/content/pm/Signature;>;"
			move-object v0, p0

			.local v0, arr$:[Landroid/content/pm/Signature;
			array-length v2, v0

			.local v2, len$:I
			const/4 v1, 0x0

			.local v1, i$:I
			:goto_14
			if-ge v1, v2, :cond_1e

			aget-object v5, v0, v1

			.line 2170
			.local v5, sig:Landroid/content/pm/Signature;
			invoke-virtual {v3, v5}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z

			.line 2169
			add-int/lit8 v1, v1, 0x1

			goto :goto_14

			.line 2172
			.end local v5           #sig:Landroid/content/pm/Signature;
			:cond_1e
			new-instance v4, Ljava/util/HashSet;

			invoke-direct {v4}, Ljava/util/HashSet;-><init>()V

			.line 2173
			.local v4, set2:Ljava/util/HashSet;,"Ljava/util/HashSet<Landroid/content/pm/Signature;>;"
			move-object v0, p1

			array-length v2, v0

			const/4 v1, 0x0

			:goto_26
			if-ge v1, v2, :cond_30

			aget-object v5, v0, v1

			.line 2174
			.restart local v5       #sig:Landroid/content/pm/Signature;
			invoke-virtual {v4, v5}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z

			.line 2173
			add-int/lit8 v1, v1, 0x1

			goto :goto_26

			.line 2177
			.end local v5           #sig:Landroid/content/pm/Signature;
			:cond_30
			invoke-virtual {v3, v4}, Ljava/util/HashSet;->equals(Ljava/lang/Object;)Z

			move-result v6

			if-eqz v6, :cond_38

			.line 2178
			const/4 v6, 0x0

			goto :goto_5

			.line 2180
			:cond_38
			const/4 v6, -0x3

			goto :goto_5
		.end method
TO:

Code:
Code:
.method static compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
			.locals 7

			const/4 v0, 0x0

			return v0
		.end method
Recompile the edited folder
apktool b services_jar -o services.jar
For the rest check out the ORIGINAL THREAD (remember to use b instead of c when compiling the final apk)

I have added two MultiDPI apks below that are compatible with 5.1.1 COH4 n910c deodexed (specifically with WanamLite Clean Stock).

1. Backup the old files (/system/app/SamsungCamera3/SamsungCamera3.apk AND /system/priv-app/SecContacts_Note/SecContacts_Note.apk)
2. Extract the archives and replace the original files in their original locations with the extracted ones
3. Change the permissions of the apks to rw-r--r-- (root explorer is handy)
4. Reboot

Also added the modded services.jar if someone needs it.
 

Attachments

Last edited:

seavers11

Senior Member
May 11, 2007
1,948
229
0
The camera and contacts are already multidpi? Can i use on odexed rom too?

Gesendet von meinem SM-N910F mit Tapatalk
 

crazykiddo

Senior Member
Sep 30, 2010
662
419
0
41
Manila
www.crazykiddo.net
Funny in manifest It has this : <supports-screens android:anyDensity="true" android:normalScreens="true"/>

---------- Post added at 02:35 PM ---------- Previous post was at 01:43 PM ----------

All working now, issues with other camera versions (that installed to system)
I'm now working on adjusting gallery thumbnail and mode text/icon alignment

Will post updates

---------- Post added at 03:27 PM ---------- Previous post was at 02:35 PM ----------

Still no luck with adjusting the gallery frame and mode titles etc.
but all works good so far.
 

crazykiddo

Senior Member
Sep 30, 2010
662
419
0
41
Manila
www.crazykiddo.net
Here is my modded version of the posted one.
=================
CHANGELOG
=================
v9
- remove frame from gallery thumbnail
- adjusted modes title color and position
- homemade mode indicator

=================
NOTES
=================
Remember this is my version on density 480

=================
INSTALL
=================
1. Goto /system/app/SamsungCamera3/
2. Delete SamsungCamera3.apk
2b. Goto /system/app/SamsungCamera3/arm/
2c. Delete SamsungCamera3.odex
3. copy SamsungCamera3v9.apk to /system/app/SamsungCamera3/
4. Rename SamsungCamera3v9.apk to SamsungCamera3.apk
5. Set permissions to 644
6. Reboot

Attached is the latest version and screenshots
Tested on my note 4 5.1.1 with no found issues yet.

=================
ISSUES/BUGS
=================
- downloaded modes thumbnails are big/missing etc.
- modes title are black (will be changed to white)
- padding on modes list needs adjustments
- dual cam list also needs adjustments
 

Attachments

Last edited:
  • Like
Reactions: seavers11