private LauncherModel mModel;
private IconCache mIconCache;
+ private boolean mUserPresent = true;
+ private boolean mVisible = false;
+ private boolean mAttached = false;
private static LocaleConfiguration sLocaleConfiguration = null;
}
}
- private boolean mUserPresent = true;
- private boolean mVisible = false;
-
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
filter.addAction(Intent.ACTION_USER_PRESENT);
registerReceiver(mReceiver, filter);
+ mAttached = true;
mVisible = true;
}
super.onDetachedFromWindow();
mVisible = false;
- unregisterReceiver(mReceiver);
+ if (mAttached) {
+ unregisterReceiver(mReceiver);
+ mAttached = false;
+ }
updateRunning();
}