diff options
Diffstat (limited to 'services/java/com/android/server/AppWidgetServiceImpl.java')
| -rw-r--r-- | services/java/com/android/server/AppWidgetServiceImpl.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/services/java/com/android/server/AppWidgetServiceImpl.java b/services/java/com/android/server/AppWidgetServiceImpl.java index 95d7623..499c15e 100644 --- a/services/java/com/android/server/AppWidgetServiceImpl.java +++ b/services/java/com/android/server/AppWidgetServiceImpl.java @@ -42,6 +42,7 @@ import android.os.Binder; import android.os.Bundle; import android.os.Environment; import android.os.IBinder; +import android.os.Process; import android.os.RemoteException; import android.os.SystemClock; import android.os.UserHandle; @@ -409,7 +410,7 @@ class AppWidgetServiceImpl { } public int allocateAppWidgetId(String packageName, int hostId) { - int callingUid = enforceCallingUid(packageName); + int callingUid = enforceSystemOrCallingUid(packageName); synchronized (mAppWidgetIds) { ensureStateLoadedLocked(); int appWidgetId = mNextAppWidgetId++; @@ -1358,10 +1359,10 @@ class AppWidgetServiceImpl { com.android.internal.R.styleable.AppWidgetProviderInfo_resizeMode, AppWidgetProviderInfo.RESIZE_NONE); info.widgetCategory = sa.getInt( - com.android.internal.R.styleable.AppWidgetProviderInfo_resizeMode, + com.android.internal.R.styleable.AppWidgetProviderInfo_widgetCategory, AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN); info.widgetFeatures = sa.getInt( - com.android.internal.R.styleable.AppWidgetProviderInfo_resizeMode, + com.android.internal.R.styleable.AppWidgetProviderInfo_widgetFeatures, AppWidgetProviderInfo.WIDGET_FEATURES_NONE); sa.recycle(); @@ -1391,6 +1392,15 @@ class AppWidgetServiceImpl { return pkgInfo.applicationInfo.uid; } + int enforceSystemOrCallingUid(String packageName) throws IllegalArgumentException { + int callingUid = Binder.getCallingUid(); + int uid = Process.myUid(); + if (UserHandle.getAppId(uid) == Process.SYSTEM_UID || uid == 0) { + return callingUid; + } + return enforceCallingUid(packageName); + } + int enforceCallingUid(String packageName) throws IllegalArgumentException { int callingUid = Binder.getCallingUid(); int packageUid; |
