summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaman Tenneti <rtenneti@google.com>2019-09-18 02:10:32 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-09-18 02:10:32 +0000
commitca75c5e82475e5f48cf98398f69f5bf00fe03b83 (patch)
tree658c79d23a51d1da8a3611b461d4713b0c5279de
parent4201564aea66a4c00d24a0b1eb0c9facb92f34a5 (diff)
parent85988858d75498f51f0217eaf9796661a6d3ab63 (diff)
downloadUnifiedEmail-ca75c5e82475e5f48cf98398f69f5bf00fe03b83.tar.gz
Merge "AOSP/UnifiedEmail - Secure UPDATE_WIDGET receiver with a new permission"HEADndk-sysroot-r21mastermain
-rw-r--r--res/values/strings.xml7
-rw-r--r--src/com/android/mail/widget/BaseWidgetProvider.java14
2 files changed, 18 insertions, 3 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 951f1070c..a8b7bfef9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -26,6 +26,13 @@
<string name="app_name" translatable="false">Unified Email</string>
+ <!-- The name of the permission to get widget update notifications. -->
+ <string name="permission_update_widget" translatable="false">com.android.email.permission.GET_WIDGET_UPDATE</string>
+ <!-- Permission label for receiving updates for the widget. -->
+ <string name="permission_update_widget_label">Update widget</string>
+ <!-- Permission description for receiving updates for the widget. -->
+ <string name="permission_update_widget_desc">Allows the app to receive notifications when the widget should be refreshed, including the account name and folder name.</string>
+
<!-- Compose -->
<!-- Shown in Compose; the sender of the message [CHAR LIMIT=10] -->
<string name="from">From</string>
diff --git a/src/com/android/mail/widget/BaseWidgetProvider.java b/src/com/android/mail/widget/BaseWidgetProvider.java
index 00eacd79b..42d1ae634 100644
--- a/src/com/android/mail/widget/BaseWidgetProvider.java
+++ b/src/com/android/mail/widget/BaseWidgetProvider.java
@@ -318,10 +318,18 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider {
updateWidgetIntent.putExtra(EXTRA_FOLDER_TYPE, folderType);
updateWidgetIntent.putExtra(EXTRA_FOLDER_CAPABILITIES, folderCapabilities);
updateWidgetIntent.putExtra(EXTRA_FOLDER_URI, folderUri);
- updateWidgetIntent.putExtra(EXTRA_FOLDER_CONVERSATION_LIST_URI, folderConversationListUri);
- updateWidgetIntent.putExtra(EXTRA_FOLDER_DISPLAY_NAME, folderDisplayName);
- context.sendBroadcast(updateWidgetIntent);
+ if (folderConversationListUri != null) {
+ updateWidgetIntent.putExtra(EXTRA_FOLDER_CONVERSATION_LIST_URI,
+ folderConversationListUri);
+ }
+ if (folderDisplayName != null) {
+ updateWidgetIntent.putExtra(EXTRA_FOLDER_DISPLAY_NAME, folderDisplayName);
+ }
+ updateWidgetIntent.setPackage(context.getPackageName());
+
+ context.sendBroadcast(updateWidgetIntent,
+ context.getString(R.string.permission_update_widget));
}
public static void validateAllWidgets(Context context, String accountMimeType) {