Merge "Fix toast lifetime"

This commit is contained in:
TreeHugger Robot
2018-03-02 20:58:34 +00:00
committed by Android (Google) Code Review
3 changed files with 75 additions and 8 deletions

View File

@@ -45,6 +45,8 @@ interface INotificationManager
void clearData(String pkg, int uid, boolean fromApp);
void enqueueToast(String pkg, ITransientNotification callback, int duration);
void cancelToast(String pkg, ITransientNotification callback);
void finishToken(String pkg, ITransientNotification callback);
void enqueueNotificationWithTag(String pkg, String opPkg, String tag, int id,
in Notification notification, int userId);
void cancelNotificationWithTag(String pkg, String tag, int id, int userId);

View File

@@ -531,6 +531,14 @@ public class Toast {
mWM.removeViewImmediate(mView);
}
// Now that we've removed the view it's safe for the server to release
// the resources.
try {
getService().finishToken(mPackageName, this);
} catch (RemoteException e) {
}
mView = null;
}
}