Merge "Have Telecom service notify AudioService of RTT call state." into rvc-dev am: cbf33802f8
Change-Id: I7270da5fb0cc82c769d6d1de10177e7975937918
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
|
// Inner classes
|
||||||
//--------------------
|
//--------------------
|
||||||
|
|||||||
@@ -292,6 +292,8 @@ interface IAudioService {
|
|||||||
oneway void unregisterStrategyPreferredDeviceDispatcher(
|
oneway void unregisterStrategyPreferredDeviceDispatcher(
|
||||||
IStrategyPreferredDeviceDispatcher dispatcher);
|
IStrategyPreferredDeviceDispatcher dispatcher);
|
||||||
|
|
||||||
|
oneway void setRttEnabled(in boolean rttEnabled);
|
||||||
|
|
||||||
// WARNING: read warning at top of file, new methods that need to be used by native
|
// 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.
|
// 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
|
// Construction
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@@ -1053,7 +1056,7 @@ public class AudioService extends IAudioService.Stub
|
|||||||
sendEncodedSurroundMode(mContentResolver, "onAudioServerDied");
|
sendEncodedSurroundMode(mContentResolver, "onAudioServerDied");
|
||||||
sendEnabledSurroundFormats(mContentResolver, true);
|
sendEnabledSurroundFormats(mContentResolver, true);
|
||||||
updateAssistantUId(true);
|
updateAssistantUId(true);
|
||||||
updateRttEanbled(mContentResolver);
|
AudioSystem.setRttEnabled(mRttEnabled);
|
||||||
}
|
}
|
||||||
synchronized (mAccessibilityServiceUidsLock) {
|
synchronized (mAccessibilityServiceUidsLock) {
|
||||||
AudioSystem.setA11yServicesUids(mAccessibilityServiceUids);
|
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() {
|
private void readPersistedSettings() {
|
||||||
final ContentResolver cr = mContentResolver;
|
final ContentResolver cr = mContentResolver;
|
||||||
|
|
||||||
@@ -1648,7 +1645,7 @@ public class AudioService extends IAudioService.Stub
|
|||||||
sendEncodedSurroundMode(cr, "readPersistedSettings");
|
sendEncodedSurroundMode(cr, "readPersistedSettings");
|
||||||
sendEnabledSurroundFormats(cr, true);
|
sendEnabledSurroundFormats(cr, true);
|
||||||
updateAssistantUId(true);
|
updateAssistantUId(true);
|
||||||
updateRttEanbled(cr);
|
AudioSystem.setRttEnabled(mRttEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
mMuteAffectedStreams = System.getIntForUser(cr,
|
mMuteAffectedStreams = System.getIntForUser(cr,
|
||||||
@@ -3684,6 +3681,27 @@ public class AudioService extends IAudioService.Stub
|
|||||||
return mIsCallScreeningModeSupported;
|
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
|
// Sound Effects
|
||||||
//==========================================================================================
|
//==========================================================================================
|
||||||
@@ -5825,8 +5843,6 @@ public class AudioService extends IAudioService.Stub
|
|||||||
|
|
||||||
mContentResolver.registerContentObserver(Settings.Secure.getUriFor(
|
mContentResolver.registerContentObserver(Settings.Secure.getUriFor(
|
||||||
Settings.Secure.VOICE_INTERACTION_SERVICE), false, this);
|
Settings.Secure.VOICE_INTERACTION_SERVICE), false, this);
|
||||||
mContentResolver.registerContentObserver(Settings.Secure.getUriFor(
|
|
||||||
Settings.Secure.RTT_CALLING_MODE), false, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -5850,7 +5866,6 @@ public class AudioService extends IAudioService.Stub
|
|||||||
updateEncodedSurroundOutput();
|
updateEncodedSurroundOutput();
|
||||||
sendEnabledSurroundFormats(mContentResolver, mSurroundModeChanged);
|
sendEnabledSurroundFormats(mContentResolver, mSurroundModeChanged);
|
||||||
updateAssistantUId(false);
|
updateAssistantUId(false);
|
||||||
updateRttEanbled(mContentResolver);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user