Merge "Fix a security exception breaking notification inflation." into sc-dev am: f24e216a60
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15038412 Change-Id: I05a143798366cdfb3d84558bf491b3229bd40ed1
This commit is contained in:
@@ -5606,14 +5606,24 @@ public class Notification implements Parcelable
|
|||||||
|
|
||||||
final boolean snoozeEnabled = !hideSnoozeButton
|
final boolean snoozeEnabled = !hideSnoozeButton
|
||||||
&& mContext.getContentResolver() != null
|
&& mContext.getContentResolver() != null
|
||||||
&& (Settings.Secure.getInt(mContext.getContentResolver(),
|
&& isSnoozeSettingEnabled();
|
||||||
Settings.Secure.SHOW_NOTIFICATION_SNOOZE, 0) == 1);
|
|
||||||
if (snoozeEnabled) {
|
if (snoozeEnabled) {
|
||||||
big.setViewLayoutMarginDimen(R.id.notification_action_list_margin_target,
|
big.setViewLayoutMarginDimen(R.id.notification_action_list_margin_target,
|
||||||
RemoteViews.MARGIN_BOTTOM, 0);
|
RemoteViews.MARGIN_BOTTOM, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isSnoozeSettingEnabled() {
|
||||||
|
try {
|
||||||
|
return Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.SHOW_NOTIFICATION_SNOOZE, 0) == 1;
|
||||||
|
} catch (SecurityException ex) {
|
||||||
|
// Most 3p apps can't access this snooze setting, so their NotificationListeners
|
||||||
|
// would be unable to create notification views if we propagated this exception.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the actions that are not contextual.
|
* Returns the actions that are not contextual.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user