Loading api/current.xml +40 −1 Original line number Diff line number Diff line Loading @@ -22200,6 +22200,17 @@ visibility="public" > </field> <field name="FLAG_FOREGROUND_SERVICE" type="int" transient="false" volatile="false" value="64" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="FLAG_INSISTENT" type="int" transient="false" Loading Loading @@ -23760,12 +23771,40 @@ synchronized="false" static="false" final="true" deprecated="not deprecated" deprecated="deprecated" visibility="public" > <parameter name="isForeground" type="boolean"> </parameter> </method> <method name="startForeground" return="void" abstract="false" native="false" synchronized="false" static="false" final="true" deprecated="not deprecated" visibility="public" > <parameter name="id" type="int"> </parameter> <parameter name="notification" type="android.app.Notification"> </parameter> </method> <method name="stopForeground" return="void" abstract="false" native="false" synchronized="false" static="false" final="true" deprecated="not deprecated" visibility="public" > <parameter name="removeNotification" type="boolean"> </parameter> </method> <method name="stopSelf" return="void" abstract="false" core/java/android/app/ActivityManagerNative.java +16 −7 Original line number Diff line number Diff line Loading @@ -39,9 +39,6 @@ import android.text.TextUtils; import android.util.Config; import android.util.Log; import java.io.FileNotFoundException; import java.io.FileDescriptor; import java.io.IOException; import java.util.ArrayList; import java.util.List; Loading Loading @@ -551,8 +548,13 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM data.enforceInterface(IActivityManager.descriptor); ComponentName className = ComponentName.readFromParcel(data); IBinder token = data.readStrongBinder(); boolean isForeground = data.readInt() != 0; setServiceForeground(className, token, isForeground); int id = data.readInt(); Notification notification = null; if (data.readInt() != 0) { notification = Notification.CREATOR.createFromParcel(data); } boolean removeNotification = data.readInt() != 0; setServiceForeground(className, token, id, notification, removeNotification); reply.writeNoException(); return true; } Loading Loading @@ -1664,13 +1666,20 @@ class ActivityManagerProxy implements IActivityManager return res; } public void setServiceForeground(ComponentName className, IBinder token, boolean isForeground) throws RemoteException { int id, Notification notification, boolean removeNotification) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); ComponentName.writeToParcel(className, data); data.writeStrongBinder(token); data.writeInt(isForeground ? 1 : 0); data.writeInt(id); if (notification != null) { data.writeInt(1); notification.writeToParcel(data, 0); } else { data.writeInt(0); } data.writeInt(removeNotification ? 1 : 0); mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); Loading core/java/android/app/IActivityManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -139,7 +139,7 @@ public interface IActivityManager extends IInterface { public boolean stopServiceToken(ComponentName className, IBinder token, int startId) throws RemoteException; public void setServiceForeground(ComponentName className, IBinder token, boolean isForeground) throws RemoteException; int id, Notification notification, boolean keepNotification) throws RemoteException; public int bindService(IApplicationThread caller, IBinder token, Intent service, String resolvedType, IServiceConnection connection, int flags) throws RemoteException; Loading core/java/android/app/Notification.java +7 −0 Original line number Diff line number Diff line Loading @@ -257,6 +257,13 @@ public class Notification implements Parcelable */ public static final int FLAG_NO_CLEAR = 0x00000020; /** * Bit to be bitwise-ored into the {@link #flags} field that should be * set if this notification represents a currently running service. This * will normally be set for you by {@link Service#startForeground}. */ public static final int FLAG_FOREGROUND_SERVICE = 0x00000040; public int flags; /** Loading core/java/android/app/NotificationManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,8 @@ public class NotificationManager private static INotificationManager sService; static private INotificationManager getService() /** @hide */ static public INotificationManager getService() { if (sService != null) { return sService; Loading Loading
api/current.xml +40 −1 Original line number Diff line number Diff line Loading @@ -22200,6 +22200,17 @@ visibility="public" > </field> <field name="FLAG_FOREGROUND_SERVICE" type="int" transient="false" volatile="false" value="64" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="FLAG_INSISTENT" type="int" transient="false" Loading Loading @@ -23760,12 +23771,40 @@ synchronized="false" static="false" final="true" deprecated="not deprecated" deprecated="deprecated" visibility="public" > <parameter name="isForeground" type="boolean"> </parameter> </method> <method name="startForeground" return="void" abstract="false" native="false" synchronized="false" static="false" final="true" deprecated="not deprecated" visibility="public" > <parameter name="id" type="int"> </parameter> <parameter name="notification" type="android.app.Notification"> </parameter> </method> <method name="stopForeground" return="void" abstract="false" native="false" synchronized="false" static="false" final="true" deprecated="not deprecated" visibility="public" > <parameter name="removeNotification" type="boolean"> </parameter> </method> <method name="stopSelf" return="void" abstract="false"
core/java/android/app/ActivityManagerNative.java +16 −7 Original line number Diff line number Diff line Loading @@ -39,9 +39,6 @@ import android.text.TextUtils; import android.util.Config; import android.util.Log; import java.io.FileNotFoundException; import java.io.FileDescriptor; import java.io.IOException; import java.util.ArrayList; import java.util.List; Loading Loading @@ -551,8 +548,13 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM data.enforceInterface(IActivityManager.descriptor); ComponentName className = ComponentName.readFromParcel(data); IBinder token = data.readStrongBinder(); boolean isForeground = data.readInt() != 0; setServiceForeground(className, token, isForeground); int id = data.readInt(); Notification notification = null; if (data.readInt() != 0) { notification = Notification.CREATOR.createFromParcel(data); } boolean removeNotification = data.readInt() != 0; setServiceForeground(className, token, id, notification, removeNotification); reply.writeNoException(); return true; } Loading Loading @@ -1664,13 +1666,20 @@ class ActivityManagerProxy implements IActivityManager return res; } public void setServiceForeground(ComponentName className, IBinder token, boolean isForeground) throws RemoteException { int id, Notification notification, boolean removeNotification) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); ComponentName.writeToParcel(className, data); data.writeStrongBinder(token); data.writeInt(isForeground ? 1 : 0); data.writeInt(id); if (notification != null) { data.writeInt(1); notification.writeToParcel(data, 0); } else { data.writeInt(0); } data.writeInt(removeNotification ? 1 : 0); mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); Loading
core/java/android/app/IActivityManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -139,7 +139,7 @@ public interface IActivityManager extends IInterface { public boolean stopServiceToken(ComponentName className, IBinder token, int startId) throws RemoteException; public void setServiceForeground(ComponentName className, IBinder token, boolean isForeground) throws RemoteException; int id, Notification notification, boolean keepNotification) throws RemoteException; public int bindService(IApplicationThread caller, IBinder token, Intent service, String resolvedType, IServiceConnection connection, int flags) throws RemoteException; Loading
core/java/android/app/Notification.java +7 −0 Original line number Diff line number Diff line Loading @@ -257,6 +257,13 @@ public class Notification implements Parcelable */ public static final int FLAG_NO_CLEAR = 0x00000020; /** * Bit to be bitwise-ored into the {@link #flags} field that should be * set if this notification represents a currently running service. This * will normally be set for you by {@link Service#startForeground}. */ public static final int FLAG_FOREGROUND_SERVICE = 0x00000040; public int flags; /** Loading
core/java/android/app/NotificationManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,8 @@ public class NotificationManager private static INotificationManager sService; static private INotificationManager getService() /** @hide */ static public INotificationManager getService() { if (sService != null) { return sService; Loading