Fix leaks

Change-Id: Iba29be756934d9564cfdee1f6281c56345772dc7
Fixes: 28074995
This commit is contained in:
Jason Monk
2016-05-03 15:24:05 -04:00
parent e0e7fa4501
commit 4e8d3013a2
3 changed files with 11 additions and 8 deletions

View File

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

View File

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

View File

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