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 @Override
public void startActivity(Intent intent) { public void startActivity(Intent intent) {
checkIfGeckoActivity(intent); mGeckoActivityOpened = checkIfGeckoActivity(intent);
super.startActivity(intent); super.startActivity(intent);
} }
@Override @Override
public void startActivityForResult(Intent intent, int request) { public void startActivityForResult(Intent intent, int request) {
checkIfGeckoActivity(intent); mGeckoActivityOpened = checkIfGeckoActivity(intent);
super.startActivityForResult(intent, request); super.startActivityForResult(intent, request);
} }
private void checkIfGeckoActivity(Intent intent) { private static boolean checkIfGeckoActivity(Intent intent) {
// Whenever we call our own activity, the component and it's package name is set. // 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) // 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. // component has a different package name or it is null.
ComponentName component = intent.getComponent(); ComponentName component = intent.getComponent();
mGeckoActivityOpened = false; return (component != null
if (component != null && && component.getPackageName() != null
component.getPackageName() != null && && component.getPackageName().equals("@ANDROID_PACKAGE_NAME@"));
component.getPackageName().equals("@ANDROID_PACKAGE_NAME@")) {
mGeckoActivityOpened = true;
}
} }
@Override @Override

View File

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