diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-02-03 19:19:09 -0800 |
|---|---|---|
| committer | Svetoslav Ganov <svetoslavganov@google.com> | 2012-02-15 14:55:47 -0800 |
| commit | 25872aa3ef189ae5506a923398af11ce5eb1a9b9 (patch) | |
| tree | ece1cffcc342e5e7133ca42d33ce97bbf403f779 /core/java/android/app/ActivityManagerNative.java | |
| parent | 91ec0b722f659bb5e4bcc64339f2fbbe30a31287 (diff) | |
Adding shell commands for modifying content.
1. Added methods to the ActivityManagerService remote interface
that allow accessing content providers outside of an application.
These methods are guarded by an internal signature protected
permission which is given to the shell user. This enables a
shell program to access content providers.
2. Implemented a shell command that takes as input as standart
fagls with values and manipulates content via the content provider
mechanism.
Change-Id: I2943f8b59fbab33eb623458fa01ea61a077b9845
Diffstat (limited to 'core/java/android/app/ActivityManagerNative.java')
| -rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index 5a364665768d..24079a5d8a2f 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -581,6 +581,21 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } + case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + String name = data.readString(); + IBinder token = data.readStrongBinder(); + ContentProviderHolder cph = getContentProviderExternal(name, token); + reply.writeNoException(); + if (cph != null) { + reply.writeInt(1); + cph.writeToParcel(reply, 0); + } else { + reply.writeInt(0); + } + return true; + } + case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder b = data.readStrongBinder(); @@ -601,7 +616,16 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM reply.writeNoException(); return true; } - + + case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + String name = data.readString(); + IBinder token = data.readStrongBinder(); + removeContentProviderExternal(name, token); + reply.writeNoException(); + return true; + } + case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); ComponentName comp = ComponentName.CREATOR.createFromParcel(data); @@ -2178,6 +2202,25 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); return cph; } + public ContentProviderHolder getContentProviderExternal(String name, IBinder token) + throws RemoteException + { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeString(name); + data.writeStrongBinder(token); + mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0); + reply.readException(); + int res = reply.readInt(); + ContentProviderHolder cph = null; + if (res != 0) { + cph = ContentProviderHolder.CREATOR.createFromParcel(reply); + } + data.recycle(); + reply.recycle(); + return cph; + } public void publishContentProviders(IApplicationThread caller, List<ContentProviderHolder> providers) throws RemoteException { @@ -2204,7 +2247,19 @@ class ActivityManagerProxy implements IActivityManager data.recycle(); reply.recycle(); } - + + public void removeContentProviderExternal(String name, IBinder token) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeString(name); + data.writeStrongBinder(token); + mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0); + reply.readException(); + data.recycle(); + reply.recycle(); + } + public PendingIntent getRunningServiceControlPanel(ComponentName service) throws RemoteException { |
