Merge "Revert "Post a silent notification if screenshot is dismissed"" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
3a9ce8d11a
@@ -215,7 +215,6 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
|
||||
private Animator mScreenshotAnimation;
|
||||
private Runnable mOnCompleteRunnable;
|
||||
private Animator mDismissAnimation;
|
||||
private SavedImageData mImageData;
|
||||
private boolean mInDarkMode = false;
|
||||
private boolean mDirectionLTR = true;
|
||||
private boolean mOrientationPortrait = true;
|
||||
@@ -234,9 +233,6 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
|
||||
switch (msg.what) {
|
||||
case MESSAGE_CORNER_TIMEOUT:
|
||||
mUiEventLogger.log(ScreenshotEvent.SCREENSHOT_INTERACTION_TIMEOUT);
|
||||
if (mImageData != null) {
|
||||
mNotificationsController.showSilentScreenshotNotification(mImageData);
|
||||
}
|
||||
GlobalScreenshot.this.dismissScreenshot("timeout", false);
|
||||
mOnCompleteRunnable.run();
|
||||
break;
|
||||
@@ -408,9 +404,6 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
|
||||
mDismissButton = mScreenshotLayout.findViewById(R.id.global_screenshot_dismiss_button);
|
||||
mDismissButton.setOnClickListener(view -> {
|
||||
mUiEventLogger.log(ScreenshotEvent.SCREENSHOT_EXPLICIT_DISMISSAL);
|
||||
if (mImageData != null) {
|
||||
mNotificationsController.showSilentScreenshotNotification(mImageData);
|
||||
}
|
||||
dismissScreenshot("dismiss_button", false);
|
||||
mOnCompleteRunnable.run();
|
||||
});
|
||||
@@ -450,10 +443,6 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
|
||||
});
|
||||
}
|
||||
|
||||
mImageData = null; // make sure we clear the current stored data
|
||||
mNotificationsController.reset();
|
||||
mNotificationsController.setImage(mScreenBitmap);
|
||||
|
||||
mSaveInBgTask = new SaveImageInBackgroundTask(mContext, data);
|
||||
mSaveInBgTask.execute();
|
||||
}
|
||||
@@ -670,7 +659,6 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
|
||||
*/
|
||||
private void showUiOnActionsReady(SavedImageData imageData) {
|
||||
logSuccessOnActionsReady(imageData);
|
||||
mImageData = imageData;
|
||||
|
||||
AccessibilityManager accessibilityManager = (AccessibilityManager)
|
||||
mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
|
||||
|
||||
@@ -148,11 +148,43 @@ public class ScreenshotNotificationsController {
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a silent notification with the saved screenshot and actions that can be taken with it.
|
||||
* Shows a notification to inform the user that a screenshot is currently being saved.
|
||||
*/
|
||||
public void showSavingScreenshotNotification() {
|
||||
final long now = System.currentTimeMillis();
|
||||
|
||||
mPublicNotificationBuilder
|
||||
.setContentTitle(mResources.getString(R.string.screenshot_saving_title))
|
||||
.setSmallIcon(R.drawable.stat_notify_image)
|
||||
.setCategory(Notification.CATEGORY_PROGRESS)
|
||||
.setWhen(now)
|
||||
.setShowWhen(true)
|
||||
.setColor(mResources.getColor(
|
||||
com.android.internal.R.color.system_notification_accent_color));
|
||||
SystemUI.overrideNotificationAppName(mContext, mPublicNotificationBuilder, true);
|
||||
|
||||
mNotificationBuilder
|
||||
.setContentTitle(mResources.getString(R.string.screenshot_saving_title))
|
||||
.setSmallIcon(R.drawable.stat_notify_image)
|
||||
.setWhen(now)
|
||||
.setShowWhen(true)
|
||||
.setColor(mResources.getColor(
|
||||
com.android.internal.R.color.system_notification_accent_color))
|
||||
.setStyle(mNotificationStyle)
|
||||
.setPublicVersion(mPublicNotificationBuilder.build());
|
||||
mNotificationBuilder.setFlag(Notification.FLAG_NO_CLEAR, true);
|
||||
SystemUI.overrideNotificationAppName(mContext, mNotificationBuilder, true);
|
||||
|
||||
mNotificationManager.notify(SystemMessageProto.SystemMessage.NOTE_GLOBAL_SCREENSHOT,
|
||||
mNotificationBuilder.build());
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a notification with the saved screenshot and actions that can be taken with it.
|
||||
*
|
||||
* @param actionData SavedImageData struct with image URI and actions
|
||||
*/
|
||||
public void showSilentScreenshotNotification(
|
||||
public void showScreenshotActionsNotification(
|
||||
GlobalScreenshot.SavedImageData actionData) {
|
||||
mNotificationBuilder.addAction(actionData.shareAction);
|
||||
mNotificationBuilder.addAction(actionData.editAction);
|
||||
@@ -174,34 +206,20 @@ public class ScreenshotNotificationsController {
|
||||
.setContentTitle(mResources.getString(R.string.screenshot_saved_title))
|
||||
.setContentText(mResources.getString(R.string.screenshot_saved_text))
|
||||
.setContentIntent(PendingIntent.getActivity(mContext, 0, launchIntent, 0))
|
||||
.setSmallIcon(R.drawable.stat_notify_image)
|
||||
.setCategory(Notification.CATEGORY_PROGRESS)
|
||||
.setWhen(now)
|
||||
.setShowWhen(true)
|
||||
.setAutoCancel(true)
|
||||
.setColor(mContext.getColor(
|
||||
com.android.internal.R.color.system_notification_accent_color))
|
||||
.setGroup("silent")
|
||||
.setGroupAlertBehavior(Notification.GROUP_ALERT_SUMMARY);
|
||||
com.android.internal.R.color.system_notification_accent_color));
|
||||
mNotificationBuilder
|
||||
.setContentTitle(mResources.getString(R.string.screenshot_saved_title))
|
||||
.setContentText(mResources.getString(R.string.screenshot_saved_text))
|
||||
.setContentIntent(PendingIntent.getActivity(mContext, 0, launchIntent, 0))
|
||||
.setSmallIcon(R.drawable.stat_notify_image)
|
||||
.setCategory(Notification.CATEGORY_PROGRESS)
|
||||
.setWhen(now)
|
||||
.setShowWhen(true)
|
||||
.setAutoCancel(true)
|
||||
.setColor(mContext.getColor(
|
||||
com.android.internal.R.color.system_notification_accent_color))
|
||||
.setPublicVersion(mPublicNotificationBuilder.build())
|
||||
.setStyle(mNotificationStyle)
|
||||
.setFlag(Notification.FLAG_NO_CLEAR, false)
|
||||
.setGroup("silent")
|
||||
.setGroupAlertBehavior(Notification.GROUP_ALERT_SUMMARY);
|
||||
|
||||
SystemUI.overrideNotificationAppName(mContext, mPublicNotificationBuilder, true);
|
||||
SystemUI.overrideNotificationAppName(mContext, mNotificationBuilder, true);
|
||||
.setFlag(Notification.FLAG_NO_CLEAR, false);
|
||||
|
||||
mNotificationManager.notify(SystemMessageProto.SystemMessage.NOTE_GLOBAL_SCREENSHOT,
|
||||
mNotificationBuilder.build());
|
||||
|
||||
Reference in New Issue
Block a user