lundi 10 février 2014

Emoji Keyboard for Galaxy Nexus Stock..Work together! topic




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! :D

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


:eek:

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 :good:





1 commentaire:

  1. Thank you for the auspicious writeup. It in fact was
    a amusement account it. Look advanced to
    more added agreeable from you! However, how could we communicate?

    RépondreSupprimer