Removing dependency on onAttachedToWindow callback.
When resizing in multi-window mode, the system reuses the decorView and may not call onAttachedToWindow. Bug: 62495747 Bug: 38463796 Change-Id: I949f8f8e37b5a4748947024df09097f15c940bf8
This commit is contained in:
@@ -266,7 +266,6 @@ public class Launcher extends BaseActivity
|
|||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
private boolean mIsResumeFromActionScreenOff;
|
private boolean mIsResumeFromActionScreenOff;
|
||||||
private boolean mHasFocus = false;
|
private boolean mHasFocus = false;
|
||||||
private boolean mAttached = false;
|
|
||||||
|
|
||||||
private PopupDataProvider mPopupDataProvider;
|
private PopupDataProvider mPopupDataProvider;
|
||||||
|
|
||||||
@@ -456,6 +455,9 @@ public class Launcher extends BaseActivity
|
|||||||
if (mLauncherCallbacks != null) {
|
if (mLauncherCallbacks != null) {
|
||||||
mLauncherCallbacks.onCreate(savedInstanceState);
|
mLauncherCallbacks.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Listen for broadcasts screen off
|
||||||
|
registerReceiver(mReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1592,13 +1594,7 @@ public class Launcher extends BaseActivity
|
|||||||
public void onAttachedToWindow() {
|
public void onAttachedToWindow() {
|
||||||
super.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());
|
FirstFrameAnimatorHelper.initializeDrawListener(getWindow().getDecorView());
|
||||||
mAttached = true;
|
|
||||||
|
|
||||||
if (mLauncherCallbacks != null) {
|
if (mLauncherCallbacks != null) {
|
||||||
mLauncherCallbacks.onAttachedToWindow();
|
mLauncherCallbacks.onAttachedToWindow();
|
||||||
}
|
}
|
||||||
@@ -1607,10 +1603,6 @@ public class Launcher extends BaseActivity
|
|||||||
@Override
|
@Override
|
||||||
public void onDetachedFromWindow() {
|
public void onDetachedFromWindow() {
|
||||||
super.onDetachedFromWindow();
|
super.onDetachedFromWindow();
|
||||||
if (mAttached) {
|
|
||||||
unregisterReceiver(mReceiver);
|
|
||||||
mAttached = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mLauncherCallbacks != null) {
|
if (mLauncherCallbacks != null) {
|
||||||
mLauncherCallbacks.onDetachedFromWindow();
|
mLauncherCallbacks.onDetachedFromWindow();
|
||||||
@@ -1851,6 +1843,7 @@ public class Launcher extends BaseActivity
|
|||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|
||||||
|
unregisterReceiver(mReceiver);
|
||||||
mWorkspace.removeCallbacks(mBuildLayersRunnable);
|
mWorkspace.removeCallbacks(mBuildLayersRunnable);
|
||||||
mWorkspace.removeFolderListeners();
|
mWorkspace.removeFolderListeners();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user