Merge "Fix leaks" into nyc-dev

This commit is contained in:
Jason Monk
2016-05-03 19:36:34 +00:00
committed by Android (Google) Code Review
3 changed files with 11 additions and 8 deletions

View File

@@ -1259,24 +1259,25 @@ public class ManageApplications extends InstrumentedFragment
private final SummaryLoader mLoader;
// TODO: Can probably hack together with less than full app state.
private final ApplicationsState mAppState;
private final ApplicationsState.Session mSession;
private final Handler mHandler;
private ApplicationsState.Session mSession;
private SummaryProvider(Context context, SummaryLoader loader) {
mContext = context;
mLoader = loader;
mAppState =
ApplicationsState.getInstance((Application) context.getApplicationContext());
mSession = mAppState.newSession(this);
mHandler = new Handler(mAppState.getBackgroundLooper());
}
@Override
public void setListening(boolean listening) {
if (listening) {
mSession = mAppState.newSession(this);
mSession.resume();
} else {
mSession.pause();
mSession.release();
}
}

View File

@@ -42,31 +42,33 @@ public class NotificationApps extends ManageApplications {
private final SummaryLoader mLoader;
private final ApplicationsState mAppState;
private final ApplicationsState.Session mSession;
private final NotificationBackend mNotifBackend;
private final AppStateNotificationBridge mExtraInfoBridge;
private final Handler mHandler;
private AppStateNotificationBridge mExtraInfoBridge;
private ApplicationsState.Session mSession;
private SummaryProvider(Context context, SummaryLoader loader) {
mContext = context;
mLoader = loader;
mAppState =
ApplicationsState.getInstance((Application) context.getApplicationContext());
mSession = mAppState.newSession(this);
mNotifBackend = new NotificationBackend();
mExtraInfoBridge = new AppStateNotificationBridge(mContext,
mAppState, this, mNotifBackend);
mHandler = new Handler(mAppState.getBackgroundLooper());
}
@Override
public void setListening(boolean listening) {
if (listening) {
mSession = mAppState.newSession(this);
mExtraInfoBridge = new AppStateNotificationBridge(mContext,
mAppState, this, mNotifBackend);
mSession.resume();
mExtraInfoBridge.resume();
} else {
mSession.pause();
mExtraInfoBridge.pause();
mSession.release();
mExtraInfoBridge.release();
}
}

View File

@@ -47,7 +47,7 @@ public class SuggestionsChecks {
private final Context mContext;
public SuggestionsChecks(Context context) {
mContext = context;
mContext = context.getApplicationContext();
}
public boolean isSuggestionComplete(Tile suggestion) {