No, it will not, the Android application maintains its state while it works: (front and rear).
if you are looking for something that can span applications, different life cycles use something like SharedPreferences.
Relatively
if the system kills your application process and the user goes to your activity
This happens only when the android needs memory and must kill your activity in order to free up resources and your activity in the action stack. it has documented that this is a convenient way to support the user interface.
android documentation:
Background activity (activity that is not visible to the user and paused) is no longer critical, so the system can safely kill its process to restore memory for other front or visible processes. If his process should be killed when the user goes to action (which again becomes visible on the screen), his onCreate (android.os.Bundle) method will be called with the saved InstanceState, which was previously included in onSaveInstanceState (android .os.Bundle)
so that he can restart himself in the same state in which the user left him.
therefore, you should not expect InstanceState to be supported all the time. The source code of the operation in codegrep
Edit
by google search for android instance state I came to this Android resource recreating activity
When your activity is destroyed because the user clicks "Back" or the action ends, the system concept of the Activity instance disappears forever because the behavior indicates that the action is no longer required. However, if the system destroys the activity due to system restrictions (and not the usual behavior of the application), then although the actual instance of the Activity is absent, the system remembers that it existed so that if the user navigates to it, the system creates a new instance of the action using the set stored data, which describes the state of activity when it is destroyed. The stored data that the system uses to restore the previous state is called the "instance state" and is a set of key-value pairs stored in the Bundle object.
Edit 2 After digging around Android's internal elements, it seems like it's all about ActivityManagerNative
Whenever an action is paused, the state is passed using the Parcel object to the ActivityManager process.
public void activityPaused(IBinder token, Bundle state) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeStrongBinder(token); data.writeBundle(state); mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); reply.recycle(); }
And whenever an ActivityManagerNative creates an action, it passes that state back to the action using Parcel
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { switch (code) { case START_ACTIVITY_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder b = data.readStrongBinder(); IApplicationThread app = ApplicationThreadNative.asInterface(b); Intent intent = Intent.CREATOR.createFromParcel(data); String resolvedType = data.readString(); Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR); int grantedMode = data.readInt(); IBinder resultTo = data.readStrongBinder(); String resultWho = data.readString(); int requestCode = data.readInt(); boolean onlyIfNeeded = data.readInt() != 0; boolean debug = data.readInt() != 0; int result = startActivity(app, intent, resolvedType, grantedUriPermissions, grantedMode, resultTo, resultWho, requestCode, onlyIfNeeded, debug); reply.writeNoException(); reply.writeInt(result); return true; } .....