Don't call freeform hack lifecycle methods if they are not actually needed
@@ -100,7 +100,9 @@ public class InvisibleActivityFreeform extends Activity {
overridePendingTransition(0, 0);
}
- if(proceedWithOnCreate) {
+ if(!proceedWithOnCreate)
+ return;
+
// Detect outside touches, and pass them through to the underlying activity
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH);
@@ -151,13 +153,15 @@ public class InvisibleActivityFreeform extends Activity {
showTaskbar = true;
}
- }
@TargetApi(Build.VERSION_CODES.N)
@Override
protected void onResume() {
super.onResume();
+ if(!proceedWithOnCreate)
+ return;
+
// Show the taskbar when activity is resumed (no other freeform windows are active)
if(showTaskbar)
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.SHOW_TASKBAR"));
@@ -172,19 +176,23 @@ public class InvisibleActivityFreeform extends Activity {
protected void onDestroy() {
super.onDestroy();
- if(proceedWithOnCreate) {
+ if(!proceedWithOnCreate)
+ return;
+
LocalBroadcastManager.getInstance(this).unregisterReceiver(appearingReceiver);
LocalBroadcastManager.getInstance(this).unregisterReceiver(disappearingReceiver);
LocalBroadcastManager.getInstance(this).unregisterReceiver(finishReceiver);
cleanup();
}
- }
@Override
protected void onStart() {
super.onStart();
+ if(!proceedWithOnCreate)
+ return;
+
FreeformHackHelper.getInstance().setInFreeformWorkspace(true);
if(U.launcherIsDefault(this) && !U.isChromeOs(this)) {
@@ -229,6 +237,9 @@ public class InvisibleActivityFreeform extends Activity {
protected void onPause() {
super.onPause();
+ if(!proceedWithOnCreate)
+ return;
+
possiblyHideTaskbar();
}
@@ -236,7 +247,11 @@ public class InvisibleActivityFreeform extends Activity {
protected void onStop() {
super.onStop();
- if(!finish) FreeformHackHelper.getInstance().setInFreeformWorkspace(false);
+ if(!proceedWithOnCreate)
+ return;
+
+ if(!finish)
+ FreeformHackHelper.getInstance().setInFreeformWorkspace(false);
possiblyHideTaskbar();
