diff options
| -rw-r--r-- | api/current.txt | 2 | ||||
| -rw-r--r-- | api/system-current.txt | 2 | ||||
| -rw-r--r-- | api/test-current.txt | 2 | ||||
| -rw-r--r-- | core/java/android/app/ContextImpl.java | 29 | ||||
| -rw-r--r-- | core/java/android/app/IActivityManager.aidl | 3 | ||||
| -rw-r--r-- | core/java/android/app/NotificationManager.java | 36 | ||||
| -rw-r--r-- | core/java/android/content/Context.java | 22 | ||||
| -rw-r--r-- | core/java/android/content/ContextWrapper.java | 14 | ||||
| -rw-r--r-- | services/core/java/com/android/server/am/ActiveServices.java | 7 | ||||
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 7 | ||||
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerShellCommand.java | 2 | ||||
| -rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 2 | ||||
| -rw-r--r-- | test-runner/src/android/test/mock/MockContext.java | 14 | ||||
| -rw-r--r-- | tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java | 14 |
14 files changed, 14 insertions, 142 deletions
diff --git a/api/current.txt b/api/current.txt index 0cdc8f2ef806..f448aa66e725 100644 --- a/api/current.txt +++ b/api/current.txt @@ -5604,7 +5604,6 @@ package android.app { method public boolean removeAutomaticZenRule(java.lang.String); method public final void setInterruptionFilter(int); method public void setNotificationPolicy(android.app.NotificationManager.Policy); - method public deprecated android.content.ComponentName startServiceInForeground(android.content.Intent, int, android.app.Notification); method public boolean updateAutomaticZenRule(java.lang.String, android.app.AutomaticZenRule); field public static final java.lang.String ACTION_INTERRUPTION_FILTER_CHANGED = "android.app.action.INTERRUPTION_FILTER_CHANGED"; field public static final java.lang.String ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED = "android.app.action.NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED"; @@ -40930,7 +40929,6 @@ package android.test.mock { method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException; method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException; method public android.content.ComponentName startService(android.content.Intent); - method public android.content.ComponentName startServiceInForeground(android.content.Intent, int, android.app.Notification); method public boolean stopService(android.content.Intent); method public void unbindService(android.content.ServiceConnection); method public void unregisterReceiver(android.content.BroadcastReceiver); diff --git a/api/system-current.txt b/api/system-current.txt index 013a4068cea1..cb77c57c84d8 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5806,7 +5806,6 @@ package android.app { method public boolean removeAutomaticZenRule(java.lang.String); method public final void setInterruptionFilter(int); method public void setNotificationPolicy(android.app.NotificationManager.Policy); - method public deprecated android.content.ComponentName startServiceInForeground(android.content.Intent, int, android.app.Notification); method public boolean updateAutomaticZenRule(java.lang.String, android.app.AutomaticZenRule); field public static final java.lang.String ACTION_INTERRUPTION_FILTER_CHANGED = "android.app.action.INTERRUPTION_FILTER_CHANGED"; field public static final java.lang.String ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED = "android.app.action.NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED"; @@ -44486,7 +44485,6 @@ package android.test.mock { method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException; method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException; method public android.content.ComponentName startService(android.content.Intent); - method public android.content.ComponentName startServiceInForeground(android.content.Intent, int, android.app.Notification); method public boolean stopService(android.content.Intent); method public void unbindService(android.content.ServiceConnection); method public void unregisterReceiver(android.content.BroadcastReceiver); diff --git a/api/test-current.txt b/api/test-current.txt index a861e9d39aa7..85f9e9bb3bc6 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -5618,7 +5618,6 @@ package android.app { method public boolean removeAutomaticZenRule(java.lang.String); method public final void setInterruptionFilter(int); method public void setNotificationPolicy(android.app.NotificationManager.Policy); - method public deprecated android.content.ComponentName startServiceInForeground(android.content.Intent, int, android.app.Notification); method public boolean updateAutomaticZenRule(java.lang.String, android.app.AutomaticZenRule); field public static final java.lang.String ACTION_INTERRUPTION_FILTER_CHANGED = "android.app.action.INTERRUPTION_FILTER_CHANGED"; field public static final java.lang.String ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED = "android.app.action.NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED"; @@ -41125,7 +41124,6 @@ package android.test.mock { method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException; method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException; method public android.content.ComponentName startService(android.content.Intent); - method public android.content.ComponentName startServiceInForeground(android.content.Intent, int, android.app.Notification); method public boolean stopService(android.content.Intent); method public void unbindService(android.content.ServiceConnection); method public void unregisterReceiver(android.content.BroadcastReceiver); diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 6cc8a14ea2f9..80de64b94519 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -1447,21 +1447,13 @@ class ContextImpl extends Context { @Override public ComponentName startService(Intent service) { warnIfCallingFromSystemProcess(); - return startServiceCommon(service, -1, null, false, mUser); + return startServiceCommon(service, false, mUser); } @Override public ComponentName startForegroundService(Intent service) { warnIfCallingFromSystemProcess(); - return startServiceCommon(service, -1, null, true, mUser); - } - - // STOPSHIP: remove when NotificationManager.startServiceInForeground() is retired - @Override - public ComponentName startServiceInForeground(Intent service, - int id, Notification notification) { - warnIfCallingFromSystemProcess(); - return startServiceCommon(service, id, notification, false, mUser); + return startServiceCommon(service, true, mUser); } @Override @@ -1472,29 +1464,22 @@ class ContextImpl extends Context { @Override public ComponentName startServiceAsUser(Intent service, UserHandle user) { - return startServiceCommon(service, -1, null, false, user); + return startServiceCommon(service, false, user); } @Override public ComponentName startForegroundServiceAsUser(Intent service, UserHandle user) { - return startServiceCommon(service, -1, null, true, user); + return startServiceCommon(service, true, user); } - // STOPSHIP: remove when NotificationManager.startServiceInForeground() is retired - @Override - public ComponentName startServiceInForegroundAsUser(Intent service, - int id, Notification notification, UserHandle user) { - return startServiceCommon(service, id, notification, false, user); - } - - private ComponentName startServiceCommon(Intent service, int id, Notification notification, - boolean requireForeground, UserHandle user) { + private ComponentName startServiceCommon(Intent service, boolean requireForeground, + UserHandle user) { try { validateServiceIntent(service); service.prepareToLeaveProcess(this); ComponentName cn = ActivityManager.getService().startService( mMainThread.getApplicationThread(), service, service.resolveTypeIfNeeded( - getContentResolver()), id, notification, requireForeground, + getContentResolver()), requireForeground, getOpPackageName(), user.getIdentifier()); if (cn != null) { if (cn.getPackageName().equals("!")) { diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl index 4210d2e7d3ec..d2702440f839 100644 --- a/core/java/android/app/IActivityManager.aidl +++ b/core/java/android/app/IActivityManager.aidl @@ -129,8 +129,7 @@ interface IActivityManager { void finishSubActivity(in IBinder token, in String resultWho, int requestCode); PendingIntent getRunningServiceControlPanel(in ComponentName service); ComponentName startService(in IApplicationThread caller, in Intent service, - in String resolvedType, int id, in Notification notification, - boolean requireForeground, in String callingPackage, int userId); + in String resolvedType, boolean requireForeground, in String callingPackage, int userId); int stopService(in IApplicationThread caller, in Intent service, in String resolvedType, int userId); int bindService(in IApplicationThread caller, in IBinder token, in Intent service, diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index 72c59781ae80..242d4a5e6267 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -1155,40 +1155,4 @@ public class NotificationManager } } - /** - * Start a service directly into the "foreground service" state. Unlike - * {@link android.content.Context#startService(Intent)}, this method - * can be used from within background operations like broadcast receivers - * or scheduled jobs. - * - * @param service Description of the service to be started. The Intent must be either - * fully explicit (supplying a component name) or specify a specific package - * name it is targeted to. - * @param id The identifier for this notification as per - * {@link #notify(int, Notification) NotificationManager.notify(int, Notification)}; - * must not be 0. - * @param notification The Notification to be displayed. - * @return If the service is being started or is already running, the - * {@link ComponentName} of the actual service that was started is - * returned; else if the service does not exist null is returned. - * - * @deprecated STOPSHIP transition away from this for O - */ - @Nullable - @Deprecated - public ComponentName startServiceInForeground(Intent service, - int id, Notification notification) { - return mContext.startServiceInForeground(service, id, notification); - } - - /** - * @hide like {@link #startServiceInForeground(Intent, int, Notification)} - * but for a specific user. - */ - @Nullable - public ComponentName startServiceInForegroundAsUser(Intent service, - int id, Notification notification, UserHandle user) { - return mContext.startServiceInForegroundAsUser(service, id, notification, user); - } - } diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 18120c714793..0adab1ad1752 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -2647,18 +2647,6 @@ public abstract class Context { public abstract ComponentName startForegroundServiceAsUser(Intent service, UserHandle user); /** - * Start a service directly into the "foreground service" state. Unlike {@link #startService}, - * this method can be used from within background operations like broadcast receivers - * or scheduled jobs. The API entry point for this is in NotificationManager in order to - * preserve appropriate public package layering. - * @hide - * @deprecated STOPSHIP remove in favor of two-step startForegroundService() + startForeground() - */ - @Nullable - public abstract ComponentName startServiceInForeground(Intent service, - int id, Notification notification); - - /** * Request that a given application service be stopped. If the service is * not running, nothing happens. Otherwise it is stopped. Note that calls * to startService() are not counted -- this stops the service no matter @@ -2696,16 +2684,6 @@ public abstract class Context { public abstract ComponentName startServiceAsUser(Intent service, UserHandle user); /** - * @hide like {@link #startServiceInForeground(Intent, int, Notification)} - * but for a specific user. - * @deprecated STOPSHIP remove when trial API is turned off - */ - @Deprecated - @Nullable - public abstract ComponentName startServiceInForegroundAsUser(Intent service, - int id, Notification notification, UserHandle user); - - /** * @hide like {@link #stopService(Intent)} but for a specific user. */ public abstract boolean stopServiceAsUser(Intent service, UserHandle user); diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java index 53b021cbdf9f..b59fc3ddbb84 100644 --- a/core/java/android/content/ContextWrapper.java +++ b/core/java/android/content/ContextWrapper.java @@ -649,13 +649,6 @@ public class ContextWrapper extends Context { return mBase.startForegroundService(service); } - /** @hide STOPSHIP remove when trial API is turned down */ - @Override - public ComponentName startServiceInForeground(Intent service, - int id, Notification notification) { - return mBase.startServiceInForeground(service, id, notification); - } - @Override public boolean stopService(Intent name) { return mBase.stopService(name); @@ -673,13 +666,6 @@ public class ContextWrapper extends Context { return mBase.startForegroundServiceAsUser(service, user); } - /** @hide STOPSHIP removed when trial API is turned down */ - @Override - public ComponentName startServiceInForegroundAsUser(Intent service, - int id, Notification notification, UserHandle user) { - return mBase.startServiceInForegroundAsUser(service, id, notification, user); - } - /** @hide */ @Override public boolean stopServiceAsUser(Intent name, UserHandle user) { diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java index c77820b4de3a..2cd14e93791d 100644 --- a/services/core/java/com/android/server/am/ActiveServices.java +++ b/services/core/java/com/android/server/am/ActiveServices.java @@ -312,8 +312,7 @@ public final class ActiveServices { } ComponentName startServiceLocked(IApplicationThread caller, Intent service, String resolvedType, - int id, Notification notification, int callingPid, int callingUid, - boolean fgRequired, String callingPackage, final int userId) + int callingPid, int callingUid, boolean fgRequired, String callingPackage, final int userId) throws TransactionTooLargeException { if (DEBUG_DELAYED_STARTS) Slog.v(TAG_SERVICE, "startService: " + service + " type=" + resolvedType + " args=" + service.getExtras()); @@ -464,10 +463,6 @@ public final class ActiveServices { } ComponentName cmp = startServiceInnerLocked(smap, service, r, callerFg, addToStarting); - // STOPSHIP deprecated; remove when NotificationManager.startServiceInForeground is retired - if (notification != null) { - setServiceForegroundInnerLocked(r, id, notification, 0); - } return cmp; } diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 1c2a6aa2bbdf..024aabdfdcbd 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -17929,8 +17929,7 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public ComponentName startService(IApplicationThread caller, Intent service, - String resolvedType, int id, Notification notification, boolean requireForeground, - String callingPackage, int userId) + String resolvedType, boolean requireForeground, String callingPackage, int userId) throws TransactionTooLargeException { enforceNotIsolatedCaller("startService"); // Refuse possible leaked file descriptors @@ -17951,7 +17950,7 @@ public class ActivityManagerService extends IActivityManager.Stub ComponentName res; try { res = mServices.startServiceLocked(caller, service, - resolvedType, id, notification, callingPid, callingUid, + resolvedType, callingPid, callingUid, requireForeground, callingPackage, userId); } finally { Binder.restoreCallingIdentity(origId); @@ -17970,7 +17969,7 @@ public class ActivityManagerService extends IActivityManager.Stub ComponentName res; try { res = mServices.startServiceLocked(null, service, - resolvedType, 0, null, -1, uid, fgRequired, callingPackage, userId); + resolvedType, -1, uid, fgRequired, callingPackage, userId); } finally { Binder.restoreCallingIdentity(origId); } diff --git a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java index 0fcf3e66debe..b6bfb00d3815 100644 --- a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java +++ b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java @@ -524,7 +524,7 @@ final class ActivityManagerShellCommand extends ShellCommand { pw.println("Starting service: " + intent); pw.flush(); ComponentName cn = mInterface.startService(null, intent, intent.getType(), - -1, null, asForeground, SHELL_PACKAGE_NAME, mUserId); + asForeground, SHELL_PACKAGE_NAME, mUserId); if (cn == null) { err.println("Error: Not found; no service started."); return -1; diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index e79f46b4f3be..28810a77198b 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -13201,7 +13201,7 @@ public class PackageManagerService extends IPackageManager.Stub { if (dcsUid > 0) { am.backgroundWhitelistUid(dcsUid); } - am.startService(null, intent, null, -1, null, false, mContext.getOpPackageName(), + am.startService(null, intent, null, false, mContext.getOpPackageName(), UserHandle.USER_SYSTEM); } catch (RemoteException e) { } diff --git a/test-runner/src/android/test/mock/MockContext.java b/test-runner/src/android/test/mock/MockContext.java index a8eb9862202d..b4e3a476425a 100644 --- a/test-runner/src/android/test/mock/MockContext.java +++ b/test-runner/src/android/test/mock/MockContext.java @@ -530,13 +530,6 @@ public class MockContext extends Context { throw new UnsupportedOperationException(); } - /** STOPSHIP remove when trial API is turned down */ - @Override - public ComponentName startServiceInForeground(Intent service, - int id, Notification notification) { - throw new UnsupportedOperationException(); - } - @Override public boolean stopService(Intent service) { throw new UnsupportedOperationException(); @@ -554,13 +547,6 @@ public class MockContext extends Context { throw new UnsupportedOperationException(); } - /** @hide STOPSHIP removed when trial API is turned down */ - @Override - public ComponentName startServiceInForegroundAsUser(Intent service, - int id, Notification notification, UserHandle user) { - throw new UnsupportedOperationException(); - } - /** @hide */ @Override public boolean stopServiceAsUser(Intent service, UserHandle user) { diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java index 328fc0a1eaeb..1e77ac170028 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java @@ -1865,13 +1865,6 @@ public class BridgeContext extends Context { } @Override - public ComponentName startServiceInForeground(Intent service, - int id, Notification notification) { - // pass - return null; - } - - @Override public boolean stopService(Intent arg0) { // pass return false; @@ -1884,13 +1877,6 @@ public class BridgeContext extends Context { } @Override - public ComponentName startServiceInForegroundAsUser(Intent service, - int id, Notification notification, UserHandle user) { - // pass - return null; - } - - @Override public boolean stopServiceAsUser(Intent arg0, UserHandle arg1) { // pass return false; |