Merge "Have Telecom service notify AudioService of RTT call state." into rvc-dev am: cbf33802f8 am: 9c660efeba am: 94fa96a644 am: 6e37cba8f6
Change-Id: Id2dc6182eca009d4c4b17659551d99867bc90c65
This commit is contained in:
@@ -5987,6 +5987,20 @@ public class AudioManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether or not there is an active RTT call.
|
||||
* This method should be called by Telecom service.
|
||||
* @hide
|
||||
* TODO: make this a @SystemApi
|
||||
*/
|
||||
public static void setRttEnabled(boolean rttEnabled) {
|
||||
try {
|
||||
getService().setRttEnabled(rttEnabled);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// Inner classes
|
||||
//--------------------
|
||||
|
||||
@@ -292,6 +292,8 @@ interface IAudioService {
|
||||
oneway void unregisterStrategyPreferredDeviceDispatcher(
|
||||
IStrategyPreferredDeviceDispatcher dispatcher);
|
||||
|
||||
oneway void setRttEnabled(in boolean rttEnabled);
|
||||
|
||||
// WARNING: read warning at top of file, new methods that need to be used by native
|
||||
// code via IAudioManager.h need to be added to the top section.
|
||||
}
|
||||
|
||||
@@ -635,6 +635,9 @@ public class AudioService extends IAudioService.Stub
|
||||
}
|
||||
};
|
||||
|
||||
@GuardedBy("mSettingsLock")
|
||||
private boolean mRttEnabled = false;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Construction
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -1054,7 +1057,7 @@ public class AudioService extends IAudioService.Stub
|
||||
sendEncodedSurroundMode(mContentResolver, "onAudioServerDied");
|
||||
sendEnabledSurroundFormats(mContentResolver, true);
|
||||
updateAssistantUId(true);
|
||||
updateRttEanbled(mContentResolver);
|
||||
AudioSystem.setRttEnabled(mRttEnabled);
|
||||
}
|
||||
synchronized (mAccessibilityServiceUidsLock) {
|
||||
AudioSystem.setA11yServicesUids(mAccessibilityServiceUids);
|
||||
@@ -1599,12 +1602,6 @@ public class AudioService extends IAudioService.Stub
|
||||
}
|
||||
}
|
||||
|
||||
private void updateRttEanbled(ContentResolver cr) {
|
||||
final boolean rttEnabled = Settings.Secure.getIntForUser(cr,
|
||||
Settings.Secure.RTT_CALLING_MODE, 0, UserHandle.USER_CURRENT) != 0;
|
||||
AudioSystem.setRttEnabled(rttEnabled);
|
||||
}
|
||||
|
||||
private void readPersistedSettings() {
|
||||
final ContentResolver cr = mContentResolver;
|
||||
|
||||
@@ -1649,7 +1646,7 @@ public class AudioService extends IAudioService.Stub
|
||||
sendEncodedSurroundMode(cr, "readPersistedSettings");
|
||||
sendEnabledSurroundFormats(cr, true);
|
||||
updateAssistantUId(true);
|
||||
updateRttEanbled(cr);
|
||||
AudioSystem.setRttEnabled(mRttEnabled);
|
||||
}
|
||||
|
||||
mMuteAffectedStreams = System.getIntForUser(cr,
|
||||
@@ -3770,6 +3767,27 @@ public class AudioService extends IAudioService.Stub
|
||||
return mIsCallScreeningModeSupported;
|
||||
}
|
||||
|
||||
/** @see AudioManager#setRttEnabled() */
|
||||
@Override
|
||||
public void setRttEnabled(boolean rttEnabled) {
|
||||
if (mContext.checkCallingOrSelfPermission(
|
||||
android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
Log.w(TAG, "MODIFY_PHONE_STATE Permission Denial: setRttEnabled from pid="
|
||||
+ Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
|
||||
return;
|
||||
}
|
||||
synchronized (mSettingsLock) {
|
||||
mRttEnabled = rttEnabled;
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
AudioSystem.setRttEnabled(rttEnabled);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================================
|
||||
// Sound Effects
|
||||
//==========================================================================================
|
||||
@@ -5984,8 +6002,6 @@ public class AudioService extends IAudioService.Stub
|
||||
|
||||
mContentResolver.registerContentObserver(Settings.Secure.getUriFor(
|
||||
Settings.Secure.VOICE_INTERACTION_SERVICE), false, this);
|
||||
mContentResolver.registerContentObserver(Settings.Secure.getUriFor(
|
||||
Settings.Secure.RTT_CALLING_MODE), false, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -6009,7 +6025,6 @@ public class AudioService extends IAudioService.Stub
|
||||
updateEncodedSurroundOutput();
|
||||
sendEnabledSurroundFormats(mContentResolver, mSurroundModeChanged);
|
||||
updateAssistantUId(false);
|
||||
updateRttEanbled(mContentResolver);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user