resolve merge conflicts of 5cc7bbdbb to ub-launcher3-dorval-polish

Test: I solemnly swear I tested this conflict resolution.
Change-Id: If3359341d5269f2c908b3a8856b6f38ba69a05eb
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 62cf2b3..dd0d2b8 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -272,7 +272,6 @@
     private Handler mHandler = new Handler();
     private boolean mIsResumeFromActionScreenOff;
     private boolean mHasFocus = false;
-    private boolean mAttached = false;
 
     private ObjectAnimator mScrimAnimator;
 
@@ -468,6 +467,9 @@
             mLauncherCallbacks.onCreate(savedInstanceState);
         }
 
+        // Listen for broadcasts screen off
+        registerReceiver(mReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
+
         if (Themes.getAttrBoolean(this, R.attr.isWorkspaceDarkText)) {
             activateLightSystemBars(true, true, true);
         }
@@ -1591,13 +1593,7 @@
     public void onAttachedToWindow() {
         super.onAttachedToWindow();
 
-        // Listen for broadcasts related to user-presence
-        final IntentFilter filter = new IntentFilter();
-        filter.addAction(Intent.ACTION_SCREEN_OFF);
-        registerReceiver(mReceiver, filter);
         FirstFrameAnimatorHelper.initializeDrawListener(getWindow().getDecorView());
-        mAttached = true;
-
         if (mLauncherCallbacks != null) {
             mLauncherCallbacks.onAttachedToWindow();
         }
@@ -1606,10 +1602,6 @@
     @Override
     public void onDetachedFromWindow() {
         super.onDetachedFromWindow();
-        if (mAttached) {
-            unregisterReceiver(mReceiver);
-            mAttached = false;
-        }
 
         if (mLauncherCallbacks != null) {
             mLauncherCallbacks.onDetachedFromWindow();
@@ -1846,6 +1838,7 @@
     public void onDestroy() {
         super.onDestroy();
 
+        unregisterReceiver(mReceiver);
         mWorkspace.removeCallbacks(mBuildLayersRunnable);
         mWorkspace.removeFolderListeners();