Loading core/java/android/app/INotificationManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,8 @@ interface INotificationManager void clearData(String pkg, int uid, boolean fromApp); void enqueueTextToast(String pkg, IBinder token, CharSequence text, int duration, int displayId, @nullable ITransientNotificationCallback callback); void enqueueToast(String pkg, IBinder token, ITransientNotification callback, int duration, int displayId); // TODO(b/144152069): Remove this after assessing impact on dogfood. void enqueueTextOrCustomToast(String pkg, IBinder token, ITransientNotification callback, int duration, int displayId, boolean isCustom); void cancelToast(String pkg, IBinder token); void finishToken(String pkg, IBinder token); Loading core/java/android/widget/Toast.java +6 −1 Original line number Diff line number Diff line Loading @@ -148,6 +148,9 @@ public class Toast { @Nullable private CharSequence mText; // TODO(b/144152069): Remove this after assessing impact on dogfood. private boolean mIsCustomToast; /** * Construct an empty Toast object. You must call {@link #setView} before you * can call {@link #show}. Loading Loading @@ -214,7 +217,8 @@ public class Toast { service.enqueueTextToast(pkg, mToken, mText, mDuration, displayId, callback); } } else { service.enqueueToast(pkg, mToken, tn, mDuration, displayId); service.enqueueTextOrCustomToast(pkg, mToken, tn, mDuration, displayId, mIsCustomToast); } } catch (RemoteException e) { // Empty Loading Loading @@ -252,6 +256,7 @@ public class Toast { */ @Deprecated public void setView(View view) { mIsCustomToast = true; mNextView = view; } Loading services/core/java/com/android/server/notification/NotificationManagerService.java +10 −4 Original line number Diff line number Diff line Loading @@ -2681,18 +2681,24 @@ public class NotificationManagerService extends SystemService { @Override public void enqueueTextToast(String pkg, IBinder token, CharSequence text, int duration, int displayId, @Nullable ITransientNotificationCallback callback) { enqueueToast(pkg, token, text, null, duration, displayId, callback); enqueueToast(pkg, token, text, null, duration, displayId, callback, false); } @Override public void enqueueToast(String pkg, IBinder token, ITransientNotification callback, int duration, int displayId) { enqueueToast(pkg, token, null, callback, duration, displayId, null); enqueueToast(pkg, token, null, callback, duration, displayId, null, true); } @Override public void enqueueTextOrCustomToast(String pkg, IBinder token, ITransientNotification callback, int duration, int displayId, boolean isCustom) { enqueueToast(pkg, token, null, callback, duration, displayId, null, isCustom); } private void enqueueToast(String pkg, IBinder token, @Nullable CharSequence text, @Nullable ITransientNotification callback, int duration, int displayId, @Nullable ITransientNotificationCallback textCallback) { @Nullable ITransientNotificationCallback textCallback, boolean isCustom) { if (DBG) { Slog.i(TAG, "enqueueToast pkg=" + pkg + " token=" + token + " duration=" + duration + " displayId=" + displayId); Loading Loading @@ -2730,7 +2736,7 @@ public class NotificationManagerService extends SystemService { return; } if (callback != null && !appIsForeground && !isSystemToast) { if (callback != null && !appIsForeground && !isSystemToast && isCustom) { boolean block; long id = Binder.clearCallingIdentity(); try { Loading Loading
core/java/android/app/INotificationManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,8 @@ interface INotificationManager void clearData(String pkg, int uid, boolean fromApp); void enqueueTextToast(String pkg, IBinder token, CharSequence text, int duration, int displayId, @nullable ITransientNotificationCallback callback); void enqueueToast(String pkg, IBinder token, ITransientNotification callback, int duration, int displayId); // TODO(b/144152069): Remove this after assessing impact on dogfood. void enqueueTextOrCustomToast(String pkg, IBinder token, ITransientNotification callback, int duration, int displayId, boolean isCustom); void cancelToast(String pkg, IBinder token); void finishToken(String pkg, IBinder token); Loading
core/java/android/widget/Toast.java +6 −1 Original line number Diff line number Diff line Loading @@ -148,6 +148,9 @@ public class Toast { @Nullable private CharSequence mText; // TODO(b/144152069): Remove this after assessing impact on dogfood. private boolean mIsCustomToast; /** * Construct an empty Toast object. You must call {@link #setView} before you * can call {@link #show}. Loading Loading @@ -214,7 +217,8 @@ public class Toast { service.enqueueTextToast(pkg, mToken, mText, mDuration, displayId, callback); } } else { service.enqueueToast(pkg, mToken, tn, mDuration, displayId); service.enqueueTextOrCustomToast(pkg, mToken, tn, mDuration, displayId, mIsCustomToast); } } catch (RemoteException e) { // Empty Loading Loading @@ -252,6 +256,7 @@ public class Toast { */ @Deprecated public void setView(View view) { mIsCustomToast = true; mNextView = view; } Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +10 −4 Original line number Diff line number Diff line Loading @@ -2681,18 +2681,24 @@ public class NotificationManagerService extends SystemService { @Override public void enqueueTextToast(String pkg, IBinder token, CharSequence text, int duration, int displayId, @Nullable ITransientNotificationCallback callback) { enqueueToast(pkg, token, text, null, duration, displayId, callback); enqueueToast(pkg, token, text, null, duration, displayId, callback, false); } @Override public void enqueueToast(String pkg, IBinder token, ITransientNotification callback, int duration, int displayId) { enqueueToast(pkg, token, null, callback, duration, displayId, null); enqueueToast(pkg, token, null, callback, duration, displayId, null, true); } @Override public void enqueueTextOrCustomToast(String pkg, IBinder token, ITransientNotification callback, int duration, int displayId, boolean isCustom) { enqueueToast(pkg, token, null, callback, duration, displayId, null, isCustom); } private void enqueueToast(String pkg, IBinder token, @Nullable CharSequence text, @Nullable ITransientNotification callback, int duration, int displayId, @Nullable ITransientNotificationCallback textCallback) { @Nullable ITransientNotificationCallback textCallback, boolean isCustom) { if (DBG) { Slog.i(TAG, "enqueueToast pkg=" + pkg + " token=" + token + " duration=" + duration + " displayId=" + displayId); Loading Loading @@ -2730,7 +2736,7 @@ public class NotificationManagerService extends SystemService { return; } if (callback != null && !appIsForeground && !isSystemToast) { if (callback != null && !appIsForeground && !isSystemToast && isCustom) { boolean block; long id = Binder.clearCallingIdentity(); try { Loading