diff options
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/app/ActivityManager.java | 82 | ||||
-rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 24 | ||||
-rw-r--r-- | core/java/android/app/IActivityManager.java | 12 | ||||
-rw-r--r-- | core/java/android/content/Intent.java | 18 | ||||
-rw-r--r-- | core/java/android/content/SyncManager.java | 4 | ||||
-rw-r--r-- | core/java/android/provider/Settings.java | 14 |
6 files changed, 149 insertions, 5 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index ad06fa9..af73112 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -366,6 +366,19 @@ public class ActivityManager { */ public int flags; + /** + * For special services that are bound to by system code, this is + * the package that holds the binding. + */ + public String clientPackage; + + /** + * For special services that are bound to by system code, this is + * a string resource providing a user-visible label for who the + * client is. + */ + public int clientLabel; + public RunningServiceInfo() { } @@ -386,6 +399,8 @@ public class ActivityManager { dest.writeLong(lastActivityTime); dest.writeLong(restarting); dest.writeInt(this.flags); + dest.writeString(clientPackage); + dest.writeInt(clientLabel); } public void readFromParcel(Parcel source) { @@ -401,6 +416,8 @@ public class ActivityManager { lastActivityTime = source.readLong(); restarting = source.readLong(); flags = source.readInt(); + clientPackage = source.readString(); + clientLabel = source.readInt(); } public static final Creator<RunningServiceInfo> CREATOR = new Creator<RunningServiceInfo>() { @@ -439,6 +456,22 @@ public class ActivityManager { } /** + * Returns a PendingIntent you can start to show a control panel for the + * given running service. If the service does not have a control panel, + * null is returned. + */ + public PendingIntent getRunningServiceControlPanel(ComponentName service) + throws SecurityException { + try { + return ActivityManagerNative.getDefault() + .getRunningServiceControlPanel(service); + } catch (RemoteException e) { + // System dead, we will be dead too soon! + return null; + } + } + + /** * Information you can retrieve about the available memory through * {@link ActivityManager#getMemoryInfo}. */ @@ -704,8 +737,51 @@ public class ActivityManager { */ public int lru; + /** + * Constant for {@link #importanceReasonCode}: nothing special has + * been specified for the reason for this level. + */ + public static final int REASON_UNKNOWN = 0; + + /** + * Constant for {@link #importanceReasonCode}: one of the application's + * content providers is being used by another process. The pid of + * the client process is in {@link #importanceReasonPid} and the + * target provider in this process is in + * {@link #importanceReasonComponent}. + */ + public static final int REASON_PROVIDER_IN_USE = 1; + + /** + * Constant for {@link #importanceReasonCode}: one of the application's + * content providers is being used by another process. The pid of + * the client process is in {@link #importanceReasonPid} and the + * target provider in this process is in + * {@link #importanceReasonComponent}. + */ + public static final int REASON_SERVICE_IN_USE = 2; + + /** + * The reason for {@link #importance}, if any. + */ + public int importanceReasonCode; + + /** + * For the specified values of {@link #importanceReasonCode}, this + * is the process ID of the other process that is a client of this + * process. This will be 0 if no other process is using this one. + */ + public int importanceReasonPid; + + /** + * For the specified values of {@link #importanceReasonCode}, this + * is the name of the component that is being used in this process. + */ + public ComponentName importanceReasonComponent; + public RunningAppProcessInfo() { importance = IMPORTANCE_FOREGROUND; + importanceReasonCode = REASON_UNKNOWN; } public RunningAppProcessInfo(String pProcessName, int pPid, String pArr[]) { @@ -724,6 +800,9 @@ public class ActivityManager { dest.writeStringArray(pkgList); dest.writeInt(importance); dest.writeInt(lru); + dest.writeInt(importanceReasonCode); + dest.writeInt(importanceReasonPid); + ComponentName.writeToParcel(importanceReasonComponent, dest); } public void readFromParcel(Parcel source) { @@ -732,6 +811,9 @@ public class ActivityManager { pkgList = source.readStringArray(); importance = source.readInt(); lru = source.readInt(); + importanceReasonCode = source.readInt(); + importanceReasonPid = source.readInt(); + importanceReasonComponent = ComponentName.readFromParcel(source); } public static final Creator<RunningAppProcessInfo> CREATOR = diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index 213f26e..4ed152e 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -510,6 +510,15 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } + case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + ComponentName comp = ComponentName.CREATOR.createFromParcel(data); + PendingIntent pi = getRunningServiceControlPanel(comp); + reply.writeNoException(); + PendingIntent.writePendingIntentOrNullToParcel(pi, reply); + return true; + } + case START_SERVICE_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder b = data.readStrongBinder(); @@ -1634,6 +1643,21 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); } + public PendingIntent getRunningServiceControlPanel(ComponentName service) + throws RemoteException + { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + service.writeToParcel(data, 0); + mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0); + reply.readException(); + PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply); + data.recycle(); + reply.recycle(); + return res; + } + public ComponentName startService(IApplicationThread caller, Intent service, String resolvedType) throws RemoteException { diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index a7bef54..a937c11 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -126,13 +126,15 @@ public interface IActivityManager extends IInterface { public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException; /* oneway */ public void reportThumbnail(IBinder token, - Bitmap thumbnail, CharSequence description) throws RemoteException; + Bitmap thumbnail, CharSequence description) throws RemoteException; public ContentProviderHolder getContentProvider(IApplicationThread caller, - String name) throws RemoteException; + String name) throws RemoteException; public void removeContentProvider(IApplicationThread caller, - String name) throws RemoteException; + String name) throws RemoteException; public void publishContentProviders(IApplicationThread caller, - List<ContentProviderHolder> providers) throws RemoteException; + List<ContentProviderHolder> providers) throws RemoteException; + public PendingIntent getRunningServiceControlPanel(ComponentName service) + throws RemoteException; public ComponentName startService(IApplicationThread caller, Intent service, String resolvedType) throws RemoteException; public int stopService(IApplicationThread caller, Intent service, @@ -367,7 +369,7 @@ public interface IActivityManager extends IInterface { int PUBLISH_CONTENT_PROVIDERS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+29; int SET_PERSISTENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+30; int FINISH_SUB_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+31; - + int GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+32; int START_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+33; int STOP_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+34; int BIND_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+35; diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 87a8f39..1d1161e 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -2044,6 +2044,24 @@ public class Intent implements Parcelable { public static final String EXTRA_CHANGED_COMPONENT_NAME = "android.intent.extra.changed_component_name"; + /** + * @hide + * Magic extra system code can use when binding, to give a label for + * who it is that has bound to a service. This is an integer giving + * a framework string resource that can be displayed to the user. + */ + public static final String EXTRA_CLIENT_LABEL = + "android.intent.extra.client_label"; + + /** + * @hide + * Magic extra system code can use when binding, to give a PendingIntent object + * that can be launched for the user to disable the system's use of this + * service. + */ + public static final String EXTRA_CLIENT_INTENT = + "android.intent.extra.client_intent"; + // --------------------------------------------------------------------- // --------------------------------------------------------------------- // Intent flags (see mFlags variable). diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java index 5ffe962..6d27bc7 100644 --- a/core/java/android/content/SyncManager.java +++ b/core/java/android/content/SyncManager.java @@ -1064,6 +1064,10 @@ class SyncManager implements OnAccountsUpdatedListener { Intent intent = new Intent(); intent.setAction("android.content.SyncAdapter"); intent.setComponent(info.componentName); + intent.putExtra(Intent.EXTRA_CLIENT_LABEL, + com.android.internal.R.string.sync_binding_label); + intent.putExtra(Intent.EXTRA_CLIENT_INTENT, PendingIntent.getActivity( + mContext, 0, new Intent(Settings.ACTION_SYNC_SETTINGS), 0)); return mContext.bindService(intent, this, Context.BIND_AUTO_CREATE); } diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 125ed0b..64e47eb 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -119,6 +119,20 @@ public final class Settings { "android.settings.AIRPLANE_MODE_SETTINGS"; /** + * Activity Action: Show settings for accessibility modules. + * <p> + * In some cases, a matching Activity may not exist, so ensure you + * safeguard against this. + * <p> + * Input: Nothing. + * <p> + * Output: Nothing. + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_ACCESSIBILITY_SETTINGS = + "android.settings.ACCESSIBILITY_SETTINGS"; + + /** * Activity Action: Show settings to allow configuration of security and * location privacy. * <p> |