Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,734,168 Members 50,617 Now Online
XDA Developers Android and Mobile Development Forum

Emoji Keyboard for Galaxy Nexus Stock..Work together!

Tip us?
 
DocBrown_88
Old
#1  
Junior Member - OP
Thanks Meter 0
Posts: 2
Join Date: Feb 2014
Default Emoji Keyboard for Galaxy Nexus Stock..Work together!

Hi to all! I'm new here but I read xda forum from several months!

So.. my mission is modify a bit the new Google Keyboard KitKat Edition with Emoji and make it compatible for devices with under Android SDK.

I decompiled the APK (v 2.0.19003.893803a) and I found this class:

Code:
..\smali\com\android\inputmethod\keyboard\EmojiPalettesView$EmojiCategory.smali
Then, converted in .java class and detected this code:

Code:
            addShownCategoryId(0x0);
            if((Build.VERSION.SDK_INT > 0x12) || (Build.VERSION.CODENAME.equalsIgnoreCase("KeyLimePie")) || (Build.VERSION.CODENAME.equalsIgnoreCase("KitKat"))) {
                addShownCategoryId(0x1);
                addShownCategoryId(0x2);
                addShownCategoryId(0x3);
                addShownCategoryId(0x4);
                mCurrentCategoryId = Settings.readLastShownEmojiCategoryId(mPrefs, 0x1);
            } else {
                mCurrentCategoryId = Settings.readLastShownEmojiCategoryId(mPrefs, 0x5);
            }
            addShownCategoryId(0x5);
            addShownCategoryId(0x6);
I know that new GK have 7 fragments for Emoji (checked on tablet with 4.4) and the code is pretty clear.
They make a control, if SDK>12 or the version name is "KitKat", then we hide the fragments 1,2,3,4.
As you can see on official Android Developer Page, SDK>12 is equal to say SDK>JELLY_BEAN_MR2, then starts with KITKAT (13).

Let's try to change this value? For example "10 (JELLY_BEAN, 4.1)" ?
I don't know what could be happens, but...i will have to try!

Let's go to smali file, I found my interested code:

Code:
 .line 158
    sget v1, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v2, 0x12        ---> we change it with 0x10

    if-gt v1, v2, :cond_1

    sget-object v1, Landroid/os/Build$VERSION;->CODENAME:Ljava/lang/String;

    const-string v2, "KeyLimePie"

So now, i rebuild all with keytool and additionally i make a bit of modifications:
  1. Android Manifest
    Code:
    changed 
    <provider android:authorities="@string/authority"
    TO
    <provider android:authorities="com.google.android.inputmethod.dictionarypack"
  2. Renamed package name with apktool.yml
    Code:
    rename-manifest-package: com.google.android.inputmethod.latin

Then, opened the built APK and drop in it with WinRar original lib folder and WEB-INF from original APK.
Then, I signed APK with cmd:

Code:
C:\apk\apktool>java -jar SignApk.jar testkey.x509.pem testkey.pk8 c:\apk\apktool
\keyboard\dist\keyboard.apk keyboard_signed.apk
So now..let's try to install the update.....
Code:
New package has a different signature: com.google.android.inputmethod.latin



How to solve? My experience is focused to write my apps but not modifying the others..

Hope that my work helps other and please help me to fix that problem
 
DocBrown_88
Old
#2  
Junior Member - OP
Thanks Meter 0
Posts: 2
Join Date: Feb 2014
is there any possibility to import the key signature from the original APK to modified APK?

I tried to create another APK, with another package name, but Android says that Dictionary Provider is actually used from the original Google Keyboard, it can't continue with installation.

I don't want to remove the original system keyboard app because i want give modified APK to community and i suppose that not all users have phone with root enabled.
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes