1

I am in the process of making the corner circles work on hdpi devices. Everything works except pressing the "add" button (long pressing screen as well), and pressing the sorting style button in the app drawer. Both result in a F/c of the launcher. The odd thing is it is working on both my OG Droid as well as my Xoom, but not my Droid Incredible 2.

The Logcat:

     I/ActivityManager(24294): Displayed
     com.sonyericsson.home/.HomeActivity: +1s573ms W/cornerbuttons(26412):
     Customization file not found:
     /etc/customization/settings/com/sonyericsson/home/default_settings_topleftcornerbutton.xml
     W/cornerbuttons(26412): Customization file not found:
     /etc/customization/settings/com/sonyericsson/home/default_settings_toprightcornerbutton.xml
     W/cornerbuttons(26412): Customization file not found:
     /etc/customization/settings/com/sonyericsson/home/default_settings_bottomleftcornerbutton.xml
     W/cornerbuttons(26412): Customization file not found:
     /etc/customization/settings/com/sonyericsson/home/default_settings_bottomrightcornerbutton.xml
     W/app-tray(26412): Customization file not found:
     /etc/customization/settings/com/sonyericsson/home/default_settings_apptray.xml
     I/dalvikvm(26412): Could not find method
     android.app.AlertDialog$Builder.<init>, referenced from method
    com.sonyericsson.home.HomeActivity$AddDialog.createDialog
     D/dalvikvm(26412): VFY: dead code 0x0011-0034 in
     Lcom/sonyericsson/home/HomeActivity$AddDialog;.createDialog
     ()Landroid/app/Dialog; I/ActivityManager(24294): Displayed
     com.sonyericsson.home/.HomeActivity: +1s651ms I/dalvikvm(26442): Could
     not find method android.app.AlertDialog$Builder.<init>, referenced
     from method com.sonyericsson.home.HomeActivity$SortDialog.createDialog
     D/dalvikvm(26442): VFY: dead code 0x0019-0047 in
     Lcom/sonyericsson/home/HomeActivity$SortDialog;.createDialog
     ()Landroid/app/Dialog;
   PS: the f/cs occur even without my modifications  
NovusMobile
  • 1,813
  • 2
  • 21
  • 48
user994079
  • 11
  • 2

1 Answers1

0

When decompiled you'll find that in the createDialog() method of the SortDialog inner class "HomeActivity$SortDialog.smali" is referencing the Util class to find out what theme to decorate the AlertDialogBuilder with.

SMALI :

 .line 2507
    new-instance v0, Landroid/app/AlertDialog$Builder;

    iget-object v2, p0, Lcom/sonyericsson/home/HomeActivity$SortDialog;->this$0:Lcom/sonyericsson/home/HomeActivity;

    iget-object v3, p0, Lcom/sonyericsson/home/HomeActivity$SortDialog;->this$0:Lcom/sonyericsson/home/HomeActivity;

    invoke-virtual {v3}, Lcom/sonyericsson/home/HomeActivity;->getApplicationContext()Landroid/content/Context;

    move-result-object v3

    invoke-static {v3}, Lcom/sonyericsson/home/bidi/Utils;->getDialogAlertThemeStyle(Landroid/content/Context;)I

    move-result v3

    invoke-direct {v0, v2, v3}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;I)V

or in Java

int i = Utils.getDialogAlertThemeStyle(HomeActivity.this.getApplicationContext());

Their Utils class then checks the saved theme in which it is to apply to the SortDialog. Since the theme isn't set (how I don't know?) it returns back an int of 0 or -1 (not sure).

public static final int getDialogAlertThemeStyle(Context paramContext)
  {
    if ((sReflectionOk) && (isRtlAlphabet(paramContext)));
    for (int i = sThemeBidiDialogAlert; ; i = sThemeDialogAlert)
      return i;
  }

  public static final boolean isRtlAlphabet(Context paramContext)
  {
    int i = 0;
    if (sReflectionOk);
    try
    {
      Resources localResources = paramContext.getResources();
      int j = **sRtlAlphabetField**;
      boolean bool = localResources.getBoolean(j);
      i = bool;
      return i;
    }
    catch (Resources.NotFoundException localNotFoundException)
    {
      while (true)
        LogUtil.reportError("Bidi", "Get rtl alphabet resource failed", localNotFoundException);
    }
  }

j is what is being returned and the sRtlAlphabetField was not initialized properly I'm guessing

**sRtlAlphabetField** = Class.forName("com.android.internal.R$bool").getField("alphabet_isRtl").getInt(null);

You see that call above is calling for the resource id of alphabet_isRtl which is found in the Android R.java file of the launcher. It mustn't be getting back a valid resource identifier hence why when the Util method returns -1? or 0 it is unable to create a new instance of the AlertDialog with the given int param. A simple log line to output the value of either i in the HomeActivity$SortDialog or Util class would show you what it's trying to use as the theme value, either way it's probably gumpf.

This may be a long shot but I'm pretty sure that's why this issue is occurring and you'd expect to have this error in the AddToStageDialog, PickActivityDialog, AddDialog and SortDialog "onCreate() methods.

Since they're all calling the same line :

int i = Utils.getDialogAlertThemeStyle(HomeActivity.this.getApplicationContext());

I'm guessing the solution would be to edit the SMALI classes for : AddToStageDialog, PickActivityDialog, AddDialog and SortDialog so that they create an AlertDialog.Builder using the constructor that just takes the context as the parameter.

i.e

AlertDialog.Builder localBuilder1 = new AlertDialog.Builder(localHomeActivity);

That may do it but without the theming part you may be hunting for similar calls like this all over the place.

Good luck!

Edit : I tested this myself and I've got it working, the edited smali code is :

from:

invoke-direct {v0, v2, v3}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;I)V

to:

invoke-direct {v0, v2}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

Do this in the dialog classes I mentioned above and it will solve the problem :)

JavaJedi
  • 399
  • 3
  • 7