[Galaxy S II Android Development] levone1:
[MENTION=5405448]thereassaad[/MENTION] [MENTION=3065070]Goldie[/MENTION] etc...

Any help with this -

Trying to port a lockscreen clock widget from a Sony Xz2 to my XCompact. Fortunately, someone else already ported it to the X, so I just pulled files from that SystemUI. I copied all res and smali files, compiled and decompiled, and converted public ids. There's only one layout xml and no drawable xmls, but one drawable png, plus a few anims, and interpolators. It seems like everything is in place, and the new widget shows up in the menu as a lockscreen clock option, but when I try to apply it, SystemUI crashes. Logcat shows an error in line 6 of the layout xml, (...inflateexception, error inflating view...). The line calls on a smali file called 'SecondHand'. The clock is a circle shape with a floating dot that goes around the circle, counting the seconds. I have read up some on inflateexception error, and found that it is common with oversized pngs, causing an out-of-memory error, and with certain coding technicalities in xml. I have replaced the one png, and modified the xml in many ways, but no change. I'm far from an expert, but I have a feeling the problem is in the SecondHand smali file.

Here's the unmodified layout code, (line 6 in red):

<?xml version="1.0" encoding="utf-8"?>
<com.sonymobile.keyguard.plugin.sonyclockloops.SonyClockLoops android:layout_gravity="center" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.sonymobile.keyguard.SomcKeyguardClockScaleContainer android:id="@id/somc_keyguard_clockplugin_scale_container" android:layout_width="wrap_content" android:layout_height="wrap_content">
<RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content">
[COLOR="red"]<com.sonymobile.keyguard.plugin.sonyclockloops.SecondHand[/COLOR] android:id="@id/somc_sony_clock_loops_second_hand" android:tag="main_clock" android:layout_width="120.0dip" android:layout_height="120.0dip" android:layout_centerHorizontal="true" />
<LinearLayout android:orientation="vertical" android:paddingTop="3.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true">
<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
<LinearLayout android:orientation="horizontal" android:id="@id/somc_sony_clock_loops_clock_hour_and_minute" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layoutDirection="ltr">
<TextView android:textSize="66.0dip" android:id="@id/somc_sony_clock_loops_clock_hour" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="5.0dip" android:importantForAccessibility="no" android:fontFamily="x-sst-light" />
<TextView android:textSize="66.0dip" android:id="@id/somc_sony_clock_loops_clock_separator" android:layout_width="wrap_content" android:layout_height="wrap_content" android:importantForAccessibility="no" android:fontFamily="x-sst-light" />
<TextView android:textSize="66.0dip" android:id="@id/somc_sony_clock_loops_clock_minute" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="5.0dip" android:importantForAccessibility="no" android:fontFamily="x-sst-light" />
</LinearLayout>
<TextView android:textSize="16.0dip" android:id="@id/somc_sony_clock_loops_ampm" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="24.0dip" android:fontFamily="sans-serif-medium" android:layout_toEndOf="@id/somc_sony_clock_loops_clock_hour_and_minute" />
</RelativeLayout>
<TextView android:textSize="16.0dip" android:layout_gravity="center_horizontal" android:id="@id/somc_sony_clock_loops_date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="-6.0dip" android:fontFamily="sans-serif-medium" android:letterSpacing="0.0" />
<TextView android:textSize="14.0dip" android:layout_gravity="center_horizontal" android:id="@id/somc_sony_clock_loops_alarm" android:visibility="invisible" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="2.0dip" android:drawablePadding="6.0dip" android:drawableStart="@drawable/somc_digital_clock_alarm_icon" android:fontFamily="sans-serif" android:letterSpacing="0.0" />
</LinearLayout>
</RelativeLayout>
</com.sonymobile.keyguard.SomcKeyguardClockScaleContainer>
</com.sonymobile.keyguard.plugin.sonyclockloops.SonyClockLoops>

Or https://pastebin.com/ZjuWviQa

Here's the SecondHand smali - https://pastebin.com/AxBNvAHa

If the full logcat would help, glad to post it. I jus have modified my smalis for experimentation, so I can't replicate it right this second, but could easily get it back...

Thanks for any input.

- Update - here's the crash log:

10-23 16:14:26.708 E/AndroidRuntime(12866): FATAL EXCEPTION: main
10-23 16:14:26.708 E/AndroidRuntime(12866): Process: com.android.systemui, PID: 12866
10-23 16:14:26.708 E/AndroidRuntime(12866): android.view.InflateException: Binary XML file line #6: Binary XML file line #6: Error inflating class com.sonymobile.keyguard.plugin.sonyclockloops.SecondHand
10-23 16:14:26.708 E/AndroidRuntime(12866): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class com.sonymobile.keyguard.plugin.sonyclockloops.SecondHand
10-23 16:14:26.708 E/AndroidRuntime(12866): Caused by: java.lang.reflect.InvocationTargetException
10-23 16:14:26.708 E/AndroidRuntime(12866):	at java.lang.reflect.Constructor.newInstance0(Native Method)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at android.view.LayoutInflater.createView(LayoutInflater.java:647)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.sonymobile.keyguard.plugin.sonyclockloops.SonyClockLoopsKeyguardComponentFactory.createKeyguardClockPreviewView(SonyClockLoopsKeyguardComponentFactory.java:29)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.sonymobile.keyguard.clock.picker.ClockPickerController.createClockView(ClockPickerController.java:486)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.sonymobile.keyguard.clock.picker.ClockItem.initView(ClockItem.java:68)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.sonymobile.keyguard.clock.picker.ClockItem.initWithClock(ClockItem.java:61)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.sonymobile.keyguard.clock.picker.ClockPickerView.addClock(ClockPickerView.java:294)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.sonymobile.keyguard.clock.picker.ClockPickerView.createViews(ClockPickerView.java:213)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.sonymobile.keyguard.clock.picker.ClockPickerView.initPages(ClockPickerView.java:156)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.sonymobile.keyguard.clock.picker.ClockPickerController.createClockPickerView(ClockPickerController.java:281)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.sonymobile.keyguard.clock.picker.ClockPickerController.displayClockPickerView(ClockPickerController.java:267)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.sonymobile.keyguard.clock.picker.ClockPickerController.startClockPicker(ClockPickerController.java:95)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.sonymobile.systemui.lockscreen.LockscreenClockController.displayClockPluginPicker(LockscreenClockController.java:104)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.sonymobile.keyguard.clock.picker.StartClockPickerTouchListener.startPicker(StartClockPickerTouchListener.java:177)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.sonymobile.keyguard.clock.picker.StartClockPickerTouchListener.-wrap1(Unknown Source:0)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.sonymobile.keyguard.clock.picker.StartClockPickerTouchListener$LongPressCompletedRunnable.run(StartClockPickerTouchListener.java:217)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at android.os.Handler.handleCallback(Handler.java:789)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at android.os.Handler.dispatchMessage(Handler.java:98)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at android.os.Looper.loop(Looper.java:251)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at android.app.ActivityThread.main(ActivityThread.java:6589)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at java.lang.reflect.Method.invoke(Native Method)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
10-23 16:14:26.708 E/AndroidRuntime(12866): Caused by: java.lang.IllegalArgumentException: Unsupported dependency class com.sonymobile.systemui.lockscreen.LockscreenLoopsController
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.android.systemui.Dependency.createDependency(Dependency.java:333)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.android.systemui.Dependency.getDependencyInner(Dependency.java:320)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.android.systemui.Dependency.getDependency(Dependency.java:309)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.android.systemui.Dependency.get(Dependency.java:381)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.sonymobile.keyguard.plugin.sonyclockloops.SecondHand.<init>(SecondHand.java:180)
10-23 16:14:26.708 E/AndroidRuntime(12866):	at com.sonymobile.keyguard.plugin.sonyclockloops.SecondHand.<init>(SecondHand.java:144)
10-23 16:14:26.708 E/AndroidRuntime(12866): 34 more...