Its disabled by default for all apps and enabled only for system apps
(based on persistent flag's value)
ProcessRecord.java
ProcessRecord(BatteryStatsImpl.Uid.Proc _batteryStats,
IApplicationThread _thread,
ApplicationInfo _info, String _processName, int _uid) {
...
persistent = false;
...
}
On Nov 13, 1:22 am, Karim Yaghmour <
karim.yaghm...@opersys.com> wrote:
> Hi Dianne,
>
> Sorry to "revive" this, but can you point me to the code/mechanism in
> the AOSP that discriminates against non-platform apps making use of the
> "persistent" flag? IOW, where are we stopping market apps using
> "persistent=true" from getting installed and/or running?
>
> Thanks,
>
> --
> Karim Yaghmour
> CEO - Opersys inc. /www.opersys.comhttp://
twitter.com/karimyaghmour
>
> On 12-07-03 09:45 AM, Dianne Hackborn wrote:
>
>
>
>
>
>
>
> > I think I just answered this question...?
>
> > On Mon, Jul 2, 2012 at 10:01 AM, Cesar <
cesar.maior...@gmail.com
> > <mailto:
cesar.maior...@gmail.com>> wrote:
>
> > I know this is an old thread, but I have a related question.
>
> > I understand and appreciate your warnings about use of
> > android.persistent="true". That being said, I still need to do it.
> > So my question is one of implementation.
>
> > In order to make an app persistent, does it need to be compiled
> > into the platform image, or can it be a downloaded app (as long as
> > it has the platform signature)?
> > Thanks
>
> > On Saturday, June 25, 2011 3:11:52 AM UTC-4, Dianne Hackborn wrote:
>
> > You really should not be using this in anything except core
> > platform code. In the entire Android platform there is
> > exactly one thing that uses it: the phone app, which is the
> > thing that maintains the connection with the RIL and displays
> > the incoming call UI and such. (That is, very critical code
> > for a phone.)
>
> > (Actually I take that back, I believe that there is now
> > another persistent process, SystemUI, which is the thing that
> > shows the status bar and other well system UI. Also pretty
> > critical.)
>
> > Using this means that the overall platform has much less
> > flexibility dealing with low memory situations. Unless you
> > are writing code at the level of core platform code -- where
> > you are taking great care in memory use, avoiding memory
> > leaks, and generally not writing like an application -- I
> > really urge you to not use this facility.
>
> > On Fri, Jun 24, 2011 at 6:51 AM, AppCoder
> > <
dan.schm...@gmail.com <mailto:
dan.schm...@gmail.com>> wrote:
>
> > Works for preloaded applications, doesn't work for downloaded
> > applications. To achieve similar functionality for downloaded
> > applications use:
>
> >
http://developer.android.com/reference/android/app/Service.html#start...
>
> > To make 1 apk that "does the right thing" (in this case,
> > puts up
> > the notification if downloaded, or if it's preloaded let
> > the property
> > android:persistent take care of it) do something like:
>
> > ApplicationInfo appInfo =
> > getApplicationContext().getApplicationInfo();
> > if (((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
> > /* make a notification and put use startForeground
> > }
>
> > Expect "you shouldn't need to run all the time, this is
> > bad for the
> > battery and make the users hate you" responses soon. If you
> > can, follow the life cycle rules for a service and
> > save/restore your
> > state in the right on* methods.
>
> > On Jun 23, 11:10 pm, YongHak Park <
gdn...@gmail.com> wrote:
> > > I read following notification from developer site.
>
> > > "android:persistent
> > > Whether or not the application should remain running at
> > all times �
> > > "true" if it should, and "false" if not. The default
> > value is "false".
> > > Applications should not normally set this flag;
> > persistence mode is
> > > intended only for certain system applications."
>
> > > What I want to know is.. "android:persistent" is
> > supported to any
> > > application - preloaded app, downloaded app and so on..
>
> > > And..
> > > If an application sets the value as true and it is
> > killed by other
> > > application,
> > > dose it restart automatically? or it receives a specific
> > broadcast
> > > intent to decide restart or not.
>
> > > Can anyone tell me more information how
> > "android:persistent" works
> > > exactly?
>
> > > thanks..
>
> > --
> > You received this message because you are subscribed to
> > the Google Groups "android-platform" group.
> > To post to this group, send email to
> >
android-...@googlegroups.com
> > <mailto:
android-...@googlegroups.com>.
> > To unsubscribe from this group, send email to
> >
android-platfo...@googlegroups.com
> > <mailto:
android-platform%2Bunsu...@googlegroups.com>.
> > For more options, visit this group at
> >
http://groups.google.com/group/android-platform?hl=en.
>
> > --
> > Dianne Hackborn
> > Android framework engineer
> >
hack...@android.com <mailto:
hack...@android.com>
>
> > Note: please don't send private questions to me, as I don't
> > have time to provide private support, and so won't reply to
> > such e-mails. All such questions should be posted on public
> > forums, where I and others can see and answer them.
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "android-platform" group.
> > To view this discussion on the web visit
> >
https://groups.google.com/d/msg/android-platform/-/iBKXvtsh2C4J.
>
> > To post to this group, send email to
> >
android-...@googlegroups.com
> > <mailto:
android-...@googlegroups.com>.
> > To unsubscribe from this group, send email to
> >
android-platfo...@googlegroups.com
> > <mailto:
android-platform%2Bunsu...@googlegroups.com>.
> > For more options, visit this group at
> >
http://groups.google.com/group/android-platform?hl=en.
>
> > --
> > Dianne Hackborn
> > Android framework engineer
> >
hack...@android.com <mailto:
hack...@android.com>
>
> > Note: please don't send private questions to me, as I don't have time
> > to provide private support, and so won't reply to such e-mails. All
> > such questions should be posted on public forums, where I and others
> > can see and answer them.
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "android-platform" group.
> > To post to this group, send email to
android-...@googlegroups.com.
> > To unsubscribe from this group, send email to
> >
android-platfo...@googlegroups.com.
> > For more options, visit this group at
> >
http://groups.google.com/group/android-platform?hl=en.