diff options
author | Raman Tenneti <rtenneti@google.com> | 2019-09-27 16:34:59 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-09-27 16:34:59 -0700 |
commit | 0a1a6fb76b9904855dc7bde613cc30175d41e087 (patch) | |
tree | c2212693407f6bc11c70cda8388d5e512b75e6c4 | |
parent | 3aef2f2371ea7cb19e7233805ffe4334bb94749e (diff) | |
parent | 3daf6f044661425661decaccd2e2a6226d8043be (diff) | |
download | UnifiedEmail-0a1a6fb76b9904855dc7bde613cc30175d41e087.tar.gz |
AOSP/UnifiedEmail - Secure UPDATE_WIDGET receiver with a new permission
am: 3daf6f0446
Change-Id: Iafcb8d8ff2a7872f6e0d4f8ca0b5016796c3a4d0
-rw-r--r-- | res/values/strings.xml | 7 | ||||
-rw-r--r-- | src/com/android/mail/widget/BaseWidgetProvider.java | 14 |
2 files changed, 18 insertions, 3 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 608acdbfb..f2501c307 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 bbfe1ccb1..4a1898986 100644 --- a/src/com/android/mail/widget/BaseWidgetProvider.java +++ b/src/com/android/mail/widget/BaseWidgetProvider.java @@ -308,10 +308,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) { |