Bug 853366 - Some minor code cleanup. r=cpeterson

This commit is contained in:
Kartikaya Gupta 2013-03-26 14:04:20 -04:00
parent eb4ed1625c
commit 3664b3dbd0
2 changed files with 8 additions and 14 deletions

View File

@ -54,27 +54,24 @@ public class GeckoActivity extends Activity implements GeckoActivityStatus {
@Override
public void startActivity(Intent intent) {
checkIfGeckoActivity(intent);
mGeckoActivityOpened = checkIfGeckoActivity(intent);
super.startActivity(intent);
}
@Override
public void startActivityForResult(Intent intent, int request) {
checkIfGeckoActivity(intent);
mGeckoActivityOpened = checkIfGeckoActivity(intent);
super.startActivityForResult(intent, request);
}
private void checkIfGeckoActivity(Intent intent) {
// Whenever we call our own activity, the component and it's package name is set.
private static boolean checkIfGeckoActivity(Intent intent) {
// Whenever we call our own activity, the component and its package name is set.
// If we call an activity from another package, or an open intent (leaving android to resolve)
// component has a different package name or it is null.
ComponentName component = intent.getComponent();
mGeckoActivityOpened = false;
if (component != null &&
component.getPackageName() != null &&
component.getPackageName().equals("@ANDROID_PACKAGE_NAME@")) {
mGeckoActivityOpened = true;
}
return (component != null
&& component.getPackageName() != null
&& component.getPackageName().equals("@ANDROID_PACKAGE_NAME@"));
}
@Override

View File

@ -614,10 +614,7 @@ abstract public class GeckoApp
if (outState == null)
outState = new Bundle();
boolean inBackground =
((GeckoApplication)getApplication()).isApplicationInBackground();
outState.putBoolean(SAVED_STATE_IN_BACKGROUND, inBackground);
outState.putBoolean(SAVED_STATE_IN_BACKGROUND, isApplicationInBackground());
outState.putString(SAVED_STATE_PRIVATE_SESSION, mPrivateBrowsingSession);
}