Loading media/java/android/media/AudioManager.java +12 −0 Original line number Diff line number Diff line Loading @@ -3216,6 +3216,18 @@ public class AudioManager { } } /** * Only useful for volume controllers. * @hide */ public void setVolumePolicy(VolumePolicy policy) { try { getService().setVolumePolicy(policy); } catch (RemoteException e) { Log.w(TAG, "Error calling setVolumePolicy", e); } } /** * Set Hdmi Cec system audio mode. * Loading media/java/android/media/AudioManagerInternal.java +2 −2 Original line number Diff line number Diff line Loading @@ -46,10 +46,10 @@ public abstract class AudioManagerInternal { public interface RingerModeDelegate { /** Called when external ringer mode is evaluated, returns the new internal ringer mode */ int onSetRingerModeExternal(int ringerModeOld, int ringerModeNew, String caller, int ringerModeInternal); int ringerModeInternal, VolumePolicy policy); /** Called when internal ringer mode is evaluated, returns the new external ringer mode */ int onSetRingerModeInternal(int ringerModeOld, int ringerModeNew, String caller, int ringerModeExternal); int ringerModeExternal, VolumePolicy policy); } } media/java/android/media/IAudioService.aidl +7 −3 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.media.IRemoteVolumeObserver; import android.media.IRingtonePlayer; import android.media.IVolumeController; import android.media.Rating; import android.media.VolumePolicy; import android.media.audiopolicy.AudioPolicyConfig; import android.media.audiopolicy.IAudioPolicyCallback; import android.net.Uri; Loading Loading @@ -206,7 +207,10 @@ interface IAudioService { String registerAudioPolicy(in AudioPolicyConfig policyConfig, in IAudioPolicyCallback pcb, boolean hasFocusListener); oneway void unregisterAudioPolicyAsync(in IAudioPolicyCallback pcb); int setFocusPropertiesForPolicy(int duckingBehavior, in IAudioPolicyCallback pcb); void setVolumePolicy(in VolumePolicy policy); } media/java/android/media/VolumePolicy.aidl 0 → 100644 +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.media; parcelable VolumePolicy; media/java/android/media/VolumePolicy.java 0 → 100644 +68 −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.media; import android.os.Parcel; import android.os.Parcelable; /** @hide */ public final class VolumePolicy implements Parcelable { public static final VolumePolicy DEFAULT = new VolumePolicy(false, false, true); public final boolean volumeDownToEnterSilent; public final boolean volumeUpToExitSilent; public final boolean doNotDisturbWhenSilent; public VolumePolicy(boolean volumeDownToEnterSilent, boolean volumeUpToExitSilent, boolean doNotDisturbWhenSilent) { this.volumeDownToEnterSilent = volumeDownToEnterSilent; this.volumeUpToExitSilent = volumeUpToExitSilent; this.doNotDisturbWhenSilent = doNotDisturbWhenSilent; } @Override public String toString() { return "VolumePolicy[volumeDownToEnterSilent=" + volumeDownToEnterSilent + ",volumeUpToExitSilent=" + volumeUpToExitSilent + ",doNotDisturbWhenSilent=" + doNotDisturbWhenSilent + "]"; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(volumeDownToEnterSilent ? 1 : 0); dest.writeInt(volumeUpToExitSilent ? 1 : 0); dest.writeInt(doNotDisturbWhenSilent ? 1 : 0); } public static final Parcelable.Creator<VolumePolicy> CREATOR = new Parcelable.Creator<VolumePolicy>() { @Override public VolumePolicy createFromParcel(Parcel p) { return new VolumePolicy(p.readInt() != 0, p.readInt() != 0, p.readInt() != 0); } @Override public VolumePolicy[] newArray(int size) { return new VolumePolicy[size]; } }; } No newline at end of file Loading
media/java/android/media/AudioManager.java +12 −0 Original line number Diff line number Diff line Loading @@ -3216,6 +3216,18 @@ public class AudioManager { } } /** * Only useful for volume controllers. * @hide */ public void setVolumePolicy(VolumePolicy policy) { try { getService().setVolumePolicy(policy); } catch (RemoteException e) { Log.w(TAG, "Error calling setVolumePolicy", e); } } /** * Set Hdmi Cec system audio mode. * Loading
media/java/android/media/AudioManagerInternal.java +2 −2 Original line number Diff line number Diff line Loading @@ -46,10 +46,10 @@ public abstract class AudioManagerInternal { public interface RingerModeDelegate { /** Called when external ringer mode is evaluated, returns the new internal ringer mode */ int onSetRingerModeExternal(int ringerModeOld, int ringerModeNew, String caller, int ringerModeInternal); int ringerModeInternal, VolumePolicy policy); /** Called when internal ringer mode is evaluated, returns the new external ringer mode */ int onSetRingerModeInternal(int ringerModeOld, int ringerModeNew, String caller, int ringerModeExternal); int ringerModeExternal, VolumePolicy policy); } }
media/java/android/media/IAudioService.aidl +7 −3 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.media.IRemoteVolumeObserver; import android.media.IRingtonePlayer; import android.media.IVolumeController; import android.media.Rating; import android.media.VolumePolicy; import android.media.audiopolicy.AudioPolicyConfig; import android.media.audiopolicy.IAudioPolicyCallback; import android.net.Uri; Loading Loading @@ -206,7 +207,10 @@ interface IAudioService { String registerAudioPolicy(in AudioPolicyConfig policyConfig, in IAudioPolicyCallback pcb, boolean hasFocusListener); oneway void unregisterAudioPolicyAsync(in IAudioPolicyCallback pcb); int setFocusPropertiesForPolicy(int duckingBehavior, in IAudioPolicyCallback pcb); void setVolumePolicy(in VolumePolicy policy); }
media/java/android/media/VolumePolicy.aidl 0 → 100644 +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.media; parcelable VolumePolicy;
media/java/android/media/VolumePolicy.java 0 → 100644 +68 −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.media; import android.os.Parcel; import android.os.Parcelable; /** @hide */ public final class VolumePolicy implements Parcelable { public static final VolumePolicy DEFAULT = new VolumePolicy(false, false, true); public final boolean volumeDownToEnterSilent; public final boolean volumeUpToExitSilent; public final boolean doNotDisturbWhenSilent; public VolumePolicy(boolean volumeDownToEnterSilent, boolean volumeUpToExitSilent, boolean doNotDisturbWhenSilent) { this.volumeDownToEnterSilent = volumeDownToEnterSilent; this.volumeUpToExitSilent = volumeUpToExitSilent; this.doNotDisturbWhenSilent = doNotDisturbWhenSilent; } @Override public String toString() { return "VolumePolicy[volumeDownToEnterSilent=" + volumeDownToEnterSilent + ",volumeUpToExitSilent=" + volumeUpToExitSilent + ",doNotDisturbWhenSilent=" + doNotDisturbWhenSilent + "]"; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(volumeDownToEnterSilent ? 1 : 0); dest.writeInt(volumeUpToExitSilent ? 1 : 0); dest.writeInt(doNotDisturbWhenSilent ? 1 : 0); } public static final Parcelable.Creator<VolumePolicy> CREATOR = new Parcelable.Creator<VolumePolicy>() { @Override public VolumePolicy createFromParcel(Parcel p) { return new VolumePolicy(p.readInt() != 0, p.readInt() != 0, p.readInt() != 0); } @Override public VolumePolicy[] newArray(int size) { return new VolumePolicy[size]; } }; } No newline at end of file