diff options
author | Svet Ganov <svetoslavganov@google.com> | 2014-08-23 21:10:29 -0700 |
---|---|---|
committer | Svet Ganov <svetoslavganov@google.com> | 2014-08-24 20:02:47 -0700 |
commit | 5771ad7bc7533f4a9bc72ac1ecabfdf6ca493b16 (patch) | |
tree | 5455da198b3ee47217a07fe12844f37cf5a27d3d /core/java/android/appwidget | |
parent | 63859536047e907fbcde87f12511ec3b35bf53dc (diff) | |
download | frameworks_base-5771ad7bc7533f4a9bc72ac1ecabfdf6ca493b16.zip frameworks_base-5771ad7bc7533f4a9bc72ac1ecabfdf6ca493b16.tar.gz frameworks_base-5771ad7bc7533f4a9bc72ac1ecabfdf6ca493b16.tar.bz2 |
RemoteViews service not unbound.
We are checking whether an app can access an app widget
based on the calling uid and the package name. The package
is mostly to make sure that hosts in different apps do
not accidentally interfere whereas the security is enforced
by the uid.
When remote views adapter binds and unbinds to a remote
views serivce it was passing the package of the context we
create to load resources for the widget instead the package
of the host. Now it is passing the host package and also
we are checking if the caller of bind remove serivce API
is in uid that has the host package - this makes it
consistent with elsewhere.
bug:17226052
Change-Id: I2b0b6669e3dc027037b7481c2871cedabd642433
Diffstat (limited to 'core/java/android/appwidget')
-rw-r--r-- | core/java/android/appwidget/AppWidgetHost.java | 17 | ||||
-rw-r--r-- | core/java/android/appwidget/AppWidgetManager.java | 2 |
2 files changed, 9 insertions, 10 deletions
diff --git a/core/java/android/appwidget/AppWidgetHost.java b/core/java/android/appwidget/AppWidgetHost.java index 69716e5..24c6793 100644 --- a/core/java/android/appwidget/AppWidgetHost.java +++ b/core/java/android/appwidget/AppWidgetHost.java @@ -24,7 +24,6 @@ import android.annotation.Nullable; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Context; -import android.content.Intent; import android.content.IntentSender; import android.os.Binder; import android.os.Bundle; @@ -155,7 +154,7 @@ public class AppWidgetHost { int[] updatedIds; ArrayList<RemoteViews> updatedViews = new ArrayList<RemoteViews>(); try { - updatedIds = sService.startListening(mCallbacks, mContext.getPackageName(), mHostId, + updatedIds = sService.startListening(mCallbacks, mContext.getOpPackageName(), mHostId, updatedViews); } catch (RemoteException e) { @@ -174,7 +173,7 @@ public class AppWidgetHost { */ public void stopListening() { try { - sService.stopListening(mContext.getPackageName(), mHostId); + sService.stopListening(mContext.getOpPackageName(), mHostId); } catch (RemoteException e) { throw new RuntimeException("system server dead?", e); @@ -192,7 +191,7 @@ public class AppWidgetHost { */ public int allocateAppWidgetId() { try { - return sService.allocateAppWidgetId(mContext.getPackageName(), mHostId); + return sService.allocateAppWidgetId(mContext.getOpPackageName(), mHostId); } catch (RemoteException e) { throw new RuntimeException("system server dead?", e); @@ -222,7 +221,7 @@ public class AppWidgetHost { int appWidgetId, int intentFlags, int requestCode, @Nullable Bundle options) { try { IntentSender intentSender = sService.createAppWidgetConfigIntentSender( - mContext.getPackageName(), appWidgetId, intentFlags); + mContext.getOpPackageName(), appWidgetId, intentFlags); if (intentSender != null) { activity.startIntentSenderForResult(intentSender, requestCode, null, 0, 0, 0, options); @@ -246,7 +245,7 @@ public class AppWidgetHost { if (sService == null) { bindService(); } - return sService.getAppWidgetIdsForHost(mContext.getPackageName(), mHostId); + return sService.getAppWidgetIdsForHost(mContext.getOpPackageName(), mHostId); } catch (RemoteException e) { throw new RuntimeException("system server dead?", e); } @@ -263,7 +262,7 @@ public class AppWidgetHost { synchronized (mViews) { mViews.remove(appWidgetId); try { - sService.deleteAppWidgetId(mContext.getPackageName(), appWidgetId); + sService.deleteAppWidgetId(mContext.getOpPackageName(), appWidgetId); } catch (RemoteException e) { throw new RuntimeException("system server dead?", e); @@ -281,7 +280,7 @@ public class AppWidgetHost { */ public void deleteHost() { try { - sService.deleteHost(mContext.getPackageName(), mHostId); + sService.deleteHost(mContext.getOpPackageName(), mHostId); } catch (RemoteException e) { throw new RuntimeException("system server dead?", e); @@ -319,7 +318,7 @@ public class AppWidgetHost { } RemoteViews views; try { - views = sService.getAppWidgetViews(mContext.getPackageName(), appWidgetId); + views = sService.getAppWidgetViews(mContext.getOpPackageName(), appWidgetId); } catch (RemoteException e) { throw new RuntimeException("system server dead?", e); } diff --git a/core/java/android/appwidget/AppWidgetManager.java b/core/java/android/appwidget/AppWidgetManager.java index 086eb7d..bd45c7e 100644 --- a/core/java/android/appwidget/AppWidgetManager.java +++ b/core/java/android/appwidget/AppWidgetManager.java @@ -441,7 +441,7 @@ public class AppWidgetManager { * @hide */ public AppWidgetManager(Context context, IAppWidgetService service) { - mPackageName = context.getPackageName(); + mPackageName = context.getOpPackageName(); mService = service; mDisplayMetrics = context.getResources().getDisplayMetrics(); } |