[Android Apps and Games] Tsjoklat:
This is a modified version of Gmail that fixes the database permissions of Gmail so third party notification widgets (such as Missed It!, Go Notification, and Pure Messenger Widget) can determine which emails are read and which emails are unread for a true unread email count.

diff -ru Gmail.org/AndroidManifest.xml Gmail/AndroidManifest.xml
--- Gmail.org/AndroidManifest.xml	2011-08-02 22:49:48.356157842 +0200
+++ Gmail/AndroidManifest.xml	2011-08-02 22:52:05.603773155 +0200
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest android:versionCode="169" android:versionName="2.3.5" package="com.google.android.gm"
xmlns:android="http://schemas.android.com/apk/res/android">
- <permission android:label="@string/read_perm_label" android:name="com.google.android.gm.permission.READ_GMAIL" android:protectionLevel="signature" android:permissionGroup="android.permission-group.MESSAGES" android:description="@string/read_perm_desc" />
- <permission android:label="@string/write_perm_label" android:name="com.google.android.gm.permission.WRITE_GMAIL" android:protectionLevel="signature" android:permissionGroup="android.permission-group.MESSAGES" android:description="@string/write_perm_desc" />
- <permission android:label="@string/auto_send_perm_label" android:name="com.google.android.gm.permission.AUTO_SEND" android:protectionLevel="signature" android:permissionGroup="android.permission-group.MESSAGES" android:description="@string/auto_send_perm_desc" />
+ <permission android:label="@string/read_perm_label" android:name="com.google.android.gm.permission.READ_GMAIL" android:protectionLevel="normal" android:permissionGroup="android.permission-group.MESSAGES" android:description="@string/read_perm_desc" />
+ <permission android:label="@string/write_perm_label" android:name="com.google.android.gm.permission.WRITE_GMAIL" android:protectionLevel="normal" android:permissionGroup="android.permission-group.MESSAGES" android:description="@string/write_perm_desc" />
+ <permission android:label="@string/auto_send_perm_label" android:name="com.google.android.gm.permission.AUTO_SEND" android:protectionLevel="normal" android:permissionGroup="android.permission-group.MESSAGES" android:description="@string/auto_send_perm_desc" />
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" android:maxSdkVersion="10" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />

Requirements:

a) Your device does not come preinstalled with gmail so the original version can be completely uninstalled first before installing the modified version. After uninstalling original version of Gmail, install modified Gmail.apk as normal by running it.

OR

b) If you have root and your device has Gmail preinstalled in /system/app/Gmail.apk, then you have two choices. Either remove /system/app/Gmail.apk and install the modified version of Gmail normally by running the apk (to /data/app/Gmail.apk) OR replace /system/app/Gmail.apk with the modified version of Gmail. It is probably easier to remove Gmail.apk from the system partition and install it as a normal user application in /data/app/. However you want to do it..Gmail will install as a system or data application. To save space, I would not have it installed in both places.

Note: To simplify the installation of Gmail to the system partition for S-ON devices, I have added Gmail in a recovery flashable zip file format. This method requires busybox to be installed on your device. Make sure you uninstall any Gmail updates first, if possible. This method is only recommended if you have Gmail preinstalled to /system/app/Gmail.apk and you want to replace it with the modified version.

Note: After initially replacing or reinstalling Gmail with the modfied version, the notification widget (ie; Go Notification, Missed It!, or Pure Messenger Widget) needs to be reinstalled to regain premissions.

Note: Gmail 2.x is for Gingerbread. Gmail 3.x is for Honeycomb. Gmail 4.x is for ICS (but version 4.0.1 and 4.0.2 are reported working in Honeycomb too). At the time of this writing, ICS and Honeycomb support is limited. AFAIK, Pure Messenger Widget is the only third party notification widget that supports the ICS/Honeycomb Gmail protocol. Hopefully, more third party notification widgets will add support for ICS/Honeycomb in the future.

Updating from previous modified version of Gmail:

If you already have an older modified version of Gmail installed, the newer modified version of Gmail can be installed on top to perform the update. No need to remove the previously installed modified version of Gmail first.

Sources:

The latest versions of Gmail for ICS/Honeycomb are extracted from firmware from: http://www.sammobile.com/firmware/

Process:

1) Download latest Firmware from link above.

2) Extract files (this process requires linux)

a) Unzip or Unrar accordingly with samsung password (usually it is "samfirmware.com")

b) Extract again (tar -xf filename.tar.md5)

c) Extract again the largest file (a file.tar.md5 that is ~900MB) from the previous extraction. The largest file that is extracted contains the necessary system files. The system files can be found in two formats (system.rfs or factoryfs.img).

3) Process for reading system.rfs format (if system.rfs does not exist, skip to step #4)

a) Mount system.rfs using the following commands:

mkdir ~/tempdir
sudo losetup /dev/loop0 ./system.rfs
sudo mount -t vfat /dev/loop0 ~/tempdir

b) Copy necessary files to a writable location:

mkdir ~/workspace
cp -a ~/tempdir/system/framework ~/workspace/
cp -a ~/tempdir/system/apps ~/workspace/

c) Unmount and clean up

sudo umount /dev/loop0
sudo losetup -a
sudo losetup -d /dev/loop0

4) Process for reading factoryfs.img

a) Build ext4_utils from the following post: http://xdaforums.com/showthread.php?t=1081239

b) Convert factoryfs.img to readable format with simg2img utility found in ext4_utils

simg2img factoryfs.img output.img

c) Mount output.img

mkdir ~/tempdir; sudo mount -o loop output.img ~/tempdir

d) Copy necessary files to a writable location:

mkdir ~/workspace
cp -a ~/tempdir/system/framework ~/workspace/
cp -a ~/tempdir/system/apps ~/workspace/

e) Unmount and clean up

sudo umount /dev/loop0

5) Creating classes.dex from Gmail.odex

a) Copy Gmail.odex into new framework directory from firmware image

cp ~/workspace/app/Gmail.odex ~/workspace/framework/
cd ~/workspace/framework/

b) Decompile odex file (api-level must be set accordingly) http://code.google.com/p/smali/

baksmali --api-levl 14 -x Gmail.odex

c) Compile output into classes.dex (api-level must be set accordingly)

smali --api-level 14 -o classes.dex out

6) Insert classes.dex into Gmail.apk

cp ~/workspace/app/Gmail.apk ~/workspace/framework/
mv Gmail.apk Gmail.zip
zip Gmail.zip -d META-INF/*
zip -o Gmail.zip classes.dex
mv Gmail.zip Gmail.apk

7) Decompile Gmail.apk with apktool (at the time of this writing it is apktool v1.4.3) http://code.google.com/p/android-apktool/

apktool d Gmail.apk

8) Edit AndroidManifest.xml (replacing "signature" with "normal"). See patch above for details.

9) Compile modified version of Gmail with apktool.

apktool b Gmail Gmail.mod.apk

Note: The current released version of apktool (1.4.3) will not be able to compile the resources for the new ICS api. Therefore, you will have to go into the res directory and delete all the resource directories that cause errors within apktool. After you delete those directories, you will see that apktool will also start showing errors in public.xml because resources are now missing. You will have to edit public.xml and delete the lines that show up as errors when compiling with apktool. Once you get the Gmail.mod.apk to build, extract the apk with unzip tool (unzip Gmail.mod.apk) and copy the extracted AndroidManifest.xml (in binary form) into an unaltered Gmail.apk that includes classes.dex. Rename original Gmail.apk to a zip file and insert the modified AndroidManifest.xml, then rename zip back to apk.

10) Sign Gmail with test keys:

java -jar /usr/local/bin/signapk.jar /usr/local/bin/testkey.x509.pem /usr/local/bin/testkey.pk8 Gmail.apk Gmail.mod-signed.apk