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

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

Merge "Enable background restrictions"

parents 596915de 42a386b7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5450,6 +5450,7 @@ 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 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";
@@ -39043,6 +39044,7 @@ 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);
+2 −0
Original line number Diff line number Diff line
@@ -5635,6 +5635,7 @@ 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 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";
@@ -42298,6 +42299,7 @@ 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);
+2 −0
Original line number Diff line number Diff line
@@ -5461,6 +5461,7 @@ 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 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";
@@ -39165,6 +39166,7 @@ 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);
+19 −4
Original line number Diff line number Diff line
@@ -1385,7 +1385,14 @@ class ContextImpl extends Context {
    @Override
    public ComponentName startService(Intent service) {
        warnIfCallingFromSystemProcess();
        return startServiceCommon(service, mUser);
        return startServiceCommon(service, -1, null, mUser);
    }

    @Override
    public ComponentName startServiceInForeground(Intent service,
            int id, Notification notification) {
        warnIfCallingFromSystemProcess();
        return startServiceCommon(service, id, notification, mUser);
    }

    @Override
@@ -1396,16 +1403,24 @@ class ContextImpl extends Context {

    @Override
    public ComponentName startServiceAsUser(Intent service, UserHandle user) {
        return startServiceCommon(service, user);
        return startServiceCommon(service, -1, null, user);
    }

    private ComponentName startServiceCommon(Intent service, UserHandle user) {
    @Override
    public ComponentName startServiceInForegroundAsUser(Intent service,
            int id, Notification notification, UserHandle user) {
        return startServiceCommon(service, id, notification, user);
    }

    private ComponentName startServiceCommon(Intent service, int id, Notification notification,
            UserHandle user) {
        try {
            validateServiceIntent(service);
            service.prepareToLeaveProcess(this);
            ComponentName cn = ActivityManager.getService().startService(
                mMainThread.getApplicationThread(), service, service.resolveTypeIfNeeded(
                            getContentResolver()), getOpPackageName(), user.getIdentifier());
                            getContentResolver()), id, notification, getOpPackageName(),
                            user.getIdentifier());
            if (cn != null) {
                if (cn.getPackageName().equals("!")) {
                    throw new SecurityException(
+2 −1
Original line number Diff line number Diff line
@@ -128,7 +128,8 @@ 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, in String callingPackage, int userId);
            in String resolvedType, int id, in Notification notification,
            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