Merge "Volume policy updates."
This commit is contained in:
committed by
Android (Google) Code Review
commit
63b9e8200e
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -204,9 +205,12 @@ interface IAudioService {
|
||||
|
||||
boolean isHdmiSystemAudioSupported();
|
||||
|
||||
String registerAudioPolicy(in AudioPolicyConfig policyConfig,
|
||||
in IAudioPolicyCallback pcb, boolean hasFocusListener);
|
||||
String registerAudioPolicy(in AudioPolicyConfig policyConfig,
|
||||
in IAudioPolicyCallback pcb, boolean hasFocusListener);
|
||||
|
||||
oneway void unregisterAudioPolicyAsync(in IAudioPolicyCallback pcb);
|
||||
|
||||
int setFocusPropertiesForPolicy(int duckingBehavior, in IAudioPolicyCallback pcb);
|
||||
int setFocusPropertiesForPolicy(int duckingBehavior, in IAudioPolicyCallback pcb);
|
||||
|
||||
void setVolumePolicy(in VolumePolicy policy);
|
||||
}
|
||||
|
||||
19
media/java/android/media/VolumePolicy.aidl
Normal file
19
media/java/android/media/VolumePolicy.aidl
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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;
|
||||
68
media/java/android/media/VolumePolicy.java
Normal file
68
media/java/android/media/VolumePolicy.java
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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];
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user