Loading core/java/android/app/ActivityManager.java +33 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,39 @@ public class ActivityManager { /** @hide User operation call: given user id is the current user, can't be stopped. */ public static final int USER_OP_IS_CURRENT = -2; /** @hide Process is a persistent system process. */ public static final int PROCESS_STATE_PERSISTENT = 0; /** @hide Process is a persistent system process and is doing UI. */ public static final int PROCESS_STATE_PERSISTENT_UI = 1; /** @hide Process is hosting the current top activity. */ public static final int PROCESS_STATE_TOP = 2; /** @hide Process is important to the user, and something they are aware of. */ public static final int PROCESS_STATE_IMPORTANT_PERCEPTIBLE = 3; /** @hide Process is important to the user, but not something they are aware of. */ public static final int PROCESS_STATE_IMPORTANT_BACKGROUND = 4; /** @hide Process is in the background running a receiver. */ public static final int PROCESS_STATE_RECEIVER = 5; /** @hide Process is in the background running a backup/restore operation. */ public static final int PROCESS_STATE_BACKUP = 6; /** @hide Process is in the background running a service. */ public static final int PROCESS_STATE_SERVICE = 7; /** @hide Process is in the background but hosts the home activity. */ public static final int PROCESS_STATE_HOME = 8; /** @hide Process is in the background but hosts the last shown activity. */ public static final int PROCESS_STATE_LAST_ACTIVITY = 9; /** @hide Process is being cached for later use. */ public static final int PROCESS_STATE_CACHED = 10; /*package*/ ActivityManager(Context context, Handler handler) { mContext = context; mHandler = handler; Loading core/java/android/app/ActivityThread.java +35 −6 Original line number Diff line number Diff line Loading @@ -547,6 +547,8 @@ public final class ActivityThread { // Formatting for checkin service - update version if row format changes private static final int ACTIVITY_THREAD_CHECKIN_VERSION = 3; private int mLastProcessState = -1; private void updatePendingConfiguration(Configuration config) { synchronized (mResourcesManager) { if (mPendingConfiguration == null || Loading Loading @@ -582,7 +584,9 @@ public final class ActivityThread { queueOrSendMessage(H.SLEEPING, token, sleeping ? 1 : 0); } public final void scheduleResumeActivity(IBinder token, boolean isForward) { public final void scheduleResumeActivity(IBinder token, int processState, boolean isForward) { updateProcessState(processState, false); queueOrSendMessage(H.RESUME_ACTIVITY, token, isForward ? 1 : 0); } Loading @@ -597,9 +601,12 @@ public final class ActivityThread { // activity itself back to the activity manager. (matters more with ipc) public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident, ActivityInfo info, Configuration curConfig, CompatibilityInfo compatInfo, Bundle state, List<ResultInfo> pendingResults, int procState, Bundle state, List<ResultInfo> pendingResults, List<Intent> pendingNewIntents, boolean notResumed, boolean isForward, String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler) { updateProcessState(procState, false); ActivityClientRecord r = new ActivityClientRecord(); r.token = token; Loading Loading @@ -647,7 +654,8 @@ public final class ActivityThread { public final void scheduleReceiver(Intent intent, ActivityInfo info, CompatibilityInfo compatInfo, int resultCode, String data, Bundle extras, boolean sync, int sendingUser) { boolean sync, int sendingUser, int processState) { updateProcessState(processState, false); ReceiverData r = new ReceiverData(intent, resultCode, data, extras, sync, false, mAppThread.asBinder(), sendingUser); r.info = info; Loading Loading @@ -675,7 +683,8 @@ public final class ActivityThread { } public final void scheduleCreateService(IBinder token, ServiceInfo info, CompatibilityInfo compatInfo) { ServiceInfo info, CompatibilityInfo compatInfo, int processState) { updateProcessState(processState, false); CreateServiceData s = new CreateServiceData(); s.token = token; s.info = info; Loading @@ -685,7 +694,8 @@ public final class ActivityThread { } public final void scheduleBindService(IBinder token, Intent intent, boolean rebind) { boolean rebind, int processState) { updateProcessState(processState, false); BindServiceData s = new BindServiceData(); s.token = token; s.intent = intent; Loading Loading @@ -810,7 +820,8 @@ public final class ActivityThread { // applies transaction ordering per object for such calls. public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, int resultCode, String dataStr, Bundle extras, boolean ordered, boolean sticky, int sendingUser) throws RemoteException { boolean sticky, int sendingUser, int processState) throws RemoteException { updateProcessState(processState, false); receiver.performReceive(intent, resultCode, dataStr, extras, ordered, sticky, sendingUser); } Loading Loading @@ -1218,6 +1229,24 @@ public final class ActivityThread { public void scheduleTranslucentConversionComplete(IBinder token, boolean drawComplete) { queueOrSendMessage(H.TRANSLUCENT_CONVERSION_COMPLETE, token, drawComplete ? 1 : 0); } public void setProcessState(int state) { updateProcessState(state, true); } public void updateProcessState(int processState, boolean fromIpc) { synchronized (this) { if (mLastProcessState != processState) { mLastProcessState = processState; // Update Dalvik state here based on ActivityManager.PROCESS_STATE_* constants. if (false) { Slog.i(TAG, "******************* PROCESS STATE CHANGED TO: " + processState + (fromIpc ? " (from ipc": "")); } } } } } private class H extends Handler { Loading core/java/android/app/ApplicationThreadNative.java +44 −14 Original line number Diff line number Diff line Loading @@ -111,8 +111,9 @@ public abstract class ApplicationThreadNative extends Binder { data.enforceInterface(IApplicationThread.descriptor); IBinder b = data.readStrongBinder(); int procState = data.readInt(); boolean isForward = data.readInt() != 0; scheduleResumeActivity(b, isForward); scheduleResumeActivity(b, procState, isForward); return true; } Loading @@ -134,6 +135,7 @@ public abstract class ApplicationThreadNative extends Binder ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data); Configuration curConfig = Configuration.CREATOR.createFromParcel(data); CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); int procState = data.readInt(); Bundle state = data.readBundle(); List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR); List<Intent> pi = data.createTypedArrayList(Intent.CREATOR); Loading @@ -143,8 +145,8 @@ public abstract class ApplicationThreadNative extends Binder ParcelFileDescriptor profileFd = data.readInt() != 0 ? data.readFileDescriptor() : null; boolean autoStopProfiler = data.readInt() != 0; scheduleLaunchActivity(intent, b, ident, info, curConfig, compatInfo, state, ri, pi, notResumed, isForward, profileName, profileFd, autoStopProfiler); scheduleLaunchActivity(intent, b, ident, info, curConfig, compatInfo, procState, state, ri, pi, notResumed, isForward, profileName, profileFd, autoStopProfiler); return true; } Loading Loading @@ -194,8 +196,9 @@ public abstract class ApplicationThreadNative extends Binder Bundle resultExtras = data.readBundle(); boolean sync = data.readInt() != 0; int sendingUser = data.readInt(); int processState = data.readInt(); scheduleReceiver(intent, info, compatInfo, resultCode, resultData, resultExtras, sync, sendingUser); resultExtras, sync, sendingUser, processState); return true; } Loading @@ -204,7 +207,8 @@ public abstract class ApplicationThreadNative extends Binder IBinder token = data.readStrongBinder(); ServiceInfo info = ServiceInfo.CREATOR.createFromParcel(data); CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); scheduleCreateService(token, info, compatInfo); int processState = data.readInt(); scheduleCreateService(token, info, compatInfo, processState); return true; } Loading @@ -213,7 +217,8 @@ public abstract class ApplicationThreadNative extends Binder IBinder token = data.readStrongBinder(); Intent intent = Intent.CREATOR.createFromParcel(data); boolean rebind = data.readInt() != 0; scheduleBindService(token, intent, rebind); int processState = data.readInt(); scheduleBindService(token, intent, rebind, processState); return true; } Loading Loading @@ -384,8 +389,9 @@ public abstract class ApplicationThreadNative extends Binder boolean ordered = data.readInt() != 0; boolean sticky = data.readInt() != 0; int sendingUser = data.readInt(); int processState = data.readInt(); scheduleRegisteredReceiver(receiver, intent, resultCode, dataStr, extras, ordered, sticky, sendingUser); resultCode, dataStr, extras, ordered, sticky, sendingUser, processState); return true; } Loading Loading @@ -613,6 +619,15 @@ public abstract class ApplicationThreadNative extends Binder reply.writeNoException(); return true; } case SET_PROCESS_STATE_TRANSACTION: { data.enforceInterface(IApplicationThread.descriptor); int state = data.readInt(); setProcessState(state); reply.writeNoException(); return true; } } return super.onTransact(code, data, reply, flags); Loading Loading @@ -682,11 +697,12 @@ class ApplicationThreadProxy implements IApplicationThread { data.recycle(); } public final void scheduleResumeActivity(IBinder token, boolean isForward) public final void scheduleResumeActivity(IBinder token, int procState, boolean isForward) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); data.writeStrongBinder(token); data.writeInt(procState); data.writeInt(isForward ? 1 : 0); mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); Loading @@ -706,7 +722,7 @@ class ApplicationThreadProxy implements IApplicationThread { public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident, ActivityInfo info, Configuration curConfig, CompatibilityInfo compatInfo, Bundle state, List<ResultInfo> pendingResults, int procState, Bundle state, List<ResultInfo> pendingResults, List<Intent> pendingNewIntents, boolean notResumed, boolean isForward, String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler) throws RemoteException { Loading @@ -718,6 +734,7 @@ class ApplicationThreadProxy implements IApplicationThread { info.writeToParcel(data, 0); curConfig.writeToParcel(data, 0); compatInfo.writeToParcel(data, 0); data.writeInt(procState); data.writeBundle(state); data.writeTypedList(pendingResults); data.writeTypedList(pendingNewIntents); Loading Loading @@ -783,7 +800,7 @@ class ApplicationThreadProxy implements IApplicationThread { public final void scheduleReceiver(Intent intent, ActivityInfo info, CompatibilityInfo compatInfo, int resultCode, String resultData, Bundle map, boolean sync, int sendingUser) throws RemoteException { Bundle map, boolean sync, int sendingUser, int processState) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); intent.writeToParcel(data, 0); Loading @@ -794,6 +811,7 @@ class ApplicationThreadProxy implements IApplicationThread { data.writeBundle(map); data.writeInt(sync ? 1 : 0); data.writeInt(sendingUser); data.writeInt(processState); mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); Loading Loading @@ -823,24 +841,26 @@ class ApplicationThreadProxy implements IApplicationThread { } public final void scheduleCreateService(IBinder token, ServiceInfo info, CompatibilityInfo compatInfo) throws RemoteException { CompatibilityInfo compatInfo, int processState) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); data.writeStrongBinder(token); info.writeToParcel(data, 0); compatInfo.writeToParcel(data, 0); data.writeInt(processState); mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); } public final void scheduleBindService(IBinder token, Intent intent, boolean rebind) throws RemoteException { public final void scheduleBindService(IBinder token, Intent intent, boolean rebind, int processState) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); data.writeStrongBinder(token); intent.writeToParcel(data, 0); data.writeInt(rebind ? 1 : 0); data.writeInt(processState); mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); Loading Loading @@ -1023,7 +1043,7 @@ class ApplicationThreadProxy implements IApplicationThread { public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, int resultCode, String dataStr, Bundle extras, boolean ordered, boolean sticky, int sendingUser) throws RemoteException { boolean sticky, int sendingUser, int processState) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); data.writeStrongBinder(receiver.asBinder()); Loading @@ -1034,6 +1054,7 @@ class ApplicationThreadProxy implements IApplicationThread { data.writeInt(ordered ? 1 : 0); data.writeInt(sticky ? 1 : 0); data.writeInt(sendingUser); data.writeInt(processState); mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); Loading Loading @@ -1238,4 +1259,13 @@ class ApplicationThreadProxy implements IApplicationThread { mRemote.transact(SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); } @Override public void setProcessState(int state) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); data.writeInt(state); mRemote.transact(SET_PROCESS_STATE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); } } core/java/android/app/IApplicationThread.java +9 −6 Original line number Diff line number Diff line Loading @@ -50,11 +50,12 @@ public interface IApplicationThread extends IInterface { int configChanges) throws RemoteException; void scheduleWindowVisibility(IBinder token, boolean showWindow) throws RemoteException; void scheduleSleeping(IBinder token, boolean sleeping) throws RemoteException; void scheduleResumeActivity(IBinder token, boolean isForward) throws RemoteException; void scheduleResumeActivity(IBinder token, int procState, boolean isForward) throws RemoteException; void scheduleSendResult(IBinder token, List<ResultInfo> results) throws RemoteException; void scheduleLaunchActivity(Intent intent, IBinder token, int ident, ActivityInfo info, Configuration curConfig, CompatibilityInfo compatInfo, Bundle state, List<ResultInfo> pendingResults, int procState, Bundle state, List<ResultInfo> pendingResults, List<Intent> pendingNewIntents, boolean notResumed, boolean isForward, String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler) throws RemoteException; Loading @@ -66,7 +67,7 @@ public interface IApplicationThread extends IInterface { int configChanges) throws RemoteException; void scheduleReceiver(Intent intent, ActivityInfo info, CompatibilityInfo compatInfo, int resultCode, String data, Bundle extras, boolean sync, int sendingUser) throws RemoteException; int sendingUser, int processState) throws RemoteException; static final int BACKUP_MODE_INCREMENTAL = 0; static final int BACKUP_MODE_FULL = 1; static final int BACKUP_MODE_RESTORE = 2; Loading @@ -76,9 +77,9 @@ public interface IApplicationThread extends IInterface { void scheduleDestroyBackupAgent(ApplicationInfo app, CompatibilityInfo compatInfo) throws RemoteException; void scheduleCreateService(IBinder token, ServiceInfo info, CompatibilityInfo compatInfo) throws RemoteException; CompatibilityInfo compatInfo, int processState) throws RemoteException; void scheduleBindService(IBinder token, Intent intent, boolean rebind) throws RemoteException; Intent intent, boolean rebind, int processState) throws RemoteException; void scheduleUnbindService(IBinder token, Intent intent) throws RemoteException; void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId, Loading Loading @@ -108,7 +109,7 @@ public interface IApplicationThread extends IInterface { throws RemoteException; void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, int resultCode, String data, Bundle extras, boolean ordered, boolean sticky, int sendingUser) throws RemoteException; boolean sticky, int sendingUser, int processState) throws RemoteException; void scheduleLowMemory() throws RemoteException; void scheduleActivityConfigurationChanged(IBinder token) throws RemoteException; void profilerControl(boolean start, String path, ParcelFileDescriptor fd, int profileType) Loading @@ -135,6 +136,7 @@ public interface IApplicationThread extends IInterface { throws RemoteException; void scheduleTranslucentConversionComplete(IBinder token, boolean timeout) throws RemoteException; void setProcessState(int state) throws RemoteException; String descriptor = "android.app.IApplicationThread"; Loading Loading @@ -186,4 +188,5 @@ public interface IApplicationThread extends IInterface { int UNSTABLE_PROVIDER_DIED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+46; int REQUEST_ACTIVITY_EXTRAS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+47; int SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+48; int SET_PROCESS_STATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+49; } services/java/com/android/server/am/ActiveServices.java +6 −2 Original line number Diff line number Diff line Loading @@ -852,7 +852,9 @@ public final class ActiveServices { if ((!i.requested || rebind) && i.apps.size() > 0) { try { bumpServiceExecutingLocked(r, "bind"); r.app.thread.scheduleBindService(r, i.intent.getIntent(), rebind); r.app.forceProcessStateUpTo(ActivityManager.PROCESS_STATE_SERVICE); r.app.thread.scheduleBindService(r, i.intent.getIntent(), rebind, r.app.repProcState); if (!rebind) { i.requested = true; } Loading Loading @@ -1127,8 +1129,10 @@ public final class ActiveServices { r.stats.startLaunchedLocked(); } mAm.ensurePackageDexOpt(r.serviceInfo.packageName); app.forceProcessStateUpTo(ActivityManager.PROCESS_STATE_SERVICE); app.thread.scheduleCreateService(r, r.serviceInfo, mAm.compatibilityInfoForPackageLocked(r.serviceInfo.applicationInfo)); mAm.compatibilityInfoForPackageLocked(r.serviceInfo.applicationInfo), app.repProcState); r.postNotification(); created = true; } finally { Loading Loading
core/java/android/app/ActivityManager.java +33 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,39 @@ public class ActivityManager { /** @hide User operation call: given user id is the current user, can't be stopped. */ public static final int USER_OP_IS_CURRENT = -2; /** @hide Process is a persistent system process. */ public static final int PROCESS_STATE_PERSISTENT = 0; /** @hide Process is a persistent system process and is doing UI. */ public static final int PROCESS_STATE_PERSISTENT_UI = 1; /** @hide Process is hosting the current top activity. */ public static final int PROCESS_STATE_TOP = 2; /** @hide Process is important to the user, and something they are aware of. */ public static final int PROCESS_STATE_IMPORTANT_PERCEPTIBLE = 3; /** @hide Process is important to the user, but not something they are aware of. */ public static final int PROCESS_STATE_IMPORTANT_BACKGROUND = 4; /** @hide Process is in the background running a receiver. */ public static final int PROCESS_STATE_RECEIVER = 5; /** @hide Process is in the background running a backup/restore operation. */ public static final int PROCESS_STATE_BACKUP = 6; /** @hide Process is in the background running a service. */ public static final int PROCESS_STATE_SERVICE = 7; /** @hide Process is in the background but hosts the home activity. */ public static final int PROCESS_STATE_HOME = 8; /** @hide Process is in the background but hosts the last shown activity. */ public static final int PROCESS_STATE_LAST_ACTIVITY = 9; /** @hide Process is being cached for later use. */ public static final int PROCESS_STATE_CACHED = 10; /*package*/ ActivityManager(Context context, Handler handler) { mContext = context; mHandler = handler; Loading
core/java/android/app/ActivityThread.java +35 −6 Original line number Diff line number Diff line Loading @@ -547,6 +547,8 @@ public final class ActivityThread { // Formatting for checkin service - update version if row format changes private static final int ACTIVITY_THREAD_CHECKIN_VERSION = 3; private int mLastProcessState = -1; private void updatePendingConfiguration(Configuration config) { synchronized (mResourcesManager) { if (mPendingConfiguration == null || Loading Loading @@ -582,7 +584,9 @@ public final class ActivityThread { queueOrSendMessage(H.SLEEPING, token, sleeping ? 1 : 0); } public final void scheduleResumeActivity(IBinder token, boolean isForward) { public final void scheduleResumeActivity(IBinder token, int processState, boolean isForward) { updateProcessState(processState, false); queueOrSendMessage(H.RESUME_ACTIVITY, token, isForward ? 1 : 0); } Loading @@ -597,9 +601,12 @@ public final class ActivityThread { // activity itself back to the activity manager. (matters more with ipc) public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident, ActivityInfo info, Configuration curConfig, CompatibilityInfo compatInfo, Bundle state, List<ResultInfo> pendingResults, int procState, Bundle state, List<ResultInfo> pendingResults, List<Intent> pendingNewIntents, boolean notResumed, boolean isForward, String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler) { updateProcessState(procState, false); ActivityClientRecord r = new ActivityClientRecord(); r.token = token; Loading Loading @@ -647,7 +654,8 @@ public final class ActivityThread { public final void scheduleReceiver(Intent intent, ActivityInfo info, CompatibilityInfo compatInfo, int resultCode, String data, Bundle extras, boolean sync, int sendingUser) { boolean sync, int sendingUser, int processState) { updateProcessState(processState, false); ReceiverData r = new ReceiverData(intent, resultCode, data, extras, sync, false, mAppThread.asBinder(), sendingUser); r.info = info; Loading Loading @@ -675,7 +683,8 @@ public final class ActivityThread { } public final void scheduleCreateService(IBinder token, ServiceInfo info, CompatibilityInfo compatInfo) { ServiceInfo info, CompatibilityInfo compatInfo, int processState) { updateProcessState(processState, false); CreateServiceData s = new CreateServiceData(); s.token = token; s.info = info; Loading @@ -685,7 +694,8 @@ public final class ActivityThread { } public final void scheduleBindService(IBinder token, Intent intent, boolean rebind) { boolean rebind, int processState) { updateProcessState(processState, false); BindServiceData s = new BindServiceData(); s.token = token; s.intent = intent; Loading Loading @@ -810,7 +820,8 @@ public final class ActivityThread { // applies transaction ordering per object for such calls. public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, int resultCode, String dataStr, Bundle extras, boolean ordered, boolean sticky, int sendingUser) throws RemoteException { boolean sticky, int sendingUser, int processState) throws RemoteException { updateProcessState(processState, false); receiver.performReceive(intent, resultCode, dataStr, extras, ordered, sticky, sendingUser); } Loading Loading @@ -1218,6 +1229,24 @@ public final class ActivityThread { public void scheduleTranslucentConversionComplete(IBinder token, boolean drawComplete) { queueOrSendMessage(H.TRANSLUCENT_CONVERSION_COMPLETE, token, drawComplete ? 1 : 0); } public void setProcessState(int state) { updateProcessState(state, true); } public void updateProcessState(int processState, boolean fromIpc) { synchronized (this) { if (mLastProcessState != processState) { mLastProcessState = processState; // Update Dalvik state here based on ActivityManager.PROCESS_STATE_* constants. if (false) { Slog.i(TAG, "******************* PROCESS STATE CHANGED TO: " + processState + (fromIpc ? " (from ipc": "")); } } } } } private class H extends Handler { Loading
core/java/android/app/ApplicationThreadNative.java +44 −14 Original line number Diff line number Diff line Loading @@ -111,8 +111,9 @@ public abstract class ApplicationThreadNative extends Binder { data.enforceInterface(IApplicationThread.descriptor); IBinder b = data.readStrongBinder(); int procState = data.readInt(); boolean isForward = data.readInt() != 0; scheduleResumeActivity(b, isForward); scheduleResumeActivity(b, procState, isForward); return true; } Loading @@ -134,6 +135,7 @@ public abstract class ApplicationThreadNative extends Binder ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data); Configuration curConfig = Configuration.CREATOR.createFromParcel(data); CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); int procState = data.readInt(); Bundle state = data.readBundle(); List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR); List<Intent> pi = data.createTypedArrayList(Intent.CREATOR); Loading @@ -143,8 +145,8 @@ public abstract class ApplicationThreadNative extends Binder ParcelFileDescriptor profileFd = data.readInt() != 0 ? data.readFileDescriptor() : null; boolean autoStopProfiler = data.readInt() != 0; scheduleLaunchActivity(intent, b, ident, info, curConfig, compatInfo, state, ri, pi, notResumed, isForward, profileName, profileFd, autoStopProfiler); scheduleLaunchActivity(intent, b, ident, info, curConfig, compatInfo, procState, state, ri, pi, notResumed, isForward, profileName, profileFd, autoStopProfiler); return true; } Loading Loading @@ -194,8 +196,9 @@ public abstract class ApplicationThreadNative extends Binder Bundle resultExtras = data.readBundle(); boolean sync = data.readInt() != 0; int sendingUser = data.readInt(); int processState = data.readInt(); scheduleReceiver(intent, info, compatInfo, resultCode, resultData, resultExtras, sync, sendingUser); resultExtras, sync, sendingUser, processState); return true; } Loading @@ -204,7 +207,8 @@ public abstract class ApplicationThreadNative extends Binder IBinder token = data.readStrongBinder(); ServiceInfo info = ServiceInfo.CREATOR.createFromParcel(data); CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); scheduleCreateService(token, info, compatInfo); int processState = data.readInt(); scheduleCreateService(token, info, compatInfo, processState); return true; } Loading @@ -213,7 +217,8 @@ public abstract class ApplicationThreadNative extends Binder IBinder token = data.readStrongBinder(); Intent intent = Intent.CREATOR.createFromParcel(data); boolean rebind = data.readInt() != 0; scheduleBindService(token, intent, rebind); int processState = data.readInt(); scheduleBindService(token, intent, rebind, processState); return true; } Loading Loading @@ -384,8 +389,9 @@ public abstract class ApplicationThreadNative extends Binder boolean ordered = data.readInt() != 0; boolean sticky = data.readInt() != 0; int sendingUser = data.readInt(); int processState = data.readInt(); scheduleRegisteredReceiver(receiver, intent, resultCode, dataStr, extras, ordered, sticky, sendingUser); resultCode, dataStr, extras, ordered, sticky, sendingUser, processState); return true; } Loading Loading @@ -613,6 +619,15 @@ public abstract class ApplicationThreadNative extends Binder reply.writeNoException(); return true; } case SET_PROCESS_STATE_TRANSACTION: { data.enforceInterface(IApplicationThread.descriptor); int state = data.readInt(); setProcessState(state); reply.writeNoException(); return true; } } return super.onTransact(code, data, reply, flags); Loading Loading @@ -682,11 +697,12 @@ class ApplicationThreadProxy implements IApplicationThread { data.recycle(); } public final void scheduleResumeActivity(IBinder token, boolean isForward) public final void scheduleResumeActivity(IBinder token, int procState, boolean isForward) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); data.writeStrongBinder(token); data.writeInt(procState); data.writeInt(isForward ? 1 : 0); mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); Loading @@ -706,7 +722,7 @@ class ApplicationThreadProxy implements IApplicationThread { public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident, ActivityInfo info, Configuration curConfig, CompatibilityInfo compatInfo, Bundle state, List<ResultInfo> pendingResults, int procState, Bundle state, List<ResultInfo> pendingResults, List<Intent> pendingNewIntents, boolean notResumed, boolean isForward, String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler) throws RemoteException { Loading @@ -718,6 +734,7 @@ class ApplicationThreadProxy implements IApplicationThread { info.writeToParcel(data, 0); curConfig.writeToParcel(data, 0); compatInfo.writeToParcel(data, 0); data.writeInt(procState); data.writeBundle(state); data.writeTypedList(pendingResults); data.writeTypedList(pendingNewIntents); Loading Loading @@ -783,7 +800,7 @@ class ApplicationThreadProxy implements IApplicationThread { public final void scheduleReceiver(Intent intent, ActivityInfo info, CompatibilityInfo compatInfo, int resultCode, String resultData, Bundle map, boolean sync, int sendingUser) throws RemoteException { Bundle map, boolean sync, int sendingUser, int processState) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); intent.writeToParcel(data, 0); Loading @@ -794,6 +811,7 @@ class ApplicationThreadProxy implements IApplicationThread { data.writeBundle(map); data.writeInt(sync ? 1 : 0); data.writeInt(sendingUser); data.writeInt(processState); mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); Loading Loading @@ -823,24 +841,26 @@ class ApplicationThreadProxy implements IApplicationThread { } public final void scheduleCreateService(IBinder token, ServiceInfo info, CompatibilityInfo compatInfo) throws RemoteException { CompatibilityInfo compatInfo, int processState) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); data.writeStrongBinder(token); info.writeToParcel(data, 0); compatInfo.writeToParcel(data, 0); data.writeInt(processState); mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); } public final void scheduleBindService(IBinder token, Intent intent, boolean rebind) throws RemoteException { public final void scheduleBindService(IBinder token, Intent intent, boolean rebind, int processState) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); data.writeStrongBinder(token); intent.writeToParcel(data, 0); data.writeInt(rebind ? 1 : 0); data.writeInt(processState); mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); Loading Loading @@ -1023,7 +1043,7 @@ class ApplicationThreadProxy implements IApplicationThread { public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, int resultCode, String dataStr, Bundle extras, boolean ordered, boolean sticky, int sendingUser) throws RemoteException { boolean sticky, int sendingUser, int processState) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); data.writeStrongBinder(receiver.asBinder()); Loading @@ -1034,6 +1054,7 @@ class ApplicationThreadProxy implements IApplicationThread { data.writeInt(ordered ? 1 : 0); data.writeInt(sticky ? 1 : 0); data.writeInt(sendingUser); data.writeInt(processState); mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); Loading Loading @@ -1238,4 +1259,13 @@ class ApplicationThreadProxy implements IApplicationThread { mRemote.transact(SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); } @Override public void setProcessState(int state) throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); data.writeInt(state); mRemote.transact(SET_PROCESS_STATE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); } }
core/java/android/app/IApplicationThread.java +9 −6 Original line number Diff line number Diff line Loading @@ -50,11 +50,12 @@ public interface IApplicationThread extends IInterface { int configChanges) throws RemoteException; void scheduleWindowVisibility(IBinder token, boolean showWindow) throws RemoteException; void scheduleSleeping(IBinder token, boolean sleeping) throws RemoteException; void scheduleResumeActivity(IBinder token, boolean isForward) throws RemoteException; void scheduleResumeActivity(IBinder token, int procState, boolean isForward) throws RemoteException; void scheduleSendResult(IBinder token, List<ResultInfo> results) throws RemoteException; void scheduleLaunchActivity(Intent intent, IBinder token, int ident, ActivityInfo info, Configuration curConfig, CompatibilityInfo compatInfo, Bundle state, List<ResultInfo> pendingResults, int procState, Bundle state, List<ResultInfo> pendingResults, List<Intent> pendingNewIntents, boolean notResumed, boolean isForward, String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler) throws RemoteException; Loading @@ -66,7 +67,7 @@ public interface IApplicationThread extends IInterface { int configChanges) throws RemoteException; void scheduleReceiver(Intent intent, ActivityInfo info, CompatibilityInfo compatInfo, int resultCode, String data, Bundle extras, boolean sync, int sendingUser) throws RemoteException; int sendingUser, int processState) throws RemoteException; static final int BACKUP_MODE_INCREMENTAL = 0; static final int BACKUP_MODE_FULL = 1; static final int BACKUP_MODE_RESTORE = 2; Loading @@ -76,9 +77,9 @@ public interface IApplicationThread extends IInterface { void scheduleDestroyBackupAgent(ApplicationInfo app, CompatibilityInfo compatInfo) throws RemoteException; void scheduleCreateService(IBinder token, ServiceInfo info, CompatibilityInfo compatInfo) throws RemoteException; CompatibilityInfo compatInfo, int processState) throws RemoteException; void scheduleBindService(IBinder token, Intent intent, boolean rebind) throws RemoteException; Intent intent, boolean rebind, int processState) throws RemoteException; void scheduleUnbindService(IBinder token, Intent intent) throws RemoteException; void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId, Loading Loading @@ -108,7 +109,7 @@ public interface IApplicationThread extends IInterface { throws RemoteException; void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, int resultCode, String data, Bundle extras, boolean ordered, boolean sticky, int sendingUser) throws RemoteException; boolean sticky, int sendingUser, int processState) throws RemoteException; void scheduleLowMemory() throws RemoteException; void scheduleActivityConfigurationChanged(IBinder token) throws RemoteException; void profilerControl(boolean start, String path, ParcelFileDescriptor fd, int profileType) Loading @@ -135,6 +136,7 @@ public interface IApplicationThread extends IInterface { throws RemoteException; void scheduleTranslucentConversionComplete(IBinder token, boolean timeout) throws RemoteException; void setProcessState(int state) throws RemoteException; String descriptor = "android.app.IApplicationThread"; Loading Loading @@ -186,4 +188,5 @@ public interface IApplicationThread extends IInterface { int UNSTABLE_PROVIDER_DIED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+46; int REQUEST_ACTIVITY_EXTRAS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+47; int SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+48; int SET_PROCESS_STATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+49; }
services/java/com/android/server/am/ActiveServices.java +6 −2 Original line number Diff line number Diff line Loading @@ -852,7 +852,9 @@ public final class ActiveServices { if ((!i.requested || rebind) && i.apps.size() > 0) { try { bumpServiceExecutingLocked(r, "bind"); r.app.thread.scheduleBindService(r, i.intent.getIntent(), rebind); r.app.forceProcessStateUpTo(ActivityManager.PROCESS_STATE_SERVICE); r.app.thread.scheduleBindService(r, i.intent.getIntent(), rebind, r.app.repProcState); if (!rebind) { i.requested = true; } Loading Loading @@ -1127,8 +1129,10 @@ public final class ActiveServices { r.stats.startLaunchedLocked(); } mAm.ensurePackageDexOpt(r.serviceInfo.packageName); app.forceProcessStateUpTo(ActivityManager.PROCESS_STATE_SERVICE); app.thread.scheduleCreateService(r, r.serviceInfo, mAm.compatibilityInfoForPackageLocked(r.serviceInfo.applicationInfo)); mAm.compatibilityInfoForPackageLocked(r.serviceInfo.applicationInfo), app.repProcState); r.postNotification(); created = true; } finally { Loading