Merge "Have Telecom service notify AudioService of RTT call state." into rvc-dev am: cbf33802f8 am: 9c660efeba
Change-Id: I342660dc77b57c77ddfe303b02011400b6c9ef21
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.
|
||||
}
|
||||
|
||||
@@ -634,6 +634,9 @@ public class AudioService extends IAudioService.Stub
|
||||
}
|
||||
};
|
||||
|
||||
@GuardedBy("mSettingsLock")
|
||||
private boolean mRttEnabled = false;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Construction
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -1053,7 +1056,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);
|
||||
@@ -1598,12 +1601,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;
|
||||
|
||||
@@ -1648,7 +1645,7 @@ public class AudioService extends IAudioService.Stub
|
||||
sendEncodedSurroundMode(cr, "readPersistedSettings");
|
||||
sendEnabledSurroundFormats(cr, true);
|
||||
updateAssistantUId(true);
|
||||
updateRttEanbled(cr);
|
||||
AudioSystem.setRttEnabled(mRttEnabled);
|
||||
}
|
||||
|
||||
mMuteAffectedStreams = System.getIntForUser(cr,
|
||||
@@ -3684,6 +3681,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
|
||||
//==========================================================================================
|
||||
@@ -5825,8 +5843,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
|
||||
@@ -5850,7 +5866,6 @@ public class AudioService extends IAudioService.Stub
|
||||
updateEncodedSurroundOutput();
|
||||
sendEnabledSurroundFormats(mContentResolver, mSurroundModeChanged);
|
||||
updateAssistantUId(false);
|
||||
updateRttEanbled(mContentResolver);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user