Loading core/java/android/app/Activity.java +2 −26 Original line number Diff line number Diff line Loading @@ -1631,35 +1631,11 @@ public class Activity extends ContextThemeWrapper } /** * @deprecated This functionality will be removed in the future; please do * not use. * * Control whether this activity is required to be persistent. By default * activities are not persistent; setting this to true will prevent the * system from stopping this activity or its process when running low on * resources. * * <p><em>You should avoid using this method</em>, it has severe negative * consequences on how well the system can manage its resources. A better * approach is to implement an application service that you control with * {@link Context#startService} and {@link Context#stopService}. * * @param isPersistent Control whether the current activity must be * persistent, true if so, false for the normal * behavior. * @deprecated As of {@link android.os.Build.VERSION_CODES#GINGERBREAD} * this is a no-op. */ @Deprecated public void setPersistent(boolean isPersistent) { if (mParent == null) { try { ActivityManagerNative.getDefault() .setPersistent(mToken, isPersistent); } catch (RemoteException e) { // Empty } } else { throw new RuntimeException("setPersistent() not yet supported for embedded activities"); } } /** Loading core/java/android/app/ActivityManagerNative.java +0 −23 Original line number Diff line number Diff line Loading @@ -345,17 +345,6 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } case SET_PERSISTENT_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder token = data.readStrongBinder(); boolean isPersistent = data.readInt() != 0; if (token != null) { setPersistent(token, isPersistent); } reply.writeNoException(); return true; } case ATTACH_APPLICATION_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IApplicationThread app = ApplicationThreadNative.asInterface( Loading Loading @@ -1589,18 +1578,6 @@ class ActivityManagerProxy implements IActivityManager data.recycle(); reply.recycle(); } public void setPersistent(IBinder token, boolean isPersistent) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeStrongBinder(token); data.writeInt(isPersistent ? 1 : 0); mRemote.transact(SET_PERSISTENT_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); reply.recycle(); } public void attachApplication(IApplicationThread app) throws RemoteException { Parcel data = Parcel.obtain(); Loading core/java/android/app/IActivityManager.java +1 −2 Original line number Diff line number Diff line Loading @@ -116,7 +116,6 @@ public interface IActivityManager extends IInterface { public void unbroadcastIntent(IApplicationThread caller, Intent intent) throws RemoteException; /* oneway */ public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException; public void setPersistent(IBinder token, boolean isPersistent) throws RemoteException; public void attachApplication(IApplicationThread app) throws RemoteException; /* oneway */ public void activityIdle(IBinder token, Configuration config) throws RemoteException; Loading Loading @@ -444,7 +443,7 @@ public interface IActivityManager extends IInterface { int REPORT_THUMBNAIL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+27; int GET_CONTENT_PROVIDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+28; 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; Loading services/java/com/android/server/am/ActivityManagerService.java +3 −88 Original line number Diff line number Diff line Loading @@ -2993,84 +2993,6 @@ public final class ActivityManagerService extends ActivityManagerNative } } final void decPersistentCountLocked(ProcessRecord app) { app.persistentActivities--; if (app.persistentActivities > 0) { // Still more of 'em... return; } if (app.persistent) { // Ah, but the application itself is persistent. Whatever! return; } // App is no longer persistent... make sure it and the ones // following it in the LRU list have the correc oom_adj. updateOomAdjLocked(); } public void setPersistent(IBinder token, boolean isPersistent) { if (checkCallingPermission(android.Manifest.permission.PERSISTENT_ACTIVITY) != PackageManager.PERMISSION_GRANTED) { String msg = "Permission Denial: setPersistent() from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid() + " requires " + android.Manifest.permission.PERSISTENT_ACTIVITY; Slog.w(TAG, msg); throw new SecurityException(msg); } synchronized(this) { int index = mMainStack.indexOfTokenLocked(token); if (index < 0) { return; } ActivityRecord r = (ActivityRecord)mMainStack.mHistory.get(index); ProcessRecord app = r.app; if (localLOGV) Slog.v( TAG, "Setting persistence " + isPersistent + ": " + r); if (isPersistent) { if (r.persistent) { // Okay okay, I heard you already! if (localLOGV) Slog.v(TAG, "Already persistent!"); return; } r.persistent = true; app.persistentActivities++; if (localLOGV) Slog.v(TAG, "Num persistent now: " + app.persistentActivities); if (app.persistentActivities > 1) { // We aren't the first... if (localLOGV) Slog.v(TAG, "Not the first!"); return; } if (app.persistent) { // This would be redundant. if (localLOGV) Slog.v(TAG, "App is persistent!"); return; } // App is now persistent... make sure it and the ones // following it now have the correct oom_adj. final long origId = Binder.clearCallingIdentity(); updateOomAdjLocked(); Binder.restoreCallingIdentity(origId); } else { if (!r.persistent) { // Okay okay, I heard you already! return; } r.persistent = false; final long origId = Binder.clearCallingIdentity(); decPersistentCountLocked(app); Binder.restoreCallingIdentity(origId); } } } public boolean clearApplicationUserData(final String packageName, final IPackageDataObserver observer) { int uid = Binder.getCallingUid(); Loading Loading @@ -11585,11 +11507,6 @@ public final class ActivityManagerService extends ActivityManagerNative adj = FOREGROUND_APP_ADJ; schedGroup = Process.THREAD_GROUP_DEFAULT; app.adjType = "instrumentation"; } else if (app.persistentActivities > 0) { // Special persistent activities... shouldn't be used these days. adj = FOREGROUND_APP_ADJ; schedGroup = Process.THREAD_GROUP_DEFAULT; app.adjType = "persistent"; } else if (app.curReceiver != null || (mPendingBroadcast != null && mPendingBroadcast.curApp == app)) { // An app that is currently receiving a broadcast also Loading Loading @@ -12313,8 +12230,7 @@ public final class ActivityManagerService extends ActivityManagerNative final ProcessRecord app = mLruProcesses.get(i); if (app.persistent || app.services.size() != 0 || app.curReceiver != null || app.persistentActivities > 0) { || app.curReceiver != null) { // Don't count processes holding services against our // maximum process count. if (localLOGV) Slog.v( Loading Loading @@ -12379,8 +12295,7 @@ public final class ActivityManagerService extends ActivityManagerNative // Quit the application only if we have a state saved for // all of its activities. boolean canQuit = !app.persistent && app.curReceiver == null && app.services.size() == 0 && app.persistentActivities == 0; && app.services.size() == 0; int NUMA = app.activities.size(); int j; if (Config.LOGV) Slog.v( Loading Loading @@ -12444,7 +12359,7 @@ public final class ActivityManagerService extends ActivityManagerNative // We can finish this one if we have its icicle saved and // it is not persistent. if ((r.haveState || !r.stateNotNeeded) && !r.visible && r.stopped && !r.persistent && !r.finishing) { && r.stopped && !r.finishing) { final int origSize = mMainStack.mLRUActivities.size(); r.stack.destroyActivityLocked(r, true); Loading services/java/com/android/server/am/ActivityRecord.java +0 −3 Original line number Diff line number Diff line Loading @@ -96,7 +96,6 @@ class ActivityRecord extends IApplicationToken.Stub { int configChangeFlags; // which config values have changed boolean keysPaused; // has key dispatching been paused for it? boolean inHistory; // are we in the history stack? boolean persistent; // requested to be persistent? int launchMode; // the launch mode activity attribute. boolean visible; // does this activity's window need to be shown? boolean waitingVisible; // true if waiting for a new act to become vis Loading Loading @@ -160,7 +159,6 @@ class ActivityRecord extends IApplicationToken.Stub { pw.print(" finishing="); pw.println(finishing); pw.print(prefix); pw.print("keysPaused="); pw.print(keysPaused); pw.print(" inHistory="); pw.print(inHistory); pw.print(" persistent="); pw.print(persistent); pw.print(" launchMode="); pw.println(launchMode); pw.print(prefix); pw.print("fullscreen="); pw.print(fullscreen); pw.print(" visible="); pw.print(visible); Loading Loading @@ -213,7 +211,6 @@ class ActivityRecord extends IApplicationToken.Stub { configDestroy = false; keysPaused = false; inHistory = false; persistent = false; visible = true; waitingVisible = false; nowVisible = false; Loading Loading
core/java/android/app/Activity.java +2 −26 Original line number Diff line number Diff line Loading @@ -1631,35 +1631,11 @@ public class Activity extends ContextThemeWrapper } /** * @deprecated This functionality will be removed in the future; please do * not use. * * Control whether this activity is required to be persistent. By default * activities are not persistent; setting this to true will prevent the * system from stopping this activity or its process when running low on * resources. * * <p><em>You should avoid using this method</em>, it has severe negative * consequences on how well the system can manage its resources. A better * approach is to implement an application service that you control with * {@link Context#startService} and {@link Context#stopService}. * * @param isPersistent Control whether the current activity must be * persistent, true if so, false for the normal * behavior. * @deprecated As of {@link android.os.Build.VERSION_CODES#GINGERBREAD} * this is a no-op. */ @Deprecated public void setPersistent(boolean isPersistent) { if (mParent == null) { try { ActivityManagerNative.getDefault() .setPersistent(mToken, isPersistent); } catch (RemoteException e) { // Empty } } else { throw new RuntimeException("setPersistent() not yet supported for embedded activities"); } } /** Loading
core/java/android/app/ActivityManagerNative.java +0 −23 Original line number Diff line number Diff line Loading @@ -345,17 +345,6 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } case SET_PERSISTENT_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IBinder token = data.readStrongBinder(); boolean isPersistent = data.readInt() != 0; if (token != null) { setPersistent(token, isPersistent); } reply.writeNoException(); return true; } case ATTACH_APPLICATION_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); IApplicationThread app = ApplicationThreadNative.asInterface( Loading Loading @@ -1589,18 +1578,6 @@ class ActivityManagerProxy implements IActivityManager data.recycle(); reply.recycle(); } public void setPersistent(IBinder token, boolean isPersistent) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeStrongBinder(token); data.writeInt(isPersistent ? 1 : 0); mRemote.transact(SET_PERSISTENT_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); reply.recycle(); } public void attachApplication(IApplicationThread app) throws RemoteException { Parcel data = Parcel.obtain(); Loading
core/java/android/app/IActivityManager.java +1 −2 Original line number Diff line number Diff line Loading @@ -116,7 +116,6 @@ public interface IActivityManager extends IInterface { public void unbroadcastIntent(IApplicationThread caller, Intent intent) throws RemoteException; /* oneway */ public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException; public void setPersistent(IBinder token, boolean isPersistent) throws RemoteException; public void attachApplication(IApplicationThread app) throws RemoteException; /* oneway */ public void activityIdle(IBinder token, Configuration config) throws RemoteException; Loading Loading @@ -444,7 +443,7 @@ public interface IActivityManager extends IInterface { int REPORT_THUMBNAIL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+27; int GET_CONTENT_PROVIDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+28; 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; Loading
services/java/com/android/server/am/ActivityManagerService.java +3 −88 Original line number Diff line number Diff line Loading @@ -2993,84 +2993,6 @@ public final class ActivityManagerService extends ActivityManagerNative } } final void decPersistentCountLocked(ProcessRecord app) { app.persistentActivities--; if (app.persistentActivities > 0) { // Still more of 'em... return; } if (app.persistent) { // Ah, but the application itself is persistent. Whatever! return; } // App is no longer persistent... make sure it and the ones // following it in the LRU list have the correc oom_adj. updateOomAdjLocked(); } public void setPersistent(IBinder token, boolean isPersistent) { if (checkCallingPermission(android.Manifest.permission.PERSISTENT_ACTIVITY) != PackageManager.PERMISSION_GRANTED) { String msg = "Permission Denial: setPersistent() from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid() + " requires " + android.Manifest.permission.PERSISTENT_ACTIVITY; Slog.w(TAG, msg); throw new SecurityException(msg); } synchronized(this) { int index = mMainStack.indexOfTokenLocked(token); if (index < 0) { return; } ActivityRecord r = (ActivityRecord)mMainStack.mHistory.get(index); ProcessRecord app = r.app; if (localLOGV) Slog.v( TAG, "Setting persistence " + isPersistent + ": " + r); if (isPersistent) { if (r.persistent) { // Okay okay, I heard you already! if (localLOGV) Slog.v(TAG, "Already persistent!"); return; } r.persistent = true; app.persistentActivities++; if (localLOGV) Slog.v(TAG, "Num persistent now: " + app.persistentActivities); if (app.persistentActivities > 1) { // We aren't the first... if (localLOGV) Slog.v(TAG, "Not the first!"); return; } if (app.persistent) { // This would be redundant. if (localLOGV) Slog.v(TAG, "App is persistent!"); return; } // App is now persistent... make sure it and the ones // following it now have the correct oom_adj. final long origId = Binder.clearCallingIdentity(); updateOomAdjLocked(); Binder.restoreCallingIdentity(origId); } else { if (!r.persistent) { // Okay okay, I heard you already! return; } r.persistent = false; final long origId = Binder.clearCallingIdentity(); decPersistentCountLocked(app); Binder.restoreCallingIdentity(origId); } } } public boolean clearApplicationUserData(final String packageName, final IPackageDataObserver observer) { int uid = Binder.getCallingUid(); Loading Loading @@ -11585,11 +11507,6 @@ public final class ActivityManagerService extends ActivityManagerNative adj = FOREGROUND_APP_ADJ; schedGroup = Process.THREAD_GROUP_DEFAULT; app.adjType = "instrumentation"; } else if (app.persistentActivities > 0) { // Special persistent activities... shouldn't be used these days. adj = FOREGROUND_APP_ADJ; schedGroup = Process.THREAD_GROUP_DEFAULT; app.adjType = "persistent"; } else if (app.curReceiver != null || (mPendingBroadcast != null && mPendingBroadcast.curApp == app)) { // An app that is currently receiving a broadcast also Loading Loading @@ -12313,8 +12230,7 @@ public final class ActivityManagerService extends ActivityManagerNative final ProcessRecord app = mLruProcesses.get(i); if (app.persistent || app.services.size() != 0 || app.curReceiver != null || app.persistentActivities > 0) { || app.curReceiver != null) { // Don't count processes holding services against our // maximum process count. if (localLOGV) Slog.v( Loading Loading @@ -12379,8 +12295,7 @@ public final class ActivityManagerService extends ActivityManagerNative // Quit the application only if we have a state saved for // all of its activities. boolean canQuit = !app.persistent && app.curReceiver == null && app.services.size() == 0 && app.persistentActivities == 0; && app.services.size() == 0; int NUMA = app.activities.size(); int j; if (Config.LOGV) Slog.v( Loading Loading @@ -12444,7 +12359,7 @@ public final class ActivityManagerService extends ActivityManagerNative // We can finish this one if we have its icicle saved and // it is not persistent. if ((r.haveState || !r.stateNotNeeded) && !r.visible && r.stopped && !r.persistent && !r.finishing) { && r.stopped && !r.finishing) { final int origSize = mMainStack.mLRUActivities.size(); r.stack.destroyActivityLocked(r, true); Loading
services/java/com/android/server/am/ActivityRecord.java +0 −3 Original line number Diff line number Diff line Loading @@ -96,7 +96,6 @@ class ActivityRecord extends IApplicationToken.Stub { int configChangeFlags; // which config values have changed boolean keysPaused; // has key dispatching been paused for it? boolean inHistory; // are we in the history stack? boolean persistent; // requested to be persistent? int launchMode; // the launch mode activity attribute. boolean visible; // does this activity's window need to be shown? boolean waitingVisible; // true if waiting for a new act to become vis Loading Loading @@ -160,7 +159,6 @@ class ActivityRecord extends IApplicationToken.Stub { pw.print(" finishing="); pw.println(finishing); pw.print(prefix); pw.print("keysPaused="); pw.print(keysPaused); pw.print(" inHistory="); pw.print(inHistory); pw.print(" persistent="); pw.print(persistent); pw.print(" launchMode="); pw.println(launchMode); pw.print(prefix); pw.print("fullscreen="); pw.print(fullscreen); pw.print(" visible="); pw.print(visible); Loading Loading @@ -213,7 +211,6 @@ class ActivityRecord extends IApplicationToken.Stub { configDestroy = false; keysPaused = false; inHistory = false; persistent = false; visible = true; waitingVisible = false; nowVisible = false; Loading