mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-28 11:28:38 +00:00
bug 572249 - flush prefs on android app pause r=mwu
This commit is contained in:
parent
6a3f707030
commit
6b76e77b99
@ -151,6 +151,7 @@ abstract public class GeckoApp
|
||||
@Override
|
||||
public void onPause()
|
||||
{
|
||||
GeckoAppShell.sendEventToGecko(new GeckoEvent(GeckoEvent.ACTIVITY_PAUSING));
|
||||
// The user is navigating away from this activity, but nothing
|
||||
// has come to the foreground yet; for Gecko, we may want to
|
||||
// stop repainting, for example.
|
||||
|
@ -64,6 +64,7 @@ public class GeckoEvent {
|
||||
public static final int DRAW = 6;
|
||||
public static final int SIZE_CHANGED = 7;
|
||||
public static final int ACTIVITY_STOPPING = 8;
|
||||
public static final int ACTIVITY_PAUSING = 9;
|
||||
|
||||
public static final int IME_BATCH_END = 0;
|
||||
public static final int IME_BATCH_BEGIN = 1;
|
||||
|
@ -429,6 +429,7 @@ public:
|
||||
DRAW = 6,
|
||||
SIZE_CHANGED = 7,
|
||||
ACTIVITY_STOPPING = 8,
|
||||
ACTIVITY_PAUSING = 9,
|
||||
dummy_java_enum_list_end
|
||||
};
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "nsIAppStartup.h"
|
||||
#include "nsIGeolocationProvider.h"
|
||||
|
||||
#include "mozilla/Services.h"
|
||||
#include "prenv.h"
|
||||
|
||||
#include "AndroidBridge.h"
|
||||
@ -231,12 +232,28 @@ nsAppShell::ProcessNextNativeEvent(PRBool mayWait)
|
||||
break;
|
||||
|
||||
case AndroidGeckoEvent::ACTIVITY_STOPPING: {
|
||||
nsCOMPtr<nsIObserverService> obsServ =
|
||||
mozilla::services::GetObserverService();
|
||||
NS_NAMED_LITERAL_STRING(context, "shutdown-persist");
|
||||
obsServ->NotifyObservers(nsnull, "quit-application-granted", nsnull);
|
||||
obsServ->NotifyObservers(nsnull, "quit-application-forced", nsnull);
|
||||
obsServ->NotifyObservers(nsnull, "quit-application", nsnull);
|
||||
obsServ->NotifyObservers(nsnull, "profile-change-net-teardown", context.get());
|
||||
obsServ->NotifyObservers(nsnull, "profile-change-teardown", context.get());
|
||||
obsServ->NotifyObservers(nsnull, "profile-before-change", context.get());
|
||||
nsCOMPtr<nsIAppStartup> appSvc = do_GetService("@mozilla.org/toolkit/app-startup;1");
|
||||
if (appSvc)
|
||||
appSvc->Quit(nsIAppStartup::eForceQuit);
|
||||
break;
|
||||
}
|
||||
|
||||
case AndroidGeckoEvent::ACTIVITY_PAUSING: {
|
||||
nsCOMPtr<nsIObserverService> obsServ =
|
||||
mozilla::services::GetObserverService();
|
||||
obsServ->NotifyObservers(nsnull, "profile-before-change", nsnull);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
if (target)
|
||||
target->OnAndroidEvent(curEvent);
|
||||
|
Loading…
Reference in New Issue
Block a user