My goal is to launch web browser when I press the HOME key *when* phone is already at home page.

Since this is hard (for me anyway), my first shot is to modify the HOME key long-press behavior so that it will launch the web browser.

Thanks to Fei Zhang, who has correctly pointed me to the PhoneWindowManager.java file, I am able to locate the right place and inject the code to launch browser. See the code snippet below.

Unfortunately, it does not work. If I do long-press twice, the whole UI interface resets (re-starting from flickering "ANDROID" logo). Does anybody have any ideas? I'd really appreciate.

My device is ADP1. My tree is donut branch. My build host is FC11.

Cheers.

Jun

--------------------
PhoneWindowManager.java:

...

    Runnable mHomeLongPress = new Runnable() {
        public void run() {
            /*
* Eat the longpress so it won't dismiss the recent apps dialog when
             * the user lets go of the home key
             */
            mHomePressed = false;
performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false);
            sendCloseSystemWindows(SYSTEM_DIALOG_REASON_RECENT_APPS);
            showRecentAppsDialog();
        }
    };

    void showRecentAppsDialog() {
        /* [jsun] */
mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://m.google.com/";)));
        /*
        if (mRecentAppsDialog == null) {
            mRecentAppsDialog = new RecentApplicationsDialog(mContext);
        }
        mRecentAppsDialog.show();
        */
    }

--
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting

Reply via email to