Bug 873072 - Launching settings from Android system notification crashes if Gecko has been killed. r=sriram

This commit is contained in:
Chenxia Liu 2013-06-13 18:58:26 -07:00
parent 7975741305
commit 32ae6cd6c6
2 changed files with 18 additions and 2 deletions

View File

@ -44,8 +44,9 @@ public class DataReportingNotification {
if ((!dataPrefs.contains(PREFS_POLICY_NOTIFIED_TIME)) || if ((!dataPrefs.contains(PREFS_POLICY_NOTIFIED_TIME)) ||
(DATA_REPORTING_VERSION != dataPrefs.getInt(PREFS_POLICY_VERSION, -1))) { (DATA_REPORTING_VERSION != dataPrefs.getInt(PREFS_POLICY_VERSION, -1))) {
// Launch Data Choices fragment when notification is clicked. // Launch main App to launch Data choices when notification is clicked.
Intent prefIntent = new Intent(context, GeckoPreferences.class); Intent prefIntent = new Intent(GeckoApp.ACTION_LAUNCH_SETTINGS);
prefIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, AppConstants.BROWSER_INTENT_CLASS);
// Build launch intent based on Android version. // Build launch intent based on Android version.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {

View File

@ -145,6 +145,7 @@ abstract public class GeckoApp
public static final String ACTION_DEBUG = "org.mozilla.gecko.DEBUG"; public static final String ACTION_DEBUG = "org.mozilla.gecko.DEBUG";
public static final String ACTION_BOOKMARK = "org.mozilla.gecko.BOOKMARK"; public static final String ACTION_BOOKMARK = "org.mozilla.gecko.BOOKMARK";
public static final String ACTION_LOAD = "org.mozilla.gecko.LOAD"; public static final String ACTION_LOAD = "org.mozilla.gecko.LOAD";
public static final String ACTION_LAUNCH_SETTINGS = "org.mozilla.gecko.SETTINGS";
public static final String ACTION_INIT_PW = "org.mozilla.gecko.INIT_PW"; public static final String ACTION_INIT_PW = "org.mozilla.gecko.INIT_PW";
public static final String SAVED_STATE_IN_BACKGROUND = "inBackground"; public static final String SAVED_STATE_IN_BACKGROUND = "inBackground";
public static final String SAVED_STATE_PRIVATE_SESSION = "privateSession"; public static final String SAVED_STATE_PRIVATE_SESSION = "privateSession";
@ -1434,6 +1435,14 @@ abstract public class GeckoApp
}, 1000 * 5 /* 5 seconds */); }, 1000 * 5 /* 5 seconds */);
} }
// Check if launched from data reporting notification.
if (ACTION_LAUNCH_SETTINGS.equals(action)) {
Intent settingsIntent = new Intent(GeckoApp.sAppContext, GeckoPreferences.class);
// Copy extras.
settingsIntent.putExtras(intent);
startActivity(settingsIntent);
}
//app state callbacks //app state callbacks
mAppStateListeners = new LinkedList<GeckoAppShell.AppStateListener>(); mAppStateListeners = new LinkedList<GeckoAppShell.AppStateListener>();
@ -1783,6 +1792,12 @@ abstract public class GeckoApp
GeckoAppShell.sendEventToGecko(GeckoEvent.createURILoadEvent(uri)); GeckoAppShell.sendEventToGecko(GeckoEvent.createURILoadEvent(uri));
} else if (ACTION_ALERT_CALLBACK.equals(action)) { } else if (ACTION_ALERT_CALLBACK.equals(action)) {
processAlertCallback(intent); processAlertCallback(intent);
} if (ACTION_LAUNCH_SETTINGS.equals(action)) {
// Check if launched from data reporting notification.
Intent settingsIntent = new Intent(GeckoApp.sAppContext, GeckoPreferences.class);
// Copy extras.
settingsIntent.putExtras(intent);
startActivity(settingsIntent);
} }
} }