Wow! Please! Do it again!: August 2012

Friday, August 31, 2012

SGS2 + CM9: GetRIL App

Been running LPX modem for a couple of months now. No noticeable problems as far as I can tell.

Tried the GetRIL app as it was mentioned frequently in the XDA forum. Well, I flashed the Baseband I9100XXLPX manually (it was originally LPW with CM9 Resurrection Edition, if I remember correctly). Anyway, I wouldn't mess with this if it's not broken...

Wednesday, August 29, 2012

SGS2 + CM9: Flash 9.1.0 Release

CM 9.0.0 stable release was in fact, stable. One small issue though, was that it was unable to detect media files under /sdcard/Notifications or /sdcard/Ringtones (requires a reboot in order for it to be selected as a ringtone/notification tone). Edit: CM 9.1.0 release fixed this.

1. Too lazy to create a nandroid backup this time. My last backup was made from CWM Recovery. No more using ROM Manager!
2. Reboot into CWM Recovery. Note: Already copied to internal SD card earlier, and verified MD5 hash too (963f5d56b376dedcaaa55dc3fe967561).
3. install zip from sdcard > choose zip from internal sdcard > > Yes.
4. wipe cache partition.
5. advanced > Wipe Dalvik Cache.
6. reboot system now.

Sunday, August 26, 2012

Thursday, August 16, 2012

SGS2 + CM9: Issue - Unable to detect/play mp3

Bloody 'ell! All of a sudden I heard a "beep" sound from my phone. "That wasn't the notification/ring tone I had set". Then under Settings > Sound, both "Phone ringtone" and "Default notification" showed "Unknown ringtone".

This was after I went in to change the "Default notification", and nothing was checked so I chose "CyanPing".

Checked in WhatsApp > Settings > Notifications > Notification tone, and same thing too

Nothing shown in Apollo. I had a couple of mp3s in /sdcard

Then I checked Google Play Store for any apps to be updated. Although I can't be 100% sure, but I'm pretty sure that ROM Manager's update was the cause (updated earlier in the day). The description for seemed to make sense to me.

ROM Manager - What's New Fix bug that places .nomedia file in the wrong directory if directories are missing. Add Restore ROM Manager feature.

Updated ROM Manager but problem still persists. Rebooted and everything was back to normal again.

Latest and Greatest: Google Maps 6.10.0 Released

Right after updating Google Play Store to 3.8.15, it prompted that the Google Maps app has an update too, but there wasn't an option to "Update", until now! I've exported the APK using ES File Explorer and uploaded it to Google Drive here.

New icon; How about that?

Able to get a lock on GPS in a matter of seconds.

Latest and Greatest: Google Play Store 3.8.15 APK Download

Google Play Store 3.8.15 wasn't updated automatically this time, unlike the previous version 3.7.15

Get it here.

Updates for Maps?

Nope! (Checked numerous times but same outcome)

SGS2 + CM9: Stable Build Battery Life (Overnight)

1. CM9 Stable Build (
2. Stock CM9 Kernel.

Wednesday, August 15, 2012

Web Dev: Spring Security - Create custom implementation of RedirectStrategy

Spring Security has the interface RedirectStrategy for one reason that is pretty obvious, to perform server-side redirects. However, it only comes with one implementation, DefaultRedirectStrategy.

Spring Security may perform server-side redirects for:
  • Session timeout/invalid.
  • Concurrent number of sessions per user exceeded.
  • Authentication success.
  • Authentication failure.
  • Access denied to certain resources.

I have had 2 real life requirements (so far) to create custom implementations for RedirectStrategy:

Case 1:
1. The system I was building had 2 different set of pages (simply put, 2 different sites).
2. One site was for customers and the other for administrators.
3. Each set of pages are protected by their own login page.
4. A different path was used to differentiate which site to display to the user:

  • /contextPath/cust/login.htm
  • /contextPath/admin/login.htm
5. Any redirect from Spring Security should be able to handle both sites (/cust and /admin) gracefully.
6. Session timeout URL is configured to "/login.htm?timeout=1". If configured to "/cust/login.htm?timeout=1" then it won't be able to handle session timeout in the /admin site.
7. Therefore, a custom RedirectStrategy (ServletPathRedirectStrategy) was the ideal place to:
  • From the request URL, detect which site it is coming from. For example, if the original request was "/contextPath/cust/accounts.htm", the site is cust.
  • The ServletPathRedirectStrategy would construct the target URL to be "/contextPath/cust/login.htm?timeout=1".
Case 2:
1. Using Spring Web Flow, JSF 2.1 and PrimeFaces to build a site.
2. More information on JsfRedirectStrategy here.

1. Create subclass of DefaultRedirectStrategy, let's say CustomRedirectStrategy.
2. Copy the implementation from DefaultRedirectStrategy.calculateRedirectUrl to CustomRedirectStrategy. Why? Because calculateRedirectUrl was declared as private!
3. Override the sendRedirect method to fulfill your redirect requirements. Be sure to use calculateRedirectUrl as how it's used in DefaultRedirectStrategy for consistency.
4. Declare your CustomRedirectStrategy (bean name "redirectStrategy") in Spring config (XML or Annotations, I won't go there).
5. Inject "redirectStrategy" into the following beans:

  • concurrentSessionFilter - Existing class has setter for redirectStrategy.
  • invalidSessionStrategy - Unable to inject to SimpleRedirectInvalidSessionStrategy because no setter available (setRedirectStrategy). Just clone the entire SimpleRedirectInvalidSessionStrategy and add the setter.
  • authenticationEntryPoint - Existing implementation declares redirectStrategy as a final attribute. Same drill, copy clone entire class and add the setter.
  • authenticationSuccessHandler - Existing implementations SavedRequestAwareAuthenticationSuccessHandler and SimpleUrlAuthenticationSuccessHandler both have the setter.
  • authenticationFailureHandler - Existing implementations ExceptionMappingAuthenticationFailureHandler and SimpleUrlAuthenticationFailureHandler both have the setter.
  • logoutSuccessHandler - Existing implementation SimpleUrlLogoutSuccessHandler has the setter.
  • Any custom bean that does server-side redirections - For example, hdivFilter?

1. Spring Security 3.1.2
2. Spring Framework 3.1.2
3. JSF Mojarra 2.1.11
4. PrimeFaces 3.4 RC1
5. Spring Web Flow 2.3.1

Web Dev: Spring Security + JSF Ajax redirects

I'm using SWF 2.3.1 (Spring Web Flow) + JSF (Mojarra 2.1.11) + PrimeFaces 3.4 RC1 Spring Security 3.1.2.

1. Upon login, user is presented with a form with a standard commandButton (which is ajax enabled by default)
2. Session timeout is set to 5 minutes in web.xml
3. After 10 minutes (user had to take a dump/leak), user comes back and clicks on the commandButton.

Outcome (actual):
Nothing happens, on screen at least. This is because Spring Security filters would trigger a server side redirect (HTTP Status Code 302), and the ajax client wasn't built to handle such response.

Outcome (expected):
User should be redirected to the login page, and optionally displaying some message like "Sorry, your session has timed out due to inactivity. Please login again."

Create a custom JsfRedirectStrategy (extends It will basically do the following:

1. Check if the current request is an Ajax one.
 * Copied from org.springframework.faces.webflow.JsfAjaxHandler.isAjaxRequestInternal
 * @param request
 * @return
private boolean isAjaxRequest(HttpServletRequest request) {
 String header = request.getHeader("Faces-Request");
 String param = request.getParameter("javax.faces.partial.ajax");
 return ("partial/ajax".equals(header) || "true".equals(param)) ? true : false;
2. If yes, output (spit out) XML, so that the ajax client will perform a server-side redirect.
3. If not, perform server-side redirect as usual (refer to DefaultRedirectStrategy).

Download source for JsfRedirectStrategy here.

Web Dev: PrimeFaces 3.4 ResetInput component

PrimeFaces 3.4 RC1 is out! One of the couple of new features introduced is the ResetInput (p:resetInput) component. It can be found in the PrimeFaces Showcase Labs page as of now, and will be in the Showcase page once 3.4 GA is released. Information on this component can be found there.

Look at the following scenario:
1. There are n number of input fields. All of them are marked as required. All of them are bound to attributes in the backing bean.
2. There is also a commandButton labelled "Reset", which is NOT a typical HTML reset button (<input type="reset"). This commandButton will invoke the backing bean to clear values that are bound by the input fields.
3. Of course, there has to be a "Submit" button.
4. Now enter values for (n - 1) fields. For example, if the form has 5 fields, enter values for 4 fields only.
5. Click "Submit". Validation error occurs because all fields are required.
6. Now click "Reset". All previously entered values are intact. Why?

This is because JSF stores the submitted values in the input components' states. Updating the values in the backing bean would not work. The ResetInput component will clear the states of all editable input components.

Prior to the availability of this feature in PrimeFaces, there's a project titled PrimeFaces Extensions with a component called pe:resetEditableValues that achieves the same result as p:resetInput.

Saturday, August 11, 2012

SGS2 + CM9: Performance Benchmark

1. CM9 Stable (
2. CM9 Stock Kernel.

1. Improved scores in Antutu. Score increases after each run. Runs are spaced out to let device cool down.
2. As always, sub par scores in Quadrant.

Antutu Run #1

Antutu Run #2

Antutu Run #3

Quadrant Run #1

Quadrant Run #2

Quadrant Run #3

SGS2 + CM9: Flash CM9 Stable Release

Been running RC2 since 19th July (about 3 weeks+) and it was really stable. Never had any self shutdown/reboot/freeze at all. Now that the STABLE version is out, time to upgrade...

1. Tried to create backup via ROM Manager, but app hanged. Had to go to Apps > Running and stop the ROM Manager service.
2. Launched ROM Manager again, and this time was able to create a backup successfully.
3. Read about someone having lost APN settings after flashing the stable build. Took backup (screenshots) of existing Maxis 2G Internet and Maxis 3G Internet.
4. Reboot into CWM Recovery (CWM-based Recovery v6.0.0.2). Note: Already copied to internal SD card earlier, and verified MD5 hash too (29e3679cc1387f127731f4dc6bd85d2f).
5. install zip from sdcard > choose zip from internal sdcard > > Yes.
6. wipe cache partition.
7. advanced > Wipe Dalvik Cache.
8. reboot system now.

Been running RC2 for 340 hours (~14 days)


APNs are still intact, and working fine.

SGS2 + CM9: Maxis 2G and 3G Internet APN Settings

Click here for 2G/3G MMS APN Settings.

Maxis 2G Internet

Maxis 3G Internet