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

Commit f4eb180e authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Third party DND provider APIs."

parents 41d14a9a a47a27ff
Loading
Loading
Loading
Loading
+31 −1
Original line number Diff line number Diff line
@@ -4016,6 +4016,23 @@ package android.app {
    field public java.lang.String serviceDetails;
  }
  public class AutomaticZenRule implements android.os.Parcelable {
    ctor public AutomaticZenRule(java.lang.String, android.content.ComponentName, android.net.Uri, int, boolean);
    ctor public AutomaticZenRule(android.os.Parcel);
    method public int describeContents();
    method public android.net.Uri getConditionId();
    method public int getInterruptionFilter();
    method public java.lang.String getName();
    method public android.content.ComponentName getOwner();
    method public boolean isEnabled();
    method public void setConditionId(android.net.Uri);
    method public void setEnabled(boolean);
    method public void setInterruptionFilter(int);
    method public void setName(java.lang.String);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.AutomaticZenRule> CREATOR;
  }
  public class DatePickerDialog extends android.app.AlertDialog implements android.widget.DatePicker.OnDateChangedListener android.content.DialogInterface.OnClickListener {
    ctor public DatePickerDialog(android.content.Context, android.app.DatePickerDialog.OnDateSetListener, int, int, int);
    ctor public DatePickerDialog(android.content.Context, int, android.app.DatePickerDialog.OnDateSetListener, int, int, int);
@@ -5061,15 +5078,20 @@ package android.app {
  }
  public class NotificationManager {
    method public boolean addOrUpdateAutomaticZenRule(android.app.AutomaticZenRule);
    method public void cancel(int);
    method public void cancel(java.lang.String, int);
    method public void cancelAll();
    method public android.service.notification.StatusBarNotification[] getActiveNotifications();
    method public android.app.AutomaticZenRule getAutomaticZenRule(java.lang.String);
    method public java.util.List<android.app.AutomaticZenRule> getAutomaticZenRules();
    method public final int getCurrentInterruptionFilter();
    method public android.app.NotificationManager.Policy getNotificationPolicy();
    method public boolean isNotificationPolicyAccessGranted();
    method public void notify(int, android.app.Notification);
    method public void notify(java.lang.String, int, android.app.Notification);
    method public boolean removeAutomaticZenRule(java.lang.String);
    method public boolean renameAutomaticZenRule(java.lang.String, java.lang.String);
    method public final void setInterruptionFilter(int);
    method public void setNotificationPolicy(android.app.NotificationManager.Policy);
    field public static final java.lang.String ACTION_INTERRUPTION_FILTER_CHANGED = "android.app.action.INTERRUPTION_FILTER_CHANGED";
@@ -23567,7 +23589,7 @@ package android.os {
    method public static final int myPid();
    method public static final int myTid();
    method public static final int myUid();
    method public static final android.os.UserHandle myUserHandle();
    method public static android.os.UserHandle myUserHandle();
    method public static final void sendSignal(int, int);
    method public static final void setThreadPriority(int, int) throws java.lang.IllegalArgumentException, java.lang.SecurityException;
    method public static final void setThreadPriority(int) throws java.lang.IllegalArgumentException, java.lang.SecurityException;
@@ -45361,7 +45383,10 @@ package java.lang.reflect {
  }
  public final class Constructor extends java.lang.reflect.AccessibleObject implements java.lang.reflect.GenericDeclaration java.lang.reflect.Member {
    method public boolean equals(java.lang.Object);
    method public A getAnnotation(java.lang.Class<A>);
    method public java.lang.annotation.Annotation[] getAnnotations();
    method public java.lang.annotation.Annotation[] getDeclaredAnnotations();
    method public java.lang.Class<T> getDeclaringClass();
    method public java.lang.Class<?>[] getExceptionTypes();
    method public java.lang.reflect.Type[] getGenericExceptionTypes();
@@ -45371,6 +45396,7 @@ package java.lang.reflect {
    method public java.lang.annotation.Annotation[][] getParameterAnnotations();
    method public java.lang.Class<?>[] getParameterTypes();
    method public java.lang.reflect.TypeVariable<java.lang.reflect.Constructor<T>>[] getTypeParameters();
    method public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation>);
    method public boolean isSynthetic();
    method public boolean isVarArgs();
    method public T newInstance(java.lang.Object...) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException;
@@ -45444,7 +45470,10 @@ package java.lang.reflect {
  }
  public final class Method extends java.lang.reflect.AccessibleObject implements java.lang.reflect.GenericDeclaration java.lang.reflect.Member {
    method public boolean equals(java.lang.Object);
    method public A getAnnotation(java.lang.Class<A>);
    method public java.lang.annotation.Annotation[] getAnnotations();
    method public java.lang.annotation.Annotation[] getDeclaredAnnotations();
    method public java.lang.Class<?> getDeclaringClass();
    method public java.lang.Object getDefaultValue();
    method public java.lang.Class<?>[] getExceptionTypes();
@@ -45458,6 +45487,7 @@ package java.lang.reflect {
    method public java.lang.Class<?> getReturnType();
    method public java.lang.reflect.TypeVariable<java.lang.reflect.Method>[] getTypeParameters();
    method public java.lang.Object invoke(java.lang.Object, java.lang.Object...) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException;
    method public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation>);
    method public boolean isBridge();
    method public boolean isSynthetic();
    method public boolean isVarArgs();
+31 −1
Original line number Diff line number Diff line
@@ -4127,6 +4127,23 @@ package android.app {
    field public java.lang.String serviceDetails;
  }
  public class AutomaticZenRule implements android.os.Parcelable {
    ctor public AutomaticZenRule(java.lang.String, android.content.ComponentName, android.net.Uri, int, boolean);
    ctor public AutomaticZenRule(android.os.Parcel);
    method public int describeContents();
    method public android.net.Uri getConditionId();
    method public int getInterruptionFilter();
    method public java.lang.String getName();
    method public android.content.ComponentName getOwner();
    method public boolean isEnabled();
    method public void setConditionId(android.net.Uri);
    method public void setEnabled(boolean);
    method public void setInterruptionFilter(int);
    method public void setName(java.lang.String);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.app.AutomaticZenRule> CREATOR;
  }
  public class BroadcastOptions {
    method public static android.app.BroadcastOptions makeBasic();
    method public void setTemporaryAppWhitelistDuration(long);
@@ -5178,15 +5195,20 @@ package android.app {
  }
  public class NotificationManager {
    method public boolean addOrUpdateAutomaticZenRule(android.app.AutomaticZenRule);
    method public void cancel(int);
    method public void cancel(java.lang.String, int);
    method public void cancelAll();
    method public android.service.notification.StatusBarNotification[] getActiveNotifications();
    method public android.app.AutomaticZenRule getAutomaticZenRule(java.lang.String);
    method public java.util.List<android.app.AutomaticZenRule> getAutomaticZenRules();
    method public final int getCurrentInterruptionFilter();
    method public android.app.NotificationManager.Policy getNotificationPolicy();
    method public boolean isNotificationPolicyAccessGranted();
    method public void notify(int, android.app.Notification);
    method public void notify(java.lang.String, int, android.app.Notification);
    method public boolean removeAutomaticZenRule(java.lang.String);
    method public boolean renameAutomaticZenRule(java.lang.String, java.lang.String);
    method public final void setInterruptionFilter(int);
    method public void setNotificationPolicy(android.app.NotificationManager.Policy);
    field public static final java.lang.String ACTION_INTERRUPTION_FILTER_CHANGED = "android.app.action.INTERRUPTION_FILTER_CHANGED";
@@ -25519,7 +25541,7 @@ package android.os {
    method public static final int myPid();
    method public static final int myTid();
    method public static final int myUid();
    method public static final android.os.UserHandle myUserHandle();
    method public static android.os.UserHandle myUserHandle();
    method public static final void sendSignal(int, int);
    method public static final void setThreadPriority(int, int) throws java.lang.IllegalArgumentException, java.lang.SecurityException;
    method public static final void setThreadPriority(int) throws java.lang.IllegalArgumentException, java.lang.SecurityException;
@@ -47970,7 +47992,10 @@ package java.lang.reflect {
  }
  public final class Constructor extends java.lang.reflect.AccessibleObject implements java.lang.reflect.GenericDeclaration java.lang.reflect.Member {
    method public boolean equals(java.lang.Object);
    method public A getAnnotation(java.lang.Class<A>);
    method public java.lang.annotation.Annotation[] getAnnotations();
    method public java.lang.annotation.Annotation[] getDeclaredAnnotations();
    method public java.lang.Class<T> getDeclaringClass();
    method public java.lang.Class<?>[] getExceptionTypes();
    method public java.lang.reflect.Type[] getGenericExceptionTypes();
@@ -47980,6 +48005,7 @@ package java.lang.reflect {
    method public java.lang.annotation.Annotation[][] getParameterAnnotations();
    method public java.lang.Class<?>[] getParameterTypes();
    method public java.lang.reflect.TypeVariable<java.lang.reflect.Constructor<T>>[] getTypeParameters();
    method public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation>);
    method public boolean isSynthetic();
    method public boolean isVarArgs();
    method public T newInstance(java.lang.Object...) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException;
@@ -48053,7 +48079,10 @@ package java.lang.reflect {
  }
  public final class Method extends java.lang.reflect.AccessibleObject implements java.lang.reflect.GenericDeclaration java.lang.reflect.Member {
    method public boolean equals(java.lang.Object);
    method public A getAnnotation(java.lang.Class<A>);
    method public java.lang.annotation.Annotation[] getAnnotations();
    method public java.lang.annotation.Annotation[] getDeclaredAnnotations();
    method public java.lang.Class<?> getDeclaringClass();
    method public java.lang.Object getDefaultValue();
    method public java.lang.Class<?>[] getExceptionTypes();
@@ -48067,6 +48096,7 @@ package java.lang.reflect {
    method public java.lang.Class<?> getReturnType();
    method public java.lang.reflect.TypeVariable<java.lang.reflect.Method>[] getTypeParameters();
    method public java.lang.Object invoke(java.lang.Object, java.lang.Object...) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException;
    method public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation>);
    method public boolean isBridge();
    method public boolean isSynthetic();
    method public boolean isVarArgs();
+19 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2015, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.app;

parcelable AutomaticZenRule;
 No newline at end of file
+190 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2015, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.app;

import android.content.ComponentName;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;

import java.util.Objects;

/**
 * Rule instance information for zen mode.
 */
public class AutomaticZenRule implements Parcelable {

    private boolean enabled = false;
    private String name;
    private int interruptionFilter;
    private Uri conditionId;
    private ComponentName owner;

    /**
     * Creates an automatic zen rule.
     *
     * @param name The name of the rule.
     * @param owner The Condition Provider service that owns this rule.
     * @param conditionId A representation of the state that should cause the Condition Provider
     *                    service to apply the interruption filter.
     * @param interruptionFilter The interruption filter defines which notifications are allowed to
     *                           interrupt the user (e.g. via sound &amp; vibration) while this rule
     *                           is active.
     * @param enabled Whether the rule is enabled.
     */
    public AutomaticZenRule(String name, ComponentName owner, Uri conditionId,
            int interruptionFilter, boolean enabled) {
        this.name = name;
        this.owner = owner;
        this.conditionId = conditionId;
        this.interruptionFilter = interruptionFilter;
        this.enabled = enabled;
    }

    public AutomaticZenRule(Parcel source) {
        enabled = source.readInt() == 1;
        if (source.readInt() == 1) {
            name = source.readString();
        }
        interruptionFilter = source.readInt();
        conditionId = source.readParcelable(null);
        owner = source.readParcelable(null);
    }

    /**
     * Returns the {@link ComponentName} of the condition provider service that owns this rule.
     */
    public ComponentName getOwner() {
        return owner;
    }

    /**
     * Returns the representation of the state that causes this rule to become active.
     */
    public Uri getConditionId() {
        return conditionId;
    }

    /**
     * Returns the interruption filter that is applied when this rule is active.
     */
    public int getInterruptionFilter() {
        return interruptionFilter;
    }

    /**
     * Returns the name of this rule.
     */
    public String getName() {
        return name;
    }

    /**
     * Returns whether this rule is enabled.
     */
    public boolean isEnabled() {
        return enabled;
    }

    /**
     * Sets the representation of the state that causes this rule to become active.
     */
    public void setConditionId(Uri conditionId) {
        this.conditionId = conditionId;
    }

    /**
     * Sets the interruption filter that is applied when this rule is active.
     * @param interruptionFilter One of the INTERRUPTION_FILTER_ constants in NotificationManager.
     */
    public void setInterruptionFilter(int interruptionFilter) {
        this.interruptionFilter = interruptionFilter;
    }

    /**
     * Sets the name of this rule.
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Enables this rule.
     */
    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(enabled ? 1 : 0);
        if (name != null) {
            dest.writeInt(1);
            dest.writeString(name);
        } else {
            dest.writeInt(0);
        }
        dest.writeInt(interruptionFilter);
        dest.writeParcelable(conditionId, 0);
        dest.writeParcelable(owner, 0);
    }

    @Override
    public String toString() {
        return new StringBuilder(AutomaticZenRule.class.getSimpleName()).append('[')
                .append("enabled=").append(enabled)
                .append(",name=").append(name)
                .append(",interruptionFilter=").append(interruptionFilter)
                .append(",conditionId=").append(conditionId)
                .append(",owner=").append(owner)
                .append(']').toString();
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof AutomaticZenRule)) return false;
        if (o == this) return true;
        final AutomaticZenRule other = (AutomaticZenRule) o;
        return other.enabled == enabled
                && Objects.equals(other.name, name)
                && other.interruptionFilter == interruptionFilter
                && Objects.equals(other.conditionId, conditionId)
                && Objects.equals(other.owner, owner);
    }

    @Override
    public int hashCode() {
        return Objects.hash(enabled, name, interruptionFilter, conditionId, owner);
    }

    public static final Parcelable.Creator<AutomaticZenRule> CREATOR
            = new Parcelable.Creator<AutomaticZenRule>() {
        @Override
        public AutomaticZenRule createFromParcel(Parcel source) {
            return new AutomaticZenRule(source);
        }
        @Override
        public AutomaticZenRule[] newArray(int size) {
            return new AutomaticZenRule[size];
        }
    };
}
 No newline at end of file
+6 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.service.notification.IConditionListener;
import android.service.notification.IConditionProvider;
import android.service.notification.INotificationListener;
import android.service.notification.StatusBarNotification;
import android.app.AutomaticZenRule;
import android.service.notification.ZenModeConfig;

/** {@hide} */
@@ -92,6 +93,11 @@ interface INotificationManager
    String[] getPackagesRequestingNotificationPolicyAccess();
    boolean isNotificationPolicyAccessGrantedForPackage(String pkg);
    void setNotificationPolicyAccessGranted(String pkg, boolean granted);
    AutomaticZenRule getAutomaticZenRule(String name);
    List<AutomaticZenRule> getAutomaticZenRules();
    boolean addOrUpdateAutomaticZenRule(in AutomaticZenRule automaticZenRule);
    boolean renameAutomaticZenRule(String oldName, String newName);
    boolean removeAutomaticZenRule(String name);

    byte[] getBackupPayload(int user);
    void applyRestore(in byte[] payload, int user);
Loading