From 3664b3dbd080ba888f98cca3d81b22acd93f3973 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Tue, 26 Mar 2013 14:04:20 -0400 Subject: [PATCH] Bug 853366 - Some minor code cleanup. r=cpeterson --- mobile/android/base/GeckoActivity.java.in | 17 +++++++---------- mobile/android/base/GeckoApp.java | 5 +---- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/mobile/android/base/GeckoActivity.java.in b/mobile/android/base/GeckoActivity.java.in index b0068c23358..029e28ea2e6 100644 --- a/mobile/android/base/GeckoActivity.java.in +++ b/mobile/android/base/GeckoActivity.java.in @@ -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 diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index be534cd4c15..985f850a794 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -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); }