Merge "Fix leaks" into nyc-dev
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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) {
|
||||||
|
Reference in New Issue
Block a user