Re: [android-developers] Re: Double press home button side effect...

2011-03-21 Thread Justin Anderson
Ok, thanks for this info... I'll try this to reproduce the issue.  I have
2.2 installed on my device and have never come across this, but now that I
know what is going on I may be able to reproduce this.

So, in short, there is nothing that can be done to help with this?

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Sat, Mar 19, 2011 at 10:21 AM, Kevin TeslaCoil Software <
ke...@teslacoilsw.com> wrote:

> Android gives priority to the default Home application, to prevent it
> from being removed from memory. Launchers require lots of memory.
> Without this protection there is a good chance the actual launcher
> will be killed and need to reload, which is slow and the user sees the
> widgets redraw on the screen. Also it might lose any cache it had
> which could make the app drawer load slower.
>
> In practice, I've found that this method worked okay on 2.1 for
> whatever reason. But with Android 2.2+ it doesn't. I imagine you'll be
> able to reproduce the problem if you use a 2.2 device, set AppSwipe!
> as the default Home, reboot (rearranges things in memory a bit), then
> start using lots of memory-heavy apps like the browser, angry birds,
> etc, then when you press the Home button after some time away look for
> widgets redrawing.
>
> I believe 2.3 neuters "System Persistent" as well.
>
> Good luck!
> -Kevin
>
> > I have an task switching app on the Android Market called AppSwipe!
> > and one of the most commonly requested features is the ability to
> > launch my app by long-pressing the home button.  Since this is not
> > possible, I created a way to launch AppSwipe! by double-pressing the
> > home key.
> >
> > This feature has been out for over a year and my users love it.
> > However, I recently received an email from one user who was reporting
> > some strange behavior when using this functionality... essentially,
> > the home app is getting killed and taking a long time to restart.
> > When this occurs there are some other UI issues as well (such as
> > folders launching with transparent backgrounds and such).  It only
> > happens on very specific devices and I can't reproduce the problem.
> >
> > Here is the general process that I am using to implement the double-
> > press of the home button:
> >
> > 1) I created an activity that declares itself as a home replacement
> > app (see XML below)
> >
> > 2) I have a user-modifiable setting that allows the user to specify
> > which home app to launch from the home button.
> >
> > 3) When the home button is pressed, my "home replacement" activity has
> > the following logic:
> >
> > a) The first time the home button is pressed a timer is
> > created and started in onResume()
> >
> > b) If the timer finishes, then the user-specified home app is
> > launched
> >
> > c) If home is pressed again and the timer is still running,
> > then I cancel the timer and launch my app
> >
> > Here is the XML that declares my "home replacement" app:
> >
> >  > android:theme="@android:style/Theme.Translucent.NoTitleBar"
> > android:name=".HomeLauncherActivity"
> > android:label="@string/app_home_launcher_label"
> > android:launchMode="singleInstance"
> > android:stateNotNeeded="true"
> >
> > 
> > 
> > 
> >  />
> > 
> > 
> >
> > Here is the onResume() method that runs the timer:
> >
> > @Override
> > public void onResume()
> > {
> > super.onResume();
> >
> > if (m_prefMgr == null)
> > m_prefMgr =
> PreferenceManager.getDefaultSharedPreferences(this);
> >
> > if (m_pkgMgr == null)
> > m_pkgMgr = getPackageManager();
> >
> > //First Home Button Press
> > if (m_timer == null)
> > {
> > int launchThreshold =
> >
> m_prefMgr.getInt(getString(R.string.pref_button_launch_home_click_threshold
> _key),
> >
> PrefSettings.DEFAULT_DOUBLE_PRESS_HOME_THRESHOLD);
> >
> > m_timer = new AppSwipeHomeLaunchTimer(launchThreshold,
> > launchThreshold);
> > m_timer.start();
> > }
> > else //Second Home Button Press
> > {
> > m_timer.cancel();
> > m_timer = null;
> >
> > boolean swapHomePress =
> >
> m_prefMgr.getBoolean(getString(R.string.pref_button_launch_swap_buttons_key
> ),
> >
> PrefSettings.DEFAULT_SWAP_HOME_BUTTON_BEHAVIOR);
> > if (swapHomePress)
> > launchHomeApp();
> > else
> > launchAppSwipe();
> > }
> >
> > }
> >
> > Here is the code for my launchHomeApp() method:
> >
> > public void launchHomeApp()
> > {
> > try
> > {
> > String pkgName =
> >
> m_prefMgr.getString(getString(R.string.pref_button_launch_default_home_app_
> pkg_key),
> > "");
> > String className =
> >
> m_prefMgr.ge

[android-developers] Re: Double press home button side effect...

2011-03-19 Thread Kevin TeslaCoil Software
Android gives priority to the default Home application, to prevent it
from being removed from memory. Launchers require lots of memory.
Without this protection there is a good chance the actual launcher
will be killed and need to reload, which is slow and the user sees the
widgets redraw on the screen. Also it might lose any cache it had
which could make the app drawer load slower.

In practice, I've found that this method worked okay on 2.1 for
whatever reason. But with Android 2.2+ it doesn't. I imagine you'll be
able to reproduce the problem if you use a 2.2 device, set AppSwipe!
as the default Home, reboot (rearranges things in memory a bit), then
start using lots of memory-heavy apps like the browser, angry birds,
etc, then when you press the Home button after some time away look for
widgets redrawing.

I believe 2.3 neuters "System Persistent" as well.

Good luck!
-Kevin

> I have an task switching app on the Android Market called AppSwipe!
> and one of the most commonly requested features is the ability to
> launch my app by long-pressing the home button.  Since this is not
> possible, I created a way to launch AppSwipe! by double-pressing the
> home key.
>
> This feature has been out for over a year and my users love it.
> However, I recently received an email from one user who was reporting
> some strange behavior when using this functionality... essentially,
> the home app is getting killed and taking a long time to restart.
> When this occurs there are some other UI issues as well (such as
> folders launching with transparent backgrounds and such).  It only
> happens on very specific devices and I can't reproduce the problem.
>
> Here is the general process that I am using to implement the double-
> press of the home button:
>
> 1) I created an activity that declares itself as a home replacement
> app (see XML below)
>
> 2) I have a user-modifiable setting that allows the user to specify
> which home app to launch from the home button.
>
> 3) When the home button is pressed, my "home replacement" activity has
> the following logic:
>
>         a) The first time the home button is pressed a timer is
> created and started in onResume()
>
>         b) If the timer finishes, then the user-specified home app is
> launched
>
>         c) If home is pressed again and the timer is still running,
> then I cancel the timer and launch my app
>
> Here is the XML that declares my "home replacement" app:
>
>          android:theme="@android:style/Theme.Translucent.NoTitleBar"
>         android:name=".HomeLauncherActivity"
>         android:label="@string/app_home_launcher_label"
>         android:launchMode="singleInstance"
>         android:stateNotNeeded="true"
>
>         
>                 
>                 
>                 
>         
> 
>
> Here is the onResume() method that runs the timer:
>
> @Override
> public void onResume()
> {
>         super.onResume();
>
>         if (m_prefMgr == null)
>                 m_prefMgr = 
> PreferenceManager.getDefaultSharedPreferences(this);
>
>         if (m_pkgMgr == null)
>                 m_pkgMgr = getPackageManager();
>
>         //First Home Button Press
>         if (m_timer == null)
>         {
>                 int launchThreshold =
> m_prefMgr.getInt(getString(R.string.pref_button_launch_home_click_threshold 
> _key),
>                                                           
> PrefSettings.DEFAULT_DOUBLE_PRESS_HOME_THRESHOLD);
>
>                 m_timer = new AppSwipeHomeLaunchTimer(launchThreshold,
> launchThreshold);
>                 m_timer.start();
>         }
>         else //Second Home Button Press
>         {
>                 m_timer.cancel();
>                 m_timer = null;
>
>                 boolean swapHomePress =
> m_prefMgr.getBoolean(getString(R.string.pref_button_launch_swap_buttons_key ),
>                                                                 
> PrefSettings.DEFAULT_SWAP_HOME_BUTTON_BEHAVIOR);
>                 if (swapHomePress)
>                         launchHomeApp();
>                 else
>                         launchAppSwipe();
>         }
>
> }
>
> Here is the code for my launchHomeApp() method:
>
> public void launchHomeApp()
> {
>         try
>         {
>                 String pkgName =
> m_prefMgr.getString(getString(R.string.pref_button_launch_default_home_app_ 
> pkg_key),
> "");
>                 String className =
> m_prefMgr.getString(getString(R.string.pref_button_launch_default_home_app_ 
> class_key),
> "");
>
>                 Intent launchIntent = new Intent(Intent.ACTION_MAIN);
>                 launchIntent.addCategory(Intent.CATEGORY_HOME);
>                 launchIntent.setComponent(new ComponentName(pkgName, 
> className));
>                 launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
>
>                 startActivity(launchIntent);
>                 finish();
>         }
>         catch(ActivityNotFoundException e)
>         {
>                 launchAppSettings(R.string.erro