Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00ed0bac authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Turn down the preliminary foreground service API" into oc-dev

parents d6792516 242ba3e9
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -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";
@@ -40906,7 +40905,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);
+0 −2
Original line number Diff line number Diff line
@@ -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";
@@ -44462,7 +44461,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);
+0 −2
Original line number Diff line number Diff line
@@ -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";
@@ -41101,7 +41100,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);
+7 −22
Original line number Diff line number Diff line
@@ -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("!")) {
+1 −2
Original line number Diff line number Diff line
@@ -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,
Loading