summaryrefslogtreecommitdiffstats
path: root/services/appwidget
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2014-09-04 15:07:18 -0700
committerNick Kralevich <nnk@google.com>2014-09-04 15:07:18 -0700
commit75d8c0b8bc28f61658c62b870ae8705e0be191cb (patch)
treeeee16c54e985c4d5d47ac819048cf5db010486de /services/appwidget
parent191cbad91f19c14316810c806c4b0560d9386c8c (diff)
downloadframeworks_base-75d8c0b8bc28f61658c62b870ae8705e0be191cb.zip
frameworks_base-75d8c0b8bc28f61658c62b870ae8705e0be191cb.tar.gz
frameworks_base-75d8c0b8bc28f61658c62b870ae8705e0be191cb.tar.bz2
AppWidgetServiceImpl: Use enforceCallingOrSelfPermission for checking DUMP
Use enforceCallingOrSelfPermission() for throwing a security exception rather than creating the security exception ourselves. This has the advantage that the exception is in a well known format expected by the CTS test android.security.cts.ServicePermissionsTest#testDumpProtected Bug: 17165920 Change-Id: I7d3c2d2a0852a490fe1d553cd81d1efc79d2fec3
Diffstat (limited to 'services/appwidget')
-rw-r--r--services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
index 7f7e5c3..06c4cfd 100644
--- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
+++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
@@ -440,12 +440,10 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
- if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Permission Denial: can't dump from from pid="
- + Binder.getCallingPid()
- + ", uid=" + Binder.getCallingUid());
- }
+ mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP,
+ "Permission Denial: can't dump from from pid="
+ + Binder.getCallingPid()
+ + ", uid=" + Binder.getCallingUid());
synchronized (mLock) {
int N = mProviders.size();